@shgysk8zer0/importmap 1.4.87 → 1.5.0

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 CHANGED
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [v1.5.0] - 2025-12-03
11
+
12
+ ### Added
13
+ - Add `Importmap` class with `Map`-like methods and SRI/`<script>` generating methods
14
+
15
+ ### Changed
16
+ - Update `@aegisjsproject/idb` and `yaml`
17
+
18
+ ## [v1.4.88] - 2025-11-19
19
+
20
+ ### Changed
21
+ - Update component libraries with sanitizer fixes
22
+
10
23
  ## [v1.4.87] - 2025-11-18
11
24
 
12
25
  ### Changed
package/cli.cjs CHANGED
@@ -9,7 +9,8 @@ require('@shgysk8zer0/polyfills');
9
9
  require('@shgysk8zer0/npm-utils/path.js');
10
10
 
11
11
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
12
- const imports = {
12
+ const imports$1 = {
13
+ "@node/": "/node_modules/",
13
14
  "@shgysk8zer0/kazoo/": "https://unpkg.com/@shgysk8zer0/kazoo@1.0.10/",
14
15
  "@shgysk8zer0/konami": "https://unpkg.com/@shgysk8zer0/konami@1.1.1/konami.js",
15
16
  "@shgysk8zer0/polyfills": "https://unpkg.com/@shgysk8zer0/polyfills@0.5.1/browser.min.js",
@@ -48,15 +49,15 @@ const imports = {
48
49
  "@aegisjsproject/aegis-md/": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/",
49
50
  "@aegisjsproject/url": "https://unpkg.com/@aegisjsproject/url@1.0.3/url.mjs",
50
51
  "@aegisjsproject/url/": "https://unpkg.com/@aegisjsproject/url@1.0.3/",
51
- "@aegisjsproject/idb/": "https://unpkg.com/@aegisjsproject/idb@1.0.4/",
52
- "@aegisjsproject/idb": "https://unpkg.com/@aegisjsproject/idb@1.0.4/idb.min.js",
52
+ "@aegisjsproject/idb/": "https://unpkg.com/@aegisjsproject/idb@1.0.5/",
53
+ "@aegisjsproject/idb": "https://unpkg.com/@aegisjsproject/idb@1.0.5/idb.min.js",
53
54
  "@aegisjsproject/otp/": "https://unpkg.com/@aegisjsproject/otp@1.0.1/",
54
55
  "@aegisjsproject/otp": "https://unpkg.com/@aegisjsproject/otp@1.0.1/otp.min.js",
55
56
  "@aegisjsproject/md-editor": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/md-editor.js",
56
57
  "@aegisjsproject/md-editor/": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/",
57
58
  "@aegisjsproject/barcodescanner": "https://unpkg.com/@aegisjsproject/barcodescanner@1.1.3/scanner.min.js",
58
59
  "@aegisjsproject/barcodescanner/": "https://unpkg.com/@aegisjsproject/barcodescanner@1.1.3/",
59
- "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.19/",
60
+ "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.20/",
60
61
  "@aegisjsproject/state": "https://unpkg.com/@aegisjsproject/state@1.0.7/state.mjs",
61
62
  "@aegisjsproject/state/": "https://unpkg.com/@aegisjsproject/state@1.0.7/",
62
63
  "@aegisjsproject/router": "https://unpkg.com/@aegisjsproject/router@1.1.11/router.mjs",
@@ -71,7 +72,7 @@ const imports = {
71
72
  "@aegisjsproject/firebase-account-routes": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.5/main.js",
72
73
  "@aegisjsproject/firebase-account-routes/": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.5/",
73
74
  "@aegisjsproject/secret-store/": "https://unpkg.com/@aegisjsproject/secret-store@1.0.1/",
74
- "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.6/",
75
+ "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.9/",
75
76
  "@webcomponents/custom-elements": "https://unpkg.com/@webcomponents/custom-elements@1.6.0/custom-elements.min.js",
76
77
  leaflet: "https://unpkg.com/leaflet@1.9.4/dist/leaflet-src.esm.js",
77
78
  "leaflet/": "https://unpkg.com/leaflet@1.9.4/dist/",
@@ -80,10 +81,10 @@ const imports = {
80
81
  "highlight.js/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",
81
82
  "@highlightjs/cdn-assets": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/core.min.js",
82
83
  "@highlightjs/cdn-assets/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",
83
- marked: "https://unpkg.com/marked@17.0.0/lib/marked.esm.js",
84
+ marked: "https://unpkg.com/marked@17.0.1/lib/marked.esm.js",
84
85
  "marked-highlight": "https://unpkg.com/marked-highlight@2.2.3/src/index.js",
85
- yaml: "https://unpkg.com/yaml@2.8.1/browser/dist/index.js",
86
- "yaml/": "https://unpkg.com/yaml@2.8.1/browser/dist/",
86
+ yaml: "https://unpkg.com/yaml@2.8.2/browser/dist/index.js",
87
+ "yaml/": "https://unpkg.com/yaml@2.8.2/browser/dist/",
87
88
  "firebase/": "https://www.gstatic.com/firebasejs/10.12.1/",
88
89
  "firebase/app": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app.js",
89
90
  "firebase/app-check": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app-check.js",
@@ -97,11 +98,93 @@ const imports = {
97
98
  "firebase/storage": "https://www.gstatic.com/firebasejs/10.12.1/firebase-storage.js",
98
99
  "firebase/analytics": "https://www.gstatic.com/firebasejs/10.12.1/firebase-analytics.js"
99
100
  };
100
- const scope = {
101
+ const scope$1 = {
101
102
  };
103
+ var json = {
104
+ imports: imports$1,
105
+ scope: scope$1
106
+ };
107
+
108
+ const SHA256 = 'SHA-256';
109
+ const SHA384 = 'SHA-384';
110
+ const SHA512 = 'SHA-512';
111
+ const DEFAULT_ALGO = SHA384;
112
+
113
+ const BASE64 = 'base64';
114
+
115
+ const { imports, scope } = json;
116
+
117
+ class Importmap {
118
+ #imports = {};
119
+ #scope = {};
120
+
121
+ constructor({ imports: i = imports, scope: s = scope } = {}) {
122
+ this.#imports = i;
123
+ this.#scope = s;
124
+ }
125
+
126
+ delete(key) {
127
+ return Reflect.deleteProperty(this.#imports, key);
128
+ }
129
+
130
+ get(key) {
131
+ return Reflect.get(this.#imports, key);
132
+ }
133
+
134
+ has(key) {
135
+ return Reflect.has(this.#imports, key);
136
+ }
137
+
138
+ set(key, newValue) {
139
+ return Reflect.set(this.#imports, key, newValue);
140
+ }
141
+
142
+ toJSON() {
143
+ return { imports: this.#imports, scope: this.#scope };
144
+ }
145
+
146
+ toString() {
147
+ return JSON.stringify(this);
148
+ }
149
+
150
+ async getScript({ algo = DEFAULT_ALGO, alphabet = BASE64, signal } = {}) {
151
+ const integrity = await this.getIntegrity({ algo, alphabet, signal });
152
+
153
+ return `<script type="importmap" integrity="${integrity}">${JSON.stringify(this)}</script>`;
154
+ }
155
+
156
+ async getIntegrity({ algo = DEFAULT_ALGO, alphabet = BASE64, signal } = {}) {
157
+ if (signal instanceof AbortSignal && signal.aborted) {
158
+ throw signal.reason;
159
+ } else {
160
+ const prefix = algo.toLowerCase().replace('-', '') + '-';
161
+ const encoded = new TextEncoder().encode(this);
162
+ const hash = await crypto.subtle.digest(algo, encoded);
163
+
164
+ return prefix + new Uint8Array(hash).toBase64({ alphabet });
165
+ }
166
+ }
167
+
168
+ static get SHA256() {
169
+ return SHA256;
170
+ }
171
+
172
+ static get SHA384() {
173
+ return SHA384;
174
+ }
175
+
176
+ static get SHA512() {
177
+ return SHA512;
178
+ }
179
+ }
180
+
181
+ const importmap = new Importmap({ imports, scope });
102
182
 
103
- var importmap = /*#__PURE__*/Object.freeze({
183
+ var importmap$1 = /*#__PURE__*/Object.freeze({
104
184
  __proto__: null,
185
+ Importmap: Importmap,
186
+ default: importmap,
187
+ importmap: importmap,
105
188
  imports: imports,
106
189
  scope: scope
107
190
  });
@@ -166,7 +249,7 @@ init().then(async ({ opts: { input, encoding, format, output }}) => {
166
249
  imports: { ...imports$1, ...imports },
167
250
  scope: { ...scope$1, ...scope },
168
251
  }))
169
- : importmap;
252
+ : importmap$1;
170
253
 
171
254
  console.log(mod);
172
255
 
package/cli.js CHANGED
@@ -6,7 +6,8 @@ import 'node:fs/promises';
6
6
  import '@shgysk8zer0/polyfills';
7
7
  import '@shgysk8zer0/npm-utils/path.js';
8
8
 
9
- const imports = {
9
+ const imports$1 = {
10
+ "@node/": "/node_modules/",
10
11
  "@shgysk8zer0/kazoo/": "https://unpkg.com/@shgysk8zer0/kazoo@1.0.10/",
11
12
  "@shgysk8zer0/konami": "https://unpkg.com/@shgysk8zer0/konami@1.1.1/konami.js",
12
13
  "@shgysk8zer0/polyfills": "https://unpkg.com/@shgysk8zer0/polyfills@0.5.1/browser.min.js",
@@ -45,15 +46,15 @@ const imports = {
45
46
  "@aegisjsproject/aegis-md/": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/",
46
47
  "@aegisjsproject/url": "https://unpkg.com/@aegisjsproject/url@1.0.3/url.mjs",
47
48
  "@aegisjsproject/url/": "https://unpkg.com/@aegisjsproject/url@1.0.3/",
48
- "@aegisjsproject/idb/": "https://unpkg.com/@aegisjsproject/idb@1.0.4/",
49
- "@aegisjsproject/idb": "https://unpkg.com/@aegisjsproject/idb@1.0.4/idb.min.js",
49
+ "@aegisjsproject/idb/": "https://unpkg.com/@aegisjsproject/idb@1.0.5/",
50
+ "@aegisjsproject/idb": "https://unpkg.com/@aegisjsproject/idb@1.0.5/idb.min.js",
50
51
  "@aegisjsproject/otp/": "https://unpkg.com/@aegisjsproject/otp@1.0.1/",
51
52
  "@aegisjsproject/otp": "https://unpkg.com/@aegisjsproject/otp@1.0.1/otp.min.js",
52
53
  "@aegisjsproject/md-editor": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/md-editor.js",
53
54
  "@aegisjsproject/md-editor/": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/",
54
55
  "@aegisjsproject/barcodescanner": "https://unpkg.com/@aegisjsproject/barcodescanner@1.1.3/scanner.min.js",
55
56
  "@aegisjsproject/barcodescanner/": "https://unpkg.com/@aegisjsproject/barcodescanner@1.1.3/",
56
- "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.19/",
57
+ "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.20/",
57
58
  "@aegisjsproject/state": "https://unpkg.com/@aegisjsproject/state@1.0.7/state.mjs",
58
59
  "@aegisjsproject/state/": "https://unpkg.com/@aegisjsproject/state@1.0.7/",
59
60
  "@aegisjsproject/router": "https://unpkg.com/@aegisjsproject/router@1.1.11/router.mjs",
@@ -68,7 +69,7 @@ const imports = {
68
69
  "@aegisjsproject/firebase-account-routes": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.5/main.js",
69
70
  "@aegisjsproject/firebase-account-routes/": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.5/",
70
71
  "@aegisjsproject/secret-store/": "https://unpkg.com/@aegisjsproject/secret-store@1.0.1/",
71
- "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.6/",
72
+ "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.9/",
72
73
  "@webcomponents/custom-elements": "https://unpkg.com/@webcomponents/custom-elements@1.6.0/custom-elements.min.js",
73
74
  leaflet: "https://unpkg.com/leaflet@1.9.4/dist/leaflet-src.esm.js",
74
75
  "leaflet/": "https://unpkg.com/leaflet@1.9.4/dist/",
@@ -77,10 +78,10 @@ const imports = {
77
78
  "highlight.js/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",
78
79
  "@highlightjs/cdn-assets": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/core.min.js",
79
80
  "@highlightjs/cdn-assets/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",
80
- marked: "https://unpkg.com/marked@17.0.0/lib/marked.esm.js",
81
+ marked: "https://unpkg.com/marked@17.0.1/lib/marked.esm.js",
81
82
  "marked-highlight": "https://unpkg.com/marked-highlight@2.2.3/src/index.js",
82
- yaml: "https://unpkg.com/yaml@2.8.1/browser/dist/index.js",
83
- "yaml/": "https://unpkg.com/yaml@2.8.1/browser/dist/",
83
+ yaml: "https://unpkg.com/yaml@2.8.2/browser/dist/index.js",
84
+ "yaml/": "https://unpkg.com/yaml@2.8.2/browser/dist/",
84
85
  "firebase/": "https://www.gstatic.com/firebasejs/10.12.1/",
85
86
  "firebase/app": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app.js",
86
87
  "firebase/app-check": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app-check.js",
@@ -94,11 +95,93 @@ const imports = {
94
95
  "firebase/storage": "https://www.gstatic.com/firebasejs/10.12.1/firebase-storage.js",
95
96
  "firebase/analytics": "https://www.gstatic.com/firebasejs/10.12.1/firebase-analytics.js"
96
97
  };
97
- const scope = {
98
+ const scope$1 = {
98
99
  };
100
+ var json = {
101
+ imports: imports$1,
102
+ scope: scope$1
103
+ };
104
+
105
+ const SHA256 = 'SHA-256';
106
+ const SHA384 = 'SHA-384';
107
+ const SHA512 = 'SHA-512';
108
+ const DEFAULT_ALGO = SHA384;
109
+
110
+ const BASE64 = 'base64';
111
+
112
+ const { imports, scope } = json;
113
+
114
+ class Importmap {
115
+ #imports = {};
116
+ #scope = {};
117
+
118
+ constructor({ imports: i = imports, scope: s = scope } = {}) {
119
+ this.#imports = i;
120
+ this.#scope = s;
121
+ }
122
+
123
+ delete(key) {
124
+ return Reflect.deleteProperty(this.#imports, key);
125
+ }
126
+
127
+ get(key) {
128
+ return Reflect.get(this.#imports, key);
129
+ }
130
+
131
+ has(key) {
132
+ return Reflect.has(this.#imports, key);
133
+ }
134
+
135
+ set(key, newValue) {
136
+ return Reflect.set(this.#imports, key, newValue);
137
+ }
138
+
139
+ toJSON() {
140
+ return { imports: this.#imports, scope: this.#scope };
141
+ }
142
+
143
+ toString() {
144
+ return JSON.stringify(this);
145
+ }
146
+
147
+ async getScript({ algo = DEFAULT_ALGO, alphabet = BASE64, signal } = {}) {
148
+ const integrity = await this.getIntegrity({ algo, alphabet, signal });
149
+
150
+ return `<script type="importmap" integrity="${integrity}">${JSON.stringify(this)}</script>`;
151
+ }
152
+
153
+ async getIntegrity({ algo = DEFAULT_ALGO, alphabet = BASE64, signal } = {}) {
154
+ if (signal instanceof AbortSignal && signal.aborted) {
155
+ throw signal.reason;
156
+ } else {
157
+ const prefix = algo.toLowerCase().replace('-', '') + '-';
158
+ const encoded = new TextEncoder().encode(this);
159
+ const hash = await crypto.subtle.digest(algo, encoded);
160
+
161
+ return prefix + new Uint8Array(hash).toBase64({ alphabet });
162
+ }
163
+ }
164
+
165
+ static get SHA256() {
166
+ return SHA256;
167
+ }
168
+
169
+ static get SHA384() {
170
+ return SHA384;
171
+ }
172
+
173
+ static get SHA512() {
174
+ return SHA512;
175
+ }
176
+ }
177
+
178
+ const importmap = new Importmap({ imports, scope });
99
179
 
100
- var importmap = /*#__PURE__*/Object.freeze({
180
+ var importmap$1 = /*#__PURE__*/Object.freeze({
101
181
  __proto__: null,
182
+ Importmap: Importmap,
183
+ default: importmap,
184
+ importmap: importmap,
102
185
  imports: imports,
103
186
  scope: scope
104
187
  });
@@ -163,7 +246,7 @@ init().then(async ({ opts: { input, encoding, format, output }}) => {
163
246
  imports: { ...imports$1, ...imports },
164
247
  scope: { ...scope$1, ...scope },
165
248
  }))
166
- : importmap;
249
+ : importmap$1;
167
250
 
168
251
  console.log(mod);
169
252
 
package/importmap.cjs CHANGED
@@ -1,6 +1,11 @@
1
1
  'use strict';
2
2
 
3
- const imports = {
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ require('@shgysk8zer0/polyfills');
6
+
7
+ const imports$1 = {
8
+ "@node/": "/node_modules/",
4
9
  "@shgysk8zer0/kazoo/": "https://unpkg.com/@shgysk8zer0/kazoo@1.0.10/",
5
10
  "@shgysk8zer0/konami": "https://unpkg.com/@shgysk8zer0/konami@1.1.1/konami.js",
6
11
  "@shgysk8zer0/polyfills": "https://unpkg.com/@shgysk8zer0/polyfills@0.5.1/browser.min.js",
@@ -39,15 +44,15 @@ const imports = {
39
44
  "@aegisjsproject/aegis-md/": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/",
40
45
  "@aegisjsproject/url": "https://unpkg.com/@aegisjsproject/url@1.0.3/url.mjs",
41
46
  "@aegisjsproject/url/": "https://unpkg.com/@aegisjsproject/url@1.0.3/",
42
- "@aegisjsproject/idb/": "https://unpkg.com/@aegisjsproject/idb@1.0.4/",
43
- "@aegisjsproject/idb": "https://unpkg.com/@aegisjsproject/idb@1.0.4/idb.min.js",
47
+ "@aegisjsproject/idb/": "https://unpkg.com/@aegisjsproject/idb@1.0.5/",
48
+ "@aegisjsproject/idb": "https://unpkg.com/@aegisjsproject/idb@1.0.5/idb.min.js",
44
49
  "@aegisjsproject/otp/": "https://unpkg.com/@aegisjsproject/otp@1.0.1/",
45
50
  "@aegisjsproject/otp": "https://unpkg.com/@aegisjsproject/otp@1.0.1/otp.min.js",
46
51
  "@aegisjsproject/md-editor": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/md-editor.js",
47
52
  "@aegisjsproject/md-editor/": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/",
48
53
  "@aegisjsproject/barcodescanner": "https://unpkg.com/@aegisjsproject/barcodescanner@1.1.3/scanner.min.js",
49
54
  "@aegisjsproject/barcodescanner/": "https://unpkg.com/@aegisjsproject/barcodescanner@1.1.3/",
50
- "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.19/",
55
+ "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.20/",
51
56
  "@aegisjsproject/state": "https://unpkg.com/@aegisjsproject/state@1.0.7/state.mjs",
52
57
  "@aegisjsproject/state/": "https://unpkg.com/@aegisjsproject/state@1.0.7/",
53
58
  "@aegisjsproject/router": "https://unpkg.com/@aegisjsproject/router@1.1.11/router.mjs",
@@ -62,7 +67,7 @@ const imports = {
62
67
  "@aegisjsproject/firebase-account-routes": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.5/main.js",
63
68
  "@aegisjsproject/firebase-account-routes/": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.5/",
64
69
  "@aegisjsproject/secret-store/": "https://unpkg.com/@aegisjsproject/secret-store@1.0.1/",
65
- "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.6/",
70
+ "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.9/",
66
71
  "@webcomponents/custom-elements": "https://unpkg.com/@webcomponents/custom-elements@1.6.0/custom-elements.min.js",
67
72
  leaflet: "https://unpkg.com/leaflet@1.9.4/dist/leaflet-src.esm.js",
68
73
  "leaflet/": "https://unpkg.com/leaflet@1.9.4/dist/",
@@ -71,10 +76,10 @@ const imports = {
71
76
  "highlight.js/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",
72
77
  "@highlightjs/cdn-assets": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/core.min.js",
73
78
  "@highlightjs/cdn-assets/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",
74
- marked: "https://unpkg.com/marked@17.0.0/lib/marked.esm.js",
79
+ marked: "https://unpkg.com/marked@17.0.1/lib/marked.esm.js",
75
80
  "marked-highlight": "https://unpkg.com/marked-highlight@2.2.3/src/index.js",
76
- yaml: "https://unpkg.com/yaml@2.8.1/browser/dist/index.js",
77
- "yaml/": "https://unpkg.com/yaml@2.8.1/browser/dist/",
81
+ yaml: "https://unpkg.com/yaml@2.8.2/browser/dist/index.js",
82
+ "yaml/": "https://unpkg.com/yaml@2.8.2/browser/dist/",
78
83
  "firebase/": "https://www.gstatic.com/firebasejs/10.12.1/",
79
84
  "firebase/app": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app.js",
80
85
  "firebase/app-check": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app-check.js",
@@ -88,8 +93,90 @@ const imports = {
88
93
  "firebase/storage": "https://www.gstatic.com/firebasejs/10.12.1/firebase-storage.js",
89
94
  "firebase/analytics": "https://www.gstatic.com/firebasejs/10.12.1/firebase-analytics.js"
90
95
  };
91
- const scope = {
96
+ const scope$1 = {
97
+ };
98
+ var json = {
99
+ imports: imports$1,
100
+ scope: scope$1
92
101
  };
93
102
 
103
+ const SHA256 = 'SHA-256';
104
+ const SHA384 = 'SHA-384';
105
+ const SHA512 = 'SHA-512';
106
+ const DEFAULT_ALGO = SHA384;
107
+
108
+ const BASE64 = 'base64';
109
+
110
+ const { imports, scope } = json;
111
+
112
+ class Importmap {
113
+ #imports = {};
114
+ #scope = {};
115
+
116
+ constructor({ imports: i = imports, scope: s = scope } = {}) {
117
+ this.#imports = i;
118
+ this.#scope = s;
119
+ }
120
+
121
+ delete(key) {
122
+ return Reflect.deleteProperty(this.#imports, key);
123
+ }
124
+
125
+ get(key) {
126
+ return Reflect.get(this.#imports, key);
127
+ }
128
+
129
+ has(key) {
130
+ return Reflect.has(this.#imports, key);
131
+ }
132
+
133
+ set(key, newValue) {
134
+ return Reflect.set(this.#imports, key, newValue);
135
+ }
136
+
137
+ toJSON() {
138
+ return { imports: this.#imports, scope: this.#scope };
139
+ }
140
+
141
+ toString() {
142
+ return JSON.stringify(this);
143
+ }
144
+
145
+ async getScript({ algo = DEFAULT_ALGO, alphabet = BASE64, signal } = {}) {
146
+ const integrity = await this.getIntegrity({ algo, alphabet, signal });
147
+
148
+ return `<script type="importmap" integrity="${integrity}">${JSON.stringify(this)}</script>`;
149
+ }
150
+
151
+ async getIntegrity({ algo = DEFAULT_ALGO, alphabet = BASE64, signal } = {}) {
152
+ if (signal instanceof AbortSignal && signal.aborted) {
153
+ throw signal.reason;
154
+ } else {
155
+ const prefix = algo.toLowerCase().replace('-', '') + '-';
156
+ const encoded = new TextEncoder().encode(this);
157
+ const hash = await crypto.subtle.digest(algo, encoded);
158
+
159
+ return prefix + new Uint8Array(hash).toBase64({ alphabet });
160
+ }
161
+ }
162
+
163
+ static get SHA256() {
164
+ return SHA256;
165
+ }
166
+
167
+ static get SHA384() {
168
+ return SHA384;
169
+ }
170
+
171
+ static get SHA512() {
172
+ return SHA512;
173
+ }
174
+ }
175
+
176
+ const importmap = new Importmap({ imports, scope });
177
+
178
+ exports.Importmap = Importmap;
179
+ exports.default = importmap;
180
+ exports.importmap = importmap;
94
181
  exports.imports = imports;
95
182
  exports.scope = scope;
package/importmap.js CHANGED
@@ -1,4 +1,7 @@
1
- const imports = {
1
+ import '@shgysk8zer0/polyfills';
2
+
3
+ const imports$1 = {
4
+ "@node/": "/node_modules/",
2
5
  "@shgysk8zer0/kazoo/": "https://unpkg.com/@shgysk8zer0/kazoo@1.0.10/",
3
6
  "@shgysk8zer0/konami": "https://unpkg.com/@shgysk8zer0/konami@1.1.1/konami.js",
4
7
  "@shgysk8zer0/polyfills": "https://unpkg.com/@shgysk8zer0/polyfills@0.5.1/browser.min.js",
@@ -37,15 +40,15 @@ const imports = {
37
40
  "@aegisjsproject/aegis-md/": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/",
38
41
  "@aegisjsproject/url": "https://unpkg.com/@aegisjsproject/url@1.0.3/url.mjs",
39
42
  "@aegisjsproject/url/": "https://unpkg.com/@aegisjsproject/url@1.0.3/",
40
- "@aegisjsproject/idb/": "https://unpkg.com/@aegisjsproject/idb@1.0.4/",
41
- "@aegisjsproject/idb": "https://unpkg.com/@aegisjsproject/idb@1.0.4/idb.min.js",
43
+ "@aegisjsproject/idb/": "https://unpkg.com/@aegisjsproject/idb@1.0.5/",
44
+ "@aegisjsproject/idb": "https://unpkg.com/@aegisjsproject/idb@1.0.5/idb.min.js",
42
45
  "@aegisjsproject/otp/": "https://unpkg.com/@aegisjsproject/otp@1.0.1/",
43
46
  "@aegisjsproject/otp": "https://unpkg.com/@aegisjsproject/otp@1.0.1/otp.min.js",
44
47
  "@aegisjsproject/md-editor": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/md-editor.js",
45
48
  "@aegisjsproject/md-editor/": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/",
46
49
  "@aegisjsproject/barcodescanner": "https://unpkg.com/@aegisjsproject/barcodescanner@1.1.3/scanner.min.js",
47
50
  "@aegisjsproject/barcodescanner/": "https://unpkg.com/@aegisjsproject/barcodescanner@1.1.3/",
48
- "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.19/",
51
+ "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.20/",
49
52
  "@aegisjsproject/state": "https://unpkg.com/@aegisjsproject/state@1.0.7/state.mjs",
50
53
  "@aegisjsproject/state/": "https://unpkg.com/@aegisjsproject/state@1.0.7/",
51
54
  "@aegisjsproject/router": "https://unpkg.com/@aegisjsproject/router@1.1.11/router.mjs",
@@ -60,7 +63,7 @@ const imports = {
60
63
  "@aegisjsproject/firebase-account-routes": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.5/main.js",
61
64
  "@aegisjsproject/firebase-account-routes/": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.5/",
62
65
  "@aegisjsproject/secret-store/": "https://unpkg.com/@aegisjsproject/secret-store@1.0.1/",
63
- "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.6/",
66
+ "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.9/",
64
67
  "@webcomponents/custom-elements": "https://unpkg.com/@webcomponents/custom-elements@1.6.0/custom-elements.min.js",
65
68
  leaflet: "https://unpkg.com/leaflet@1.9.4/dist/leaflet-src.esm.js",
66
69
  "leaflet/": "https://unpkg.com/leaflet@1.9.4/dist/",
@@ -69,10 +72,10 @@ const imports = {
69
72
  "highlight.js/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",
70
73
  "@highlightjs/cdn-assets": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/core.min.js",
71
74
  "@highlightjs/cdn-assets/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",
72
- marked: "https://unpkg.com/marked@17.0.0/lib/marked.esm.js",
75
+ marked: "https://unpkg.com/marked@17.0.1/lib/marked.esm.js",
73
76
  "marked-highlight": "https://unpkg.com/marked-highlight@2.2.3/src/index.js",
74
- yaml: "https://unpkg.com/yaml@2.8.1/browser/dist/index.js",
75
- "yaml/": "https://unpkg.com/yaml@2.8.1/browser/dist/",
77
+ yaml: "https://unpkg.com/yaml@2.8.2/browser/dist/index.js",
78
+ "yaml/": "https://unpkg.com/yaml@2.8.2/browser/dist/",
76
79
  "firebase/": "https://www.gstatic.com/firebasejs/10.12.1/",
77
80
  "firebase/app": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app.js",
78
81
  "firebase/app-check": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app-check.js",
@@ -86,7 +89,86 @@ const imports = {
86
89
  "firebase/storage": "https://www.gstatic.com/firebasejs/10.12.1/firebase-storage.js",
87
90
  "firebase/analytics": "https://www.gstatic.com/firebasejs/10.12.1/firebase-analytics.js"
88
91
  };
89
- const scope = {
92
+ const scope$1 = {
93
+ };
94
+ var json = {
95
+ imports: imports$1,
96
+ scope: scope$1
90
97
  };
91
98
 
92
- export { imports, scope };
99
+ const SHA256 = 'SHA-256';
100
+ const SHA384 = 'SHA-384';
101
+ const SHA512 = 'SHA-512';
102
+ const DEFAULT_ALGO = SHA384;
103
+
104
+ const BASE64 = 'base64';
105
+
106
+ const { imports, scope } = json;
107
+
108
+ class Importmap {
109
+ #imports = {};
110
+ #scope = {};
111
+
112
+ constructor({ imports: i = imports, scope: s = scope } = {}) {
113
+ this.#imports = i;
114
+ this.#scope = s;
115
+ }
116
+
117
+ delete(key) {
118
+ return Reflect.deleteProperty(this.#imports, key);
119
+ }
120
+
121
+ get(key) {
122
+ return Reflect.get(this.#imports, key);
123
+ }
124
+
125
+ has(key) {
126
+ return Reflect.has(this.#imports, key);
127
+ }
128
+
129
+ set(key, newValue) {
130
+ return Reflect.set(this.#imports, key, newValue);
131
+ }
132
+
133
+ toJSON() {
134
+ return { imports: this.#imports, scope: this.#scope };
135
+ }
136
+
137
+ toString() {
138
+ return JSON.stringify(this);
139
+ }
140
+
141
+ async getScript({ algo = DEFAULT_ALGO, alphabet = BASE64, signal } = {}) {
142
+ const integrity = await this.getIntegrity({ algo, alphabet, signal });
143
+
144
+ return `<script type="importmap" integrity="${integrity}">${JSON.stringify(this)}</script>`;
145
+ }
146
+
147
+ async getIntegrity({ algo = DEFAULT_ALGO, alphabet = BASE64, signal } = {}) {
148
+ if (signal instanceof AbortSignal && signal.aborted) {
149
+ throw signal.reason;
150
+ } else {
151
+ const prefix = algo.toLowerCase().replace('-', '') + '-';
152
+ const encoded = new TextEncoder().encode(this);
153
+ const hash = await crypto.subtle.digest(algo, encoded);
154
+
155
+ return prefix + new Uint8Array(hash).toBase64({ alphabet });
156
+ }
157
+ }
158
+
159
+ static get SHA256() {
160
+ return SHA256;
161
+ }
162
+
163
+ static get SHA384() {
164
+ return SHA384;
165
+ }
166
+
167
+ static get SHA512() {
168
+ return SHA512;
169
+ }
170
+ }
171
+
172
+ const importmap = new Importmap({ imports, scope });
173
+
174
+ export { Importmap, importmap as default, importmap, imports, scope };
package/importmap.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "imports": {
3
+ "@node/": "/node_modules/",
3
4
  "@shgysk8zer0/kazoo/": "https://unpkg.com/@shgysk8zer0/kazoo@1.0.10/",
4
5
  "@shgysk8zer0/konami": "https://unpkg.com/@shgysk8zer0/konami@1.1.1/konami.js",
5
6
  "@shgysk8zer0/polyfills": "https://unpkg.com/@shgysk8zer0/polyfills@0.5.1/browser.min.js",
@@ -38,15 +39,15 @@
38
39
  "@aegisjsproject/aegis-md/": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/",
39
40
  "@aegisjsproject/url": "https://unpkg.com/@aegisjsproject/url@1.0.3/url.mjs",
40
41
  "@aegisjsproject/url/": "https://unpkg.com/@aegisjsproject/url@1.0.3/",
41
- "@aegisjsproject/idb/": "https://unpkg.com/@aegisjsproject/idb@1.0.4/",
42
- "@aegisjsproject/idb": "https://unpkg.com/@aegisjsproject/idb@1.0.4/idb.min.js",
42
+ "@aegisjsproject/idb/": "https://unpkg.com/@aegisjsproject/idb@1.0.5/",
43
+ "@aegisjsproject/idb": "https://unpkg.com/@aegisjsproject/idb@1.0.5/idb.min.js",
43
44
  "@aegisjsproject/otp/": "https://unpkg.com/@aegisjsproject/otp@1.0.1/",
44
45
  "@aegisjsproject/otp": "https://unpkg.com/@aegisjsproject/otp@1.0.1/otp.min.js",
45
46
  "@aegisjsproject/md-editor": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/md-editor.js",
46
47
  "@aegisjsproject/md-editor/": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/",
47
48
  "@aegisjsproject/barcodescanner": "https://unpkg.com/@aegisjsproject/barcodescanner@1.1.3/scanner.min.js",
48
49
  "@aegisjsproject/barcodescanner/": "https://unpkg.com/@aegisjsproject/barcodescanner@1.1.3/",
49
- "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.19/",
50
+ "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.20/",
50
51
  "@aegisjsproject/state": "https://unpkg.com/@aegisjsproject/state@1.0.7/state.mjs",
51
52
  "@aegisjsproject/state/": "https://unpkg.com/@aegisjsproject/state@1.0.7/",
52
53
  "@aegisjsproject/router": "https://unpkg.com/@aegisjsproject/router@1.1.11/router.mjs",
@@ -61,7 +62,7 @@
61
62
  "@aegisjsproject/firebase-account-routes": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.5/main.js",
62
63
  "@aegisjsproject/firebase-account-routes/": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.5/",
63
64
  "@aegisjsproject/secret-store/": "https://unpkg.com/@aegisjsproject/secret-store@1.0.1/",
64
- "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.6/",
65
+ "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.9/",
65
66
  "@webcomponents/custom-elements": "https://unpkg.com/@webcomponents/custom-elements@1.6.0/custom-elements.min.js",
66
67
  "leaflet": "https://unpkg.com/leaflet@1.9.4/dist/leaflet-src.esm.js",
67
68
  "leaflet/": "https://unpkg.com/leaflet@1.9.4/dist/",
@@ -70,10 +71,10 @@
70
71
  "highlight.js/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",
71
72
  "@highlightjs/cdn-assets": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/core.min.js",
72
73
  "@highlightjs/cdn-assets/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",
73
- "marked": "https://unpkg.com/marked@17.0.0/lib/marked.esm.js",
74
+ "marked": "https://unpkg.com/marked@17.0.1/lib/marked.esm.js",
74
75
  "marked-highlight": "https://unpkg.com/marked-highlight@2.2.3/src/index.js",
75
- "yaml": "https://unpkg.com/yaml@2.8.1/browser/dist/index.js",
76
- "yaml/": "https://unpkg.com/yaml@2.8.1/browser/dist/",
76
+ "yaml": "https://unpkg.com/yaml@2.8.2/browser/dist/index.js",
77
+ "yaml/": "https://unpkg.com/yaml@2.8.2/browser/dist/",
77
78
  "firebase/": "https://www.gstatic.com/firebasejs/10.12.1/",
78
79
  "firebase/app": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app.js",
79
80
  "firebase/app-check": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app-check.js",
@@ -88,4 +89,4 @@
88
89
  "firebase/analytics": "https://www.gstatic.com/firebasejs/10.12.1/firebase-analytics.js"
89
90
  },
90
91
  "scope": {}
91
- }
92
+ }
package/index.cjs CHANGED
@@ -6,7 +6,8 @@ var yaml_js = require('@shgysk8zer0/npm-utils/yaml.js');
6
6
  var json_js = require('@shgysk8zer0/npm-utils/json.js');
7
7
  var path_js = require('@shgysk8zer0/npm-utils/path.js');
8
8
 
9
- const imports$1 = {
9
+ const imports$2 = {
10
+ "@node/": "/node_modules/",
10
11
  "@shgysk8zer0/kazoo/": "https://unpkg.com/@shgysk8zer0/kazoo@1.0.10/",
11
12
  "@shgysk8zer0/konami": "https://unpkg.com/@shgysk8zer0/konami@1.1.1/konami.js",
12
13
  "@shgysk8zer0/polyfills": "https://unpkg.com/@shgysk8zer0/polyfills@0.5.1/browser.min.js",
@@ -45,15 +46,15 @@ const imports$1 = {
45
46
  "@aegisjsproject/aegis-md/": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/",
46
47
  "@aegisjsproject/url": "https://unpkg.com/@aegisjsproject/url@1.0.3/url.mjs",
47
48
  "@aegisjsproject/url/": "https://unpkg.com/@aegisjsproject/url@1.0.3/",
48
- "@aegisjsproject/idb/": "https://unpkg.com/@aegisjsproject/idb@1.0.4/",
49
- "@aegisjsproject/idb": "https://unpkg.com/@aegisjsproject/idb@1.0.4/idb.min.js",
49
+ "@aegisjsproject/idb/": "https://unpkg.com/@aegisjsproject/idb@1.0.5/",
50
+ "@aegisjsproject/idb": "https://unpkg.com/@aegisjsproject/idb@1.0.5/idb.min.js",
50
51
  "@aegisjsproject/otp/": "https://unpkg.com/@aegisjsproject/otp@1.0.1/",
51
52
  "@aegisjsproject/otp": "https://unpkg.com/@aegisjsproject/otp@1.0.1/otp.min.js",
52
53
  "@aegisjsproject/md-editor": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/md-editor.js",
53
54
  "@aegisjsproject/md-editor/": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/",
54
55
  "@aegisjsproject/barcodescanner": "https://unpkg.com/@aegisjsproject/barcodescanner@1.1.3/scanner.min.js",
55
56
  "@aegisjsproject/barcodescanner/": "https://unpkg.com/@aegisjsproject/barcodescanner@1.1.3/",
56
- "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.19/",
57
+ "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.20/",
57
58
  "@aegisjsproject/state": "https://unpkg.com/@aegisjsproject/state@1.0.7/state.mjs",
58
59
  "@aegisjsproject/state/": "https://unpkg.com/@aegisjsproject/state@1.0.7/",
59
60
  "@aegisjsproject/router": "https://unpkg.com/@aegisjsproject/router@1.1.11/router.mjs",
@@ -68,7 +69,7 @@ const imports$1 = {
68
69
  "@aegisjsproject/firebase-account-routes": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.5/main.js",
69
70
  "@aegisjsproject/firebase-account-routes/": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.5/",
70
71
  "@aegisjsproject/secret-store/": "https://unpkg.com/@aegisjsproject/secret-store@1.0.1/",
71
- "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.6/",
72
+ "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.9/",
72
73
  "@webcomponents/custom-elements": "https://unpkg.com/@webcomponents/custom-elements@1.6.0/custom-elements.min.js",
73
74
  leaflet: "https://unpkg.com/leaflet@1.9.4/dist/leaflet-src.esm.js",
74
75
  "leaflet/": "https://unpkg.com/leaflet@1.9.4/dist/",
@@ -77,10 +78,10 @@ const imports$1 = {
77
78
  "highlight.js/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",
78
79
  "@highlightjs/cdn-assets": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/core.min.js",
79
80
  "@highlightjs/cdn-assets/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",
80
- marked: "https://unpkg.com/marked@17.0.0/lib/marked.esm.js",
81
+ marked: "https://unpkg.com/marked@17.0.1/lib/marked.esm.js",
81
82
  "marked-highlight": "https://unpkg.com/marked-highlight@2.2.3/src/index.js",
82
- yaml: "https://unpkg.com/yaml@2.8.1/browser/dist/index.js",
83
- "yaml/": "https://unpkg.com/yaml@2.8.1/browser/dist/",
83
+ yaml: "https://unpkg.com/yaml@2.8.2/browser/dist/index.js",
84
+ "yaml/": "https://unpkg.com/yaml@2.8.2/browser/dist/",
84
85
  "firebase/": "https://www.gstatic.com/firebasejs/10.12.1/",
85
86
  "firebase/app": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app.js",
86
87
  "firebase/app-check": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app-check.js",
@@ -94,16 +95,16 @@ const imports$1 = {
94
95
  "firebase/storage": "https://www.gstatic.com/firebasejs/10.12.1/firebase-storage.js",
95
96
  "firebase/analytics": "https://www.gstatic.com/firebasejs/10.12.1/firebase-analytics.js"
96
97
  };
97
- const scope$1 = {
98
+ const scope$2 = {
99
+ };
100
+ var json = {
101
+ imports: imports$2,
102
+ scope: scope$2
98
103
  };
99
104
 
100
- var importmap = /*#__PURE__*/Object.freeze({
101
- __proto__: null,
102
- imports: imports$1,
103
- scope: scope$1
104
- });
105
-
105
+ const SHA256 = 'SHA-256';
106
106
  const SHA384 = 'SHA-384';
107
+ const SHA512 = 'SHA-512';
107
108
  const DEFAULT_ALGO = SHA384;
108
109
 
109
110
  const BASE64 = 'base64';
@@ -140,6 +141,83 @@ async function hash(data, { algo = DEFAULT_ALGO, output = BUFFER } = {}) {
140
141
 
141
142
  const sri = async(data, { algo = SHA384 } = {}) => hash(data, { algo, output: SRI });
142
143
 
144
+ const { imports: imports$1, scope: scope$1 } = json;
145
+
146
+ class Importmap {
147
+ #imports = {};
148
+ #scope = {};
149
+
150
+ constructor({ imports: i = imports$1, scope: s = scope$1 } = {}) {
151
+ this.#imports = i;
152
+ this.#scope = s;
153
+ }
154
+
155
+ delete(key) {
156
+ return Reflect.deleteProperty(this.#imports, key);
157
+ }
158
+
159
+ get(key) {
160
+ return Reflect.get(this.#imports, key);
161
+ }
162
+
163
+ has(key) {
164
+ return Reflect.has(this.#imports, key);
165
+ }
166
+
167
+ set(key, newValue) {
168
+ return Reflect.set(this.#imports, key, newValue);
169
+ }
170
+
171
+ toJSON() {
172
+ return { imports: this.#imports, scope: this.#scope };
173
+ }
174
+
175
+ toString() {
176
+ return JSON.stringify(this);
177
+ }
178
+
179
+ async getScript({ algo = DEFAULT_ALGO, alphabet = BASE64, signal } = {}) {
180
+ const integrity = await this.getIntegrity({ algo, alphabet, signal });
181
+
182
+ return `<script type="importmap" integrity="${integrity}">${JSON.stringify(this)}</script>`;
183
+ }
184
+
185
+ async getIntegrity({ algo = DEFAULT_ALGO, alphabet = BASE64, signal } = {}) {
186
+ if (signal instanceof AbortSignal && signal.aborted) {
187
+ throw signal.reason;
188
+ } else {
189
+ const prefix = algo.toLowerCase().replace('-', '') + '-';
190
+ const encoded = new TextEncoder().encode(this);
191
+ const hash = await crypto.subtle.digest(algo, encoded);
192
+
193
+ return prefix + new Uint8Array(hash).toBase64({ alphabet });
194
+ }
195
+ }
196
+
197
+ static get SHA256() {
198
+ return SHA256;
199
+ }
200
+
201
+ static get SHA384() {
202
+ return SHA384;
203
+ }
204
+
205
+ static get SHA512() {
206
+ return SHA512;
207
+ }
208
+ }
209
+
210
+ const importmap = new Importmap({ imports: imports$1, scope: scope$1 });
211
+
212
+ var importmap$1 = /*#__PURE__*/Object.freeze({
213
+ __proto__: null,
214
+ Importmap: Importmap,
215
+ default: importmap,
216
+ importmap: importmap,
217
+ imports: imports$1,
218
+ scope: scope$1
219
+ });
220
+
143
221
  const UNPKG = 'https://unpkg.com/';
144
222
 
145
223
  const cache = new Map();
@@ -265,7 +343,7 @@ var unpkg = /*#__PURE__*/Object.freeze({
265
343
  updateYAML: updateYAML
266
344
  });
267
345
 
268
- const { imports, scope } = importmap;
346
+ const { imports, scope } = importmap$1;
269
347
  const ENCODING = 'utf8';
270
348
 
271
349
  function mergeWithImportmap({ imports = {}, scope = {}}) {
@@ -302,7 +380,7 @@ exports.ENCODING = ENCODING;
302
380
  exports.createImportmapJSON = createImportmapJSON;
303
381
  exports.getImportmapIntegrity = getImportmapIntegrity;
304
382
  exports.getImportmapScript = getImportmapScript;
305
- exports.importmap = importmap;
383
+ exports.importmap = importmap$1;
306
384
  exports.imports = imports;
307
385
  exports.mergeWithImportmap = mergeWithImportmap;
308
386
  exports.scope = scope;
package/index.js CHANGED
@@ -4,7 +4,8 @@ import { readYAMLFile, writeYAMLFile } from '@shgysk8zer0/npm-utils/yaml.js';
4
4
  import { readJSONFile, writeJSONFile } from '@shgysk8zer0/npm-utils/json.js';
5
5
  import { getFileURL } from '@shgysk8zer0/npm-utils/path.js';
6
6
 
7
- const imports$1 = {
7
+ const imports$2 = {
8
+ "@node/": "/node_modules/",
8
9
  "@shgysk8zer0/kazoo/": "https://unpkg.com/@shgysk8zer0/kazoo@1.0.10/",
9
10
  "@shgysk8zer0/konami": "https://unpkg.com/@shgysk8zer0/konami@1.1.1/konami.js",
10
11
  "@shgysk8zer0/polyfills": "https://unpkg.com/@shgysk8zer0/polyfills@0.5.1/browser.min.js",
@@ -43,15 +44,15 @@ const imports$1 = {
43
44
  "@aegisjsproject/aegis-md/": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/",
44
45
  "@aegisjsproject/url": "https://unpkg.com/@aegisjsproject/url@1.0.3/url.mjs",
45
46
  "@aegisjsproject/url/": "https://unpkg.com/@aegisjsproject/url@1.0.3/",
46
- "@aegisjsproject/idb/": "https://unpkg.com/@aegisjsproject/idb@1.0.4/",
47
- "@aegisjsproject/idb": "https://unpkg.com/@aegisjsproject/idb@1.0.4/idb.min.js",
47
+ "@aegisjsproject/idb/": "https://unpkg.com/@aegisjsproject/idb@1.0.5/",
48
+ "@aegisjsproject/idb": "https://unpkg.com/@aegisjsproject/idb@1.0.5/idb.min.js",
48
49
  "@aegisjsproject/otp/": "https://unpkg.com/@aegisjsproject/otp@1.0.1/",
49
50
  "@aegisjsproject/otp": "https://unpkg.com/@aegisjsproject/otp@1.0.1/otp.min.js",
50
51
  "@aegisjsproject/md-editor": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/md-editor.js",
51
52
  "@aegisjsproject/md-editor/": "https://unpkg.com/@aegisjsproject/md-editor@1.0.0/",
52
53
  "@aegisjsproject/barcodescanner": "https://unpkg.com/@aegisjsproject/barcodescanner@1.1.3/scanner.min.js",
53
54
  "@aegisjsproject/barcodescanner/": "https://unpkg.com/@aegisjsproject/barcodescanner@1.1.3/",
54
- "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.19/",
55
+ "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.20/",
55
56
  "@aegisjsproject/state": "https://unpkg.com/@aegisjsproject/state@1.0.7/state.mjs",
56
57
  "@aegisjsproject/state/": "https://unpkg.com/@aegisjsproject/state@1.0.7/",
57
58
  "@aegisjsproject/router": "https://unpkg.com/@aegisjsproject/router@1.1.11/router.mjs",
@@ -66,7 +67,7 @@ const imports$1 = {
66
67
  "@aegisjsproject/firebase-account-routes": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.5/main.js",
67
68
  "@aegisjsproject/firebase-account-routes/": "https://unpkg.com/@aegisjsproject/firebase-account-routes@0.0.5/",
68
69
  "@aegisjsproject/secret-store/": "https://unpkg.com/@aegisjsproject/secret-store@1.0.1/",
69
- "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.6/",
70
+ "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.9/",
70
71
  "@webcomponents/custom-elements": "https://unpkg.com/@webcomponents/custom-elements@1.6.0/custom-elements.min.js",
71
72
  leaflet: "https://unpkg.com/leaflet@1.9.4/dist/leaflet-src.esm.js",
72
73
  "leaflet/": "https://unpkg.com/leaflet@1.9.4/dist/",
@@ -75,10 +76,10 @@ const imports$1 = {
75
76
  "highlight.js/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",
76
77
  "@highlightjs/cdn-assets": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/core.min.js",
77
78
  "@highlightjs/cdn-assets/": "https://unpkg.com/@highlightjs/cdn-assets@11.11.1/es/",
78
- marked: "https://unpkg.com/marked@17.0.0/lib/marked.esm.js",
79
+ marked: "https://unpkg.com/marked@17.0.1/lib/marked.esm.js",
79
80
  "marked-highlight": "https://unpkg.com/marked-highlight@2.2.3/src/index.js",
80
- yaml: "https://unpkg.com/yaml@2.8.1/browser/dist/index.js",
81
- "yaml/": "https://unpkg.com/yaml@2.8.1/browser/dist/",
81
+ yaml: "https://unpkg.com/yaml@2.8.2/browser/dist/index.js",
82
+ "yaml/": "https://unpkg.com/yaml@2.8.2/browser/dist/",
82
83
  "firebase/": "https://www.gstatic.com/firebasejs/10.12.1/",
83
84
  "firebase/app": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app.js",
84
85
  "firebase/app-check": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app-check.js",
@@ -92,16 +93,16 @@ const imports$1 = {
92
93
  "firebase/storage": "https://www.gstatic.com/firebasejs/10.12.1/firebase-storage.js",
93
94
  "firebase/analytics": "https://www.gstatic.com/firebasejs/10.12.1/firebase-analytics.js"
94
95
  };
95
- const scope$1 = {
96
+ const scope$2 = {
97
+ };
98
+ var json = {
99
+ imports: imports$2,
100
+ scope: scope$2
96
101
  };
97
102
 
98
- var importmap = /*#__PURE__*/Object.freeze({
99
- __proto__: null,
100
- imports: imports$1,
101
- scope: scope$1
102
- });
103
-
103
+ const SHA256 = 'SHA-256';
104
104
  const SHA384 = 'SHA-384';
105
+ const SHA512 = 'SHA-512';
105
106
  const DEFAULT_ALGO = SHA384;
106
107
 
107
108
  const BASE64 = 'base64';
@@ -138,6 +139,83 @@ async function hash(data, { algo = DEFAULT_ALGO, output = BUFFER } = {}) {
138
139
 
139
140
  const sri = async(data, { algo = SHA384 } = {}) => hash(data, { algo, output: SRI });
140
141
 
142
+ const { imports: imports$1, scope: scope$1 } = json;
143
+
144
+ class Importmap {
145
+ #imports = {};
146
+ #scope = {};
147
+
148
+ constructor({ imports: i = imports$1, scope: s = scope$1 } = {}) {
149
+ this.#imports = i;
150
+ this.#scope = s;
151
+ }
152
+
153
+ delete(key) {
154
+ return Reflect.deleteProperty(this.#imports, key);
155
+ }
156
+
157
+ get(key) {
158
+ return Reflect.get(this.#imports, key);
159
+ }
160
+
161
+ has(key) {
162
+ return Reflect.has(this.#imports, key);
163
+ }
164
+
165
+ set(key, newValue) {
166
+ return Reflect.set(this.#imports, key, newValue);
167
+ }
168
+
169
+ toJSON() {
170
+ return { imports: this.#imports, scope: this.#scope };
171
+ }
172
+
173
+ toString() {
174
+ return JSON.stringify(this);
175
+ }
176
+
177
+ async getScript({ algo = DEFAULT_ALGO, alphabet = BASE64, signal } = {}) {
178
+ const integrity = await this.getIntegrity({ algo, alphabet, signal });
179
+
180
+ return `<script type="importmap" integrity="${integrity}">${JSON.stringify(this)}</script>`;
181
+ }
182
+
183
+ async getIntegrity({ algo = DEFAULT_ALGO, alphabet = BASE64, signal } = {}) {
184
+ if (signal instanceof AbortSignal && signal.aborted) {
185
+ throw signal.reason;
186
+ } else {
187
+ const prefix = algo.toLowerCase().replace('-', '') + '-';
188
+ const encoded = new TextEncoder().encode(this);
189
+ const hash = await crypto.subtle.digest(algo, encoded);
190
+
191
+ return prefix + new Uint8Array(hash).toBase64({ alphabet });
192
+ }
193
+ }
194
+
195
+ static get SHA256() {
196
+ return SHA256;
197
+ }
198
+
199
+ static get SHA384() {
200
+ return SHA384;
201
+ }
202
+
203
+ static get SHA512() {
204
+ return SHA512;
205
+ }
206
+ }
207
+
208
+ const importmap = new Importmap({ imports: imports$1, scope: scope$1 });
209
+
210
+ var importmap$1 = /*#__PURE__*/Object.freeze({
211
+ __proto__: null,
212
+ Importmap: Importmap,
213
+ default: importmap,
214
+ importmap: importmap,
215
+ imports: imports$1,
216
+ scope: scope$1
217
+ });
218
+
141
219
  const UNPKG = 'https://unpkg.com/';
142
220
 
143
221
  const cache = new Map();
@@ -263,7 +341,7 @@ var unpkg = /*#__PURE__*/Object.freeze({
263
341
  updateYAML: updateYAML
264
342
  });
265
343
 
266
- const { imports, scope } = importmap;
344
+ const { imports, scope } = importmap$1;
267
345
  const ENCODING = 'utf8';
268
346
 
269
347
  function mergeWithImportmap({ imports = {}, scope = {}}) {
@@ -296,4 +374,4 @@ async function getImportmapScript({
296
374
  return `<script type="importmap" integrity="${integrity}">${JSON.stringify(importmap)}</script>`;
297
375
  }
298
376
 
299
- export { ENCODING, createImportmapJSON, getImportmapIntegrity, getImportmapScript, importmap, imports, mergeWithImportmap, scope, unpkg };
377
+ export { ENCODING, createImportmapJSON, getImportmapIntegrity, getImportmapScript, importmap$1 as importmap, imports, mergeWithImportmap, scope, unpkg };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shgysk8zer0/importmap",
3
- "version": "1.4.87",
3
+ "version": "1.5.0",
4
4
  "engines": {
5
5
  "node": ">=18.0.0"
6
6
  },
@@ -68,7 +68,7 @@
68
68
  },
69
69
  "dependencies": {
70
70
  "@shgysk8zer0/npm-utils": "^1.1.3",
71
- "@shgysk8zer0/polyfills": "^0.5.0",
71
+ "@shgysk8zer0/polyfills": "^0.5.1",
72
72
  "commander": "^14.0.2"
73
73
  }
74
74
  }