@shgysk8zer0/importmap 1.4.8 → 1.4.9

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
@@ -1,3 +1,4 @@
1
+ <!-- markdownlint-disable -->
1
2
  # Changelog
2
3
  All notable changes to this project will be documented in this file.
3
4
 
@@ -6,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
7
 
7
8
  ## [Unreleased]
8
9
 
10
+ ## [v1.4.9] - 2024-09-20
11
+
12
+ ### Changed
13
+ - Update dependencies and config
14
+
9
15
  ## [v1.4.8] - 2024-09-19
10
16
 
11
17
  ### Changed
package/cli.cjs ADDED
@@ -0,0 +1,151 @@
1
+ 'use strict';
2
+
3
+ var json_js = require('@shgysk8zer0/npm-utils/json.js');
4
+ var yaml_js = require('@shgysk8zer0/npm-utils/yaml.js');
5
+ var commander = require('commander');
6
+ var node_path = require('node:path');
7
+ require('node:fs/promises');
8
+ require('@shgysk8zer0/npm-utils/path.js');
9
+
10
+ const imports = {
11
+ "@shgysk8zer0/kazoo/": "https://unpkg.com/@shgysk8zer0/kazoo@1.0.9/",
12
+ "@shgysk8zer0/konami": "https://unpkg.com/@shgysk8zer0/konami@1.1.1/konami.js",
13
+ "@shgysk8zer0/polyfills": "https://unpkg.com/@shgysk8zer0/polyfills@0.4.3/all.min.js",
14
+ "@shgysk8zer0/polyfills/": "https://unpkg.com/@shgysk8zer0/polyfills@0.4.3/",
15
+ "@shgysk8zer0/jwk-utils": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.0.15/jwk-utils.min.js",
16
+ "@shgysk8zer0/jwk-utils/": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.0.15/",
17
+ "@shgysk8zer0/jswaggersheets": "https://unpkg.com/@shgysk8zer0/jswaggersheets@1.1.0/swagger.js",
18
+ "@shgysk8zer0/jswaggersheets/": "https://unpkg.com/@shgysk8zer0/jswaggersheets@1.1.0/",
19
+ "@shgysk8zer0/jss/": "https://unpkg.com/@shgysk8zer0/jss@1.0.1/",
20
+ "@shgysk8zer0/consts/": "https://unpkg.com/@shgysk8zer0/consts@1.0.8/",
21
+ "@shgysk8zer0/http/": "https://unpkg.com/@shgysk8zer0/http@1.0.5/",
22
+ "@shgysk8zer0/http-status": "https://unpkg.com/@shgysk8zer0/http-status@1.1.1/http-status.js",
23
+ "@aegisjsproject/trusted-types": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.2/bundle.min.js",
24
+ "@aegisjsproject/trusted-types/": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.2/",
25
+ "@aegisjsproject/parsers": "https://unpkg.com/@aegisjsproject/parsers@0.0.9/bundle.min.js",
26
+ "@aegisjsproject/parsers/": "https://unpkg.com/@aegisjsproject/parsers@0.0.9/",
27
+ "@aegisjsproject/sanitizer": "https://unpkg.com/@aegisjsproject/sanitizer@0.1.1/sanitizer.js",
28
+ "@aegisjsproject/sanitizer/": "https://unpkg.com/@aegisjsproject/sanitizer@0.1.1/",
29
+ "@aegisjsproject/core": "https://unpkg.com/@aegisjsproject/core@0.2.14/core.js",
30
+ "@aegisjsproject/core/": "https://unpkg.com/@aegisjsproject/core@0.2.14/",
31
+ "@aegisjsproject/styles": "https://unpkg.com/@aegisjsproject/styles@0.1.2/styles.js",
32
+ "@aegisjsproject/styles/": "https://unpkg.com/@aegisjsproject/styles@0.1.2/",
33
+ "@aegisjsproject/component": "https://unpkg.com/@aegisjsproject/component@0.1.3/component.js",
34
+ "@aegisjsproject/component/": "https://unpkg.com/@aegisjsproject/component@0.1.3/",
35
+ "@aegisjsproject/markdown": "https://unpkg.com/@aegisjsproject/markdown@0.1.3/markdown.js",
36
+ "@aegisjsproject/markdown/": "https://unpkg.com/@aegisjsproject/markdown@0.1.3/",
37
+ "@aegisjsproject/aegis-md": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/aegis-md.js",
38
+ "@aegisjsproject/aegis-md/": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/",
39
+ "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.13/",
40
+ "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.5/",
41
+ "@webcomponents/custom-elements": "https://unpkg.com/@webcomponents/custom-elements@1.6.0/custom-elements.min.js",
42
+ leaflet: "https://unpkg.com/leaflet@1.9.4/dist/leaflet-src.esm.js",
43
+ "urlpattern-polyfill": "https://unpkg.com/urlpattern-polyfill@10.0.0/index.js",
44
+ "highlight.js": "https://unpkg.com/@highlightjs/cdn-assets@11.10.0/es/core.min.js",
45
+ "highlight.js/": "https://unpkg.com/@highlightjs/cdn-assets@11.10.0/es/",
46
+ "@highlightjs/cdn-assets": "https://unpkg.com/@highlightjs/cdn-assets@11.10.0/es/core.min.js",
47
+ "@highlightjs/cdn-assets/": "https://unpkg.com/@highlightjs/cdn-assets@11.10.0/es/",
48
+ marked: "https://unpkg.com/marked@14.1.2/lib/marked.esm.js",
49
+ "marked-highlight": "https://unpkg.com/marked-highlight@2.1.4/src/index.js",
50
+ yaml: "https://unpkg.com/yaml@2.5.1/browser/dist/index.js",
51
+ "yaml/": "https://unpkg.com/yaml@2.5.1/browser/dist/",
52
+ "firebase/": "https://www.gstatic.com/firebasejs/10.12.1/",
53
+ "firebase/app": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app.js",
54
+ "firebase/app-check": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app-check.js",
55
+ "firebase/auth": "https://www.gstatic.com/firebasejs/10.12.1/firebase-auth.js",
56
+ "firebase/database": "https://www.gstatic.com/firebasejs/10.12.1/firebase-database.js",
57
+ "firebase/firestore": "https://www.gstatic.com/firebasejs/10.12.1/firebase-firestore.js",
58
+ "firebase/functions": "https://www.gstatic.com/firebasejs/10.12.1/firebase-functions.js",
59
+ "firebase/messaging": "https://www.gstatic.com/firebasejs/10.12.1/firebase-messaging.js",
60
+ "firebase/performance": "https://www.gstatic.com/firebasejs/10.12.1/firebase-performance.js",
61
+ "firebase/remote-config": "https://www.gstatic.com/firebasejs/10.12.1/firebase-remote-config.js",
62
+ "firebase/storage": "https://www.gstatic.com/firebasejs/10.12.1/firebase-storage.js",
63
+ "firebase/analytics": "https://www.gstatic.com/firebasejs/10.12.1/firebase-analytics.js"
64
+ };
65
+ const scope = {
66
+ };
67
+
68
+ var importmap = /*#__PURE__*/Object.freeze({
69
+ __proto__: null,
70
+ imports: imports,
71
+ scope: scope
72
+ });
73
+
74
+ /* eslint-env node */
75
+
76
+ // import { updateImportMap } from './html.js';
77
+
78
+ function guessFileType(file) {
79
+ const ext = node_path.extname(file).toLowerCase();
80
+
81
+ switch(ext) {
82
+ case '.yml':
83
+ case '.yaml':
84
+ return 'yaml';
85
+
86
+ case '.json':
87
+ return 'json';
88
+
89
+ case '.html':
90
+ return 'html';
91
+
92
+ default:
93
+ throw new TypeError(`"${ext}" is not a supported file extension for file ${file}.`);
94
+ }
95
+ }
96
+
97
+ async function parse(file, { encoding, signal } = {}) {
98
+ switch(guessFileType(file)) {
99
+ case 'yaml':
100
+ return yaml_js.readYAMLFile(file, { encoding, signal });
101
+
102
+ case 'json':
103
+ return json_js.readJSONFile(file, { encoding, signal });
104
+
105
+ }
106
+ }
107
+
108
+ async function init() {
109
+ const { version: VERSION } = await json_js.readJSONFile(new URL('./package.json', (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('cli.cjs', document.baseURI).href))));
110
+
111
+ commander.program
112
+ .name('importmap-utils')
113
+ .version(VERSION)
114
+ .description('CLI utility for updating importmap files')
115
+ .option('-i, --input [input]', 'local JSON or YAML importmap file')
116
+ .option('-e, --encoding [encoding]', 'encoding', 'utf8')
117
+ .option('-f, --format [format]', 'output format') // Migrate opt
118
+ .option('-o, --output <output>', 'output file')
119
+ .parse(process.argv);
120
+
121
+ return {
122
+ args: commander.program.args,
123
+ opts: commander.program.opts(),
124
+ };
125
+ }
126
+
127
+ init().then(async ({ opts: { input, encoding, format, output }}) => {
128
+ const mod = typeof input === 'string'
129
+ ? await parse(input, { encoding }).then(({ imports: imports$1, scope: scope$1 = {}, ...rest }) => ({
130
+ ...rest,
131
+ imports: { ...imports$1, ...imports },
132
+ scope: { ...scope$1, ...scope },
133
+ }))
134
+ : importmap;
135
+
136
+ console.log(mod);
137
+
138
+ switch(format ?? guessFileType(output)) {
139
+ case 'json':
140
+ await json_js.writeJSONFile(output, mod, { encoding });
141
+ break;
142
+
143
+ case 'yaml':
144
+ await yaml_js.writeYAMLFile(output, mod, { encoding });
145
+ break;
146
+
147
+ // case 'html':
148
+ // await updateImportMap(output, { spaces: null });
149
+ // break;
150
+ }
151
+ });
package/cli.js ADDED
@@ -0,0 +1,149 @@
1
+ import { writeJSONFile, readJSONFile } from '@shgysk8zer0/npm-utils/json.js';
2
+ import { writeYAMLFile, readYAMLFile } from '@shgysk8zer0/npm-utils/yaml.js';
3
+ import { program } from 'commander';
4
+ import { extname } from 'node:path';
5
+ import 'node:fs/promises';
6
+ import '@shgysk8zer0/npm-utils/path.js';
7
+
8
+ const imports = {
9
+ "@shgysk8zer0/kazoo/": "https://unpkg.com/@shgysk8zer0/kazoo@1.0.9/",
10
+ "@shgysk8zer0/konami": "https://unpkg.com/@shgysk8zer0/konami@1.1.1/konami.js",
11
+ "@shgysk8zer0/polyfills": "https://unpkg.com/@shgysk8zer0/polyfills@0.4.3/all.min.js",
12
+ "@shgysk8zer0/polyfills/": "https://unpkg.com/@shgysk8zer0/polyfills@0.4.3/",
13
+ "@shgysk8zer0/jwk-utils": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.0.15/jwk-utils.min.js",
14
+ "@shgysk8zer0/jwk-utils/": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.0.15/",
15
+ "@shgysk8zer0/jswaggersheets": "https://unpkg.com/@shgysk8zer0/jswaggersheets@1.1.0/swagger.js",
16
+ "@shgysk8zer0/jswaggersheets/": "https://unpkg.com/@shgysk8zer0/jswaggersheets@1.1.0/",
17
+ "@shgysk8zer0/jss/": "https://unpkg.com/@shgysk8zer0/jss@1.0.1/",
18
+ "@shgysk8zer0/consts/": "https://unpkg.com/@shgysk8zer0/consts@1.0.8/",
19
+ "@shgysk8zer0/http/": "https://unpkg.com/@shgysk8zer0/http@1.0.5/",
20
+ "@shgysk8zer0/http-status": "https://unpkg.com/@shgysk8zer0/http-status@1.1.1/http-status.js",
21
+ "@aegisjsproject/trusted-types": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.2/bundle.min.js",
22
+ "@aegisjsproject/trusted-types/": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.2/",
23
+ "@aegisjsproject/parsers": "https://unpkg.com/@aegisjsproject/parsers@0.0.9/bundle.min.js",
24
+ "@aegisjsproject/parsers/": "https://unpkg.com/@aegisjsproject/parsers@0.0.9/",
25
+ "@aegisjsproject/sanitizer": "https://unpkg.com/@aegisjsproject/sanitizer@0.1.1/sanitizer.js",
26
+ "@aegisjsproject/sanitizer/": "https://unpkg.com/@aegisjsproject/sanitizer@0.1.1/",
27
+ "@aegisjsproject/core": "https://unpkg.com/@aegisjsproject/core@0.2.14/core.js",
28
+ "@aegisjsproject/core/": "https://unpkg.com/@aegisjsproject/core@0.2.14/",
29
+ "@aegisjsproject/styles": "https://unpkg.com/@aegisjsproject/styles@0.1.2/styles.js",
30
+ "@aegisjsproject/styles/": "https://unpkg.com/@aegisjsproject/styles@0.1.2/",
31
+ "@aegisjsproject/component": "https://unpkg.com/@aegisjsproject/component@0.1.3/component.js",
32
+ "@aegisjsproject/component/": "https://unpkg.com/@aegisjsproject/component@0.1.3/",
33
+ "@aegisjsproject/markdown": "https://unpkg.com/@aegisjsproject/markdown@0.1.3/markdown.js",
34
+ "@aegisjsproject/markdown/": "https://unpkg.com/@aegisjsproject/markdown@0.1.3/",
35
+ "@aegisjsproject/aegis-md": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/aegis-md.js",
36
+ "@aegisjsproject/aegis-md/": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/",
37
+ "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.13/",
38
+ "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.5/",
39
+ "@webcomponents/custom-elements": "https://unpkg.com/@webcomponents/custom-elements@1.6.0/custom-elements.min.js",
40
+ leaflet: "https://unpkg.com/leaflet@1.9.4/dist/leaflet-src.esm.js",
41
+ "urlpattern-polyfill": "https://unpkg.com/urlpattern-polyfill@10.0.0/index.js",
42
+ "highlight.js": "https://unpkg.com/@highlightjs/cdn-assets@11.10.0/es/core.min.js",
43
+ "highlight.js/": "https://unpkg.com/@highlightjs/cdn-assets@11.10.0/es/",
44
+ "@highlightjs/cdn-assets": "https://unpkg.com/@highlightjs/cdn-assets@11.10.0/es/core.min.js",
45
+ "@highlightjs/cdn-assets/": "https://unpkg.com/@highlightjs/cdn-assets@11.10.0/es/",
46
+ marked: "https://unpkg.com/marked@14.1.2/lib/marked.esm.js",
47
+ "marked-highlight": "https://unpkg.com/marked-highlight@2.1.4/src/index.js",
48
+ yaml: "https://unpkg.com/yaml@2.5.1/browser/dist/index.js",
49
+ "yaml/": "https://unpkg.com/yaml@2.5.1/browser/dist/",
50
+ "firebase/": "https://www.gstatic.com/firebasejs/10.12.1/",
51
+ "firebase/app": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app.js",
52
+ "firebase/app-check": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app-check.js",
53
+ "firebase/auth": "https://www.gstatic.com/firebasejs/10.12.1/firebase-auth.js",
54
+ "firebase/database": "https://www.gstatic.com/firebasejs/10.12.1/firebase-database.js",
55
+ "firebase/firestore": "https://www.gstatic.com/firebasejs/10.12.1/firebase-firestore.js",
56
+ "firebase/functions": "https://www.gstatic.com/firebasejs/10.12.1/firebase-functions.js",
57
+ "firebase/messaging": "https://www.gstatic.com/firebasejs/10.12.1/firebase-messaging.js",
58
+ "firebase/performance": "https://www.gstatic.com/firebasejs/10.12.1/firebase-performance.js",
59
+ "firebase/remote-config": "https://www.gstatic.com/firebasejs/10.12.1/firebase-remote-config.js",
60
+ "firebase/storage": "https://www.gstatic.com/firebasejs/10.12.1/firebase-storage.js",
61
+ "firebase/analytics": "https://www.gstatic.com/firebasejs/10.12.1/firebase-analytics.js"
62
+ };
63
+ const scope = {
64
+ };
65
+
66
+ var importmap = /*#__PURE__*/Object.freeze({
67
+ __proto__: null,
68
+ imports: imports,
69
+ scope: scope
70
+ });
71
+
72
+ /* eslint-env node */
73
+
74
+ // import { updateImportMap } from './html.js';
75
+
76
+ function guessFileType(file) {
77
+ const ext = extname(file).toLowerCase();
78
+
79
+ switch(ext) {
80
+ case '.yml':
81
+ case '.yaml':
82
+ return 'yaml';
83
+
84
+ case '.json':
85
+ return 'json';
86
+
87
+ case '.html':
88
+ return 'html';
89
+
90
+ default:
91
+ throw new TypeError(`"${ext}" is not a supported file extension for file ${file}.`);
92
+ }
93
+ }
94
+
95
+ async function parse(file, { encoding, signal } = {}) {
96
+ switch(guessFileType(file)) {
97
+ case 'yaml':
98
+ return readYAMLFile(file, { encoding, signal });
99
+
100
+ case 'json':
101
+ return readJSONFile(file, { encoding, signal });
102
+
103
+ }
104
+ }
105
+
106
+ async function init() {
107
+ const { version: VERSION } = await readJSONFile(new URL('./package.json', import.meta.url));
108
+
109
+ program
110
+ .name('importmap-utils')
111
+ .version(VERSION)
112
+ .description('CLI utility for updating importmap files')
113
+ .option('-i, --input [input]', 'local JSON or YAML importmap file')
114
+ .option('-e, --encoding [encoding]', 'encoding', 'utf8')
115
+ .option('-f, --format [format]', 'output format') // Migrate opt
116
+ .option('-o, --output <output>', 'output file')
117
+ .parse(process.argv);
118
+
119
+ return {
120
+ args: program.args,
121
+ opts: program.opts(),
122
+ };
123
+ }
124
+
125
+ init().then(async ({ opts: { input, encoding, format, output }}) => {
126
+ const mod = typeof input === 'string'
127
+ ? await parse(input, { encoding }).then(({ imports: imports$1, scope: scope$1 = {}, ...rest }) => ({
128
+ ...rest,
129
+ imports: { ...imports$1, ...imports },
130
+ scope: { ...scope$1, ...scope },
131
+ }))
132
+ : importmap;
133
+
134
+ console.log(mod);
135
+
136
+ switch(format ?? guessFileType(output)) {
137
+ case 'json':
138
+ await writeJSONFile(output, mod, { encoding });
139
+ break;
140
+
141
+ case 'yaml':
142
+ await writeYAMLFile(output, mod, { encoding });
143
+ break;
144
+
145
+ // case 'html':
146
+ // await updateImportMap(output, { spaces: null });
147
+ // break;
148
+ }
149
+ });
package/cli.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  /* eslint-env node */
3
3
 
4
- import { readJSONFile, writeJSONFile } from '@shgysk8zer0/npm-utils/json';
5
- import { readYAMLFile, writeYAMLFile } from '@shgysk8zer0/npm-utils/yaml';
4
+ import { readJSONFile, writeJSONFile } from '@shgysk8zer0/npm-utils/json.js';
5
+ import { readYAMLFile, writeYAMLFile } from '@shgysk8zer0/npm-utils/yaml.js';
6
6
  import { program } from 'commander';
7
7
  import { extname } from 'node:path';
8
8
  import { importmap } from './index.mjs';
9
- import { updateImportMap } from './html.js';
9
+ // import { updateImportMap } from './html.js';
10
10
 
11
11
  function guessFileType(file) {
12
12
  const ext = extname(file).toLowerCase();
@@ -77,8 +77,8 @@ init().then(async ({ opts: { input, encoding, format, output }}) => {
77
77
  await writeYAMLFile(output, mod, { encoding });
78
78
  break;
79
79
 
80
- case 'html':
81
- await updateImportMap(output, { spaces: null });
82
- break;
80
+ // case 'html':
81
+ // await updateImportMap(output, { spaces: null });
82
+ // break;
83
83
  }
84
84
  });
package/importmap.cjs ADDED
@@ -0,0 +1,62 @@
1
+ 'use strict';
2
+
3
+ const imports = {
4
+ "@shgysk8zer0/kazoo/": "https://unpkg.com/@shgysk8zer0/kazoo@1.0.9/",
5
+ "@shgysk8zer0/konami": "https://unpkg.com/@shgysk8zer0/konami@1.1.1/konami.js",
6
+ "@shgysk8zer0/polyfills": "https://unpkg.com/@shgysk8zer0/polyfills@0.4.3/all.min.js",
7
+ "@shgysk8zer0/polyfills/": "https://unpkg.com/@shgysk8zer0/polyfills@0.4.3/",
8
+ "@shgysk8zer0/jwk-utils": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.0.15/jwk-utils.min.js",
9
+ "@shgysk8zer0/jwk-utils/": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.0.15/",
10
+ "@shgysk8zer0/jswaggersheets": "https://unpkg.com/@shgysk8zer0/jswaggersheets@1.1.0/swagger.js",
11
+ "@shgysk8zer0/jswaggersheets/": "https://unpkg.com/@shgysk8zer0/jswaggersheets@1.1.0/",
12
+ "@shgysk8zer0/jss/": "https://unpkg.com/@shgysk8zer0/jss@1.0.1/",
13
+ "@shgysk8zer0/consts/": "https://unpkg.com/@shgysk8zer0/consts@1.0.8/",
14
+ "@shgysk8zer0/http/": "https://unpkg.com/@shgysk8zer0/http@1.0.5/",
15
+ "@shgysk8zer0/http-status": "https://unpkg.com/@shgysk8zer0/http-status@1.1.1/http-status.js",
16
+ "@aegisjsproject/trusted-types": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.2/bundle.min.js",
17
+ "@aegisjsproject/trusted-types/": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.2/",
18
+ "@aegisjsproject/parsers": "https://unpkg.com/@aegisjsproject/parsers@0.0.9/bundle.min.js",
19
+ "@aegisjsproject/parsers/": "https://unpkg.com/@aegisjsproject/parsers@0.0.9/",
20
+ "@aegisjsproject/sanitizer": "https://unpkg.com/@aegisjsproject/sanitizer@0.1.1/sanitizer.js",
21
+ "@aegisjsproject/sanitizer/": "https://unpkg.com/@aegisjsproject/sanitizer@0.1.1/",
22
+ "@aegisjsproject/core": "https://unpkg.com/@aegisjsproject/core@0.2.14/core.js",
23
+ "@aegisjsproject/core/": "https://unpkg.com/@aegisjsproject/core@0.2.14/",
24
+ "@aegisjsproject/styles": "https://unpkg.com/@aegisjsproject/styles@0.1.2/styles.js",
25
+ "@aegisjsproject/styles/": "https://unpkg.com/@aegisjsproject/styles@0.1.2/",
26
+ "@aegisjsproject/component": "https://unpkg.com/@aegisjsproject/component@0.1.3/component.js",
27
+ "@aegisjsproject/component/": "https://unpkg.com/@aegisjsproject/component@0.1.3/",
28
+ "@aegisjsproject/markdown": "https://unpkg.com/@aegisjsproject/markdown@0.1.3/markdown.js",
29
+ "@aegisjsproject/markdown/": "https://unpkg.com/@aegisjsproject/markdown@0.1.3/",
30
+ "@aegisjsproject/aegis-md": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/aegis-md.js",
31
+ "@aegisjsproject/aegis-md/": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/",
32
+ "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.13/",
33
+ "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.5/",
34
+ "@webcomponents/custom-elements": "https://unpkg.com/@webcomponents/custom-elements@1.6.0/custom-elements.min.js",
35
+ leaflet: "https://unpkg.com/leaflet@1.9.4/dist/leaflet-src.esm.js",
36
+ "urlpattern-polyfill": "https://unpkg.com/urlpattern-polyfill@10.0.0/index.js",
37
+ "highlight.js": "https://unpkg.com/@highlightjs/cdn-assets@11.10.0/es/core.min.js",
38
+ "highlight.js/": "https://unpkg.com/@highlightjs/cdn-assets@11.10.0/es/",
39
+ "@highlightjs/cdn-assets": "https://unpkg.com/@highlightjs/cdn-assets@11.10.0/es/core.min.js",
40
+ "@highlightjs/cdn-assets/": "https://unpkg.com/@highlightjs/cdn-assets@11.10.0/es/",
41
+ marked: "https://unpkg.com/marked@14.1.2/lib/marked.esm.js",
42
+ "marked-highlight": "https://unpkg.com/marked-highlight@2.1.4/src/index.js",
43
+ yaml: "https://unpkg.com/yaml@2.5.1/browser/dist/index.js",
44
+ "yaml/": "https://unpkg.com/yaml@2.5.1/browser/dist/",
45
+ "firebase/": "https://www.gstatic.com/firebasejs/10.12.1/",
46
+ "firebase/app": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app.js",
47
+ "firebase/app-check": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app-check.js",
48
+ "firebase/auth": "https://www.gstatic.com/firebasejs/10.12.1/firebase-auth.js",
49
+ "firebase/database": "https://www.gstatic.com/firebasejs/10.12.1/firebase-database.js",
50
+ "firebase/firestore": "https://www.gstatic.com/firebasejs/10.12.1/firebase-firestore.js",
51
+ "firebase/functions": "https://www.gstatic.com/firebasejs/10.12.1/firebase-functions.js",
52
+ "firebase/messaging": "https://www.gstatic.com/firebasejs/10.12.1/firebase-messaging.js",
53
+ "firebase/performance": "https://www.gstatic.com/firebasejs/10.12.1/firebase-performance.js",
54
+ "firebase/remote-config": "https://www.gstatic.com/firebasejs/10.12.1/firebase-remote-config.js",
55
+ "firebase/storage": "https://www.gstatic.com/firebasejs/10.12.1/firebase-storage.js",
56
+ "firebase/analytics": "https://www.gstatic.com/firebasejs/10.12.1/firebase-analytics.js"
57
+ };
58
+ const scope = {
59
+ };
60
+
61
+ exports.imports = imports;
62
+ exports.scope = scope;
package/importmap.js ADDED
@@ -0,0 +1,59 @@
1
+ const imports = {
2
+ "@shgysk8zer0/kazoo/": "https://unpkg.com/@shgysk8zer0/kazoo@1.0.9/",
3
+ "@shgysk8zer0/konami": "https://unpkg.com/@shgysk8zer0/konami@1.1.1/konami.js",
4
+ "@shgysk8zer0/polyfills": "https://unpkg.com/@shgysk8zer0/polyfills@0.4.3/all.min.js",
5
+ "@shgysk8zer0/polyfills/": "https://unpkg.com/@shgysk8zer0/polyfills@0.4.3/",
6
+ "@shgysk8zer0/jwk-utils": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.0.15/jwk-utils.min.js",
7
+ "@shgysk8zer0/jwk-utils/": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.0.15/",
8
+ "@shgysk8zer0/jswaggersheets": "https://unpkg.com/@shgysk8zer0/jswaggersheets@1.1.0/swagger.js",
9
+ "@shgysk8zer0/jswaggersheets/": "https://unpkg.com/@shgysk8zer0/jswaggersheets@1.1.0/",
10
+ "@shgysk8zer0/jss/": "https://unpkg.com/@shgysk8zer0/jss@1.0.1/",
11
+ "@shgysk8zer0/consts/": "https://unpkg.com/@shgysk8zer0/consts@1.0.8/",
12
+ "@shgysk8zer0/http/": "https://unpkg.com/@shgysk8zer0/http@1.0.5/",
13
+ "@shgysk8zer0/http-status": "https://unpkg.com/@shgysk8zer0/http-status@1.1.1/http-status.js",
14
+ "@aegisjsproject/trusted-types": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.2/bundle.min.js",
15
+ "@aegisjsproject/trusted-types/": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.2/",
16
+ "@aegisjsproject/parsers": "https://unpkg.com/@aegisjsproject/parsers@0.0.9/bundle.min.js",
17
+ "@aegisjsproject/parsers/": "https://unpkg.com/@aegisjsproject/parsers@0.0.9/",
18
+ "@aegisjsproject/sanitizer": "https://unpkg.com/@aegisjsproject/sanitizer@0.1.1/sanitizer.js",
19
+ "@aegisjsproject/sanitizer/": "https://unpkg.com/@aegisjsproject/sanitizer@0.1.1/",
20
+ "@aegisjsproject/core": "https://unpkg.com/@aegisjsproject/core@0.2.14/core.js",
21
+ "@aegisjsproject/core/": "https://unpkg.com/@aegisjsproject/core@0.2.14/",
22
+ "@aegisjsproject/styles": "https://unpkg.com/@aegisjsproject/styles@0.1.2/styles.js",
23
+ "@aegisjsproject/styles/": "https://unpkg.com/@aegisjsproject/styles@0.1.2/",
24
+ "@aegisjsproject/component": "https://unpkg.com/@aegisjsproject/component@0.1.3/component.js",
25
+ "@aegisjsproject/component/": "https://unpkg.com/@aegisjsproject/component@0.1.3/",
26
+ "@aegisjsproject/markdown": "https://unpkg.com/@aegisjsproject/markdown@0.1.3/markdown.js",
27
+ "@aegisjsproject/markdown/": "https://unpkg.com/@aegisjsproject/markdown@0.1.3/",
28
+ "@aegisjsproject/aegis-md": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/aegis-md.js",
29
+ "@aegisjsproject/aegis-md/": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/",
30
+ "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.13/",
31
+ "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.5/",
32
+ "@webcomponents/custom-elements": "https://unpkg.com/@webcomponents/custom-elements@1.6.0/custom-elements.min.js",
33
+ leaflet: "https://unpkg.com/leaflet@1.9.4/dist/leaflet-src.esm.js",
34
+ "urlpattern-polyfill": "https://unpkg.com/urlpattern-polyfill@10.0.0/index.js",
35
+ "highlight.js": "https://unpkg.com/@highlightjs/cdn-assets@11.10.0/es/core.min.js",
36
+ "highlight.js/": "https://unpkg.com/@highlightjs/cdn-assets@11.10.0/es/",
37
+ "@highlightjs/cdn-assets": "https://unpkg.com/@highlightjs/cdn-assets@11.10.0/es/core.min.js",
38
+ "@highlightjs/cdn-assets/": "https://unpkg.com/@highlightjs/cdn-assets@11.10.0/es/",
39
+ marked: "https://unpkg.com/marked@14.1.2/lib/marked.esm.js",
40
+ "marked-highlight": "https://unpkg.com/marked-highlight@2.1.4/src/index.js",
41
+ yaml: "https://unpkg.com/yaml@2.5.1/browser/dist/index.js",
42
+ "yaml/": "https://unpkg.com/yaml@2.5.1/browser/dist/",
43
+ "firebase/": "https://www.gstatic.com/firebasejs/10.12.1/",
44
+ "firebase/app": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app.js",
45
+ "firebase/app-check": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app-check.js",
46
+ "firebase/auth": "https://www.gstatic.com/firebasejs/10.12.1/firebase-auth.js",
47
+ "firebase/database": "https://www.gstatic.com/firebasejs/10.12.1/firebase-database.js",
48
+ "firebase/firestore": "https://www.gstatic.com/firebasejs/10.12.1/firebase-firestore.js",
49
+ "firebase/functions": "https://www.gstatic.com/firebasejs/10.12.1/firebase-functions.js",
50
+ "firebase/messaging": "https://www.gstatic.com/firebasejs/10.12.1/firebase-messaging.js",
51
+ "firebase/performance": "https://www.gstatic.com/firebasejs/10.12.1/firebase-performance.js",
52
+ "firebase/remote-config": "https://www.gstatic.com/firebasejs/10.12.1/firebase-remote-config.js",
53
+ "firebase/storage": "https://www.gstatic.com/firebasejs/10.12.1/firebase-storage.js",
54
+ "firebase/analytics": "https://www.gstatic.com/firebasejs/10.12.1/firebase-analytics.js"
55
+ };
56
+ const scope = {
57
+ };
58
+
59
+ export { imports, scope };
package/importmap.mjs ADDED
@@ -0,0 +1 @@
1
+ export * from './importmap.json' with { type: 'json' };
package/index.cjs CHANGED
@@ -62,10 +62,12 @@ const imports$1 = {
62
62
  };
63
63
  const scope$1 = {
64
64
  };
65
- var importmap = {
66
- imports: imports$1,
67
- scope: scope$1
68
- };
65
+
66
+ var importmap = /*#__PURE__*/Object.freeze({
67
+ __proto__: null,
68
+ imports: imports$1,
69
+ scope: scope$1
70
+ });
69
71
 
70
72
  const SHA384 = 'SHA-384';
71
73
  const DEFAULT_ALGO = SHA384;
@@ -236,8 +238,8 @@ const ENCODING = 'utf8';
236
238
 
237
239
  function mergeWithImportmap({ imports = {}, scope = {}}) {
238
240
  return {
239
- imports: { ...importmap.imports, ...imports },
240
- scope: { ...importmap.scope, ...scope },
241
+ imports: { ...imports$1, ...imports },
242
+ scope: { ...scope$1, ...scope },
241
243
  };
242
244
  }
243
245
 
package/index.mjs CHANGED
@@ -1,245 +1,20 @@
1
1
  import { writeFile } from 'node:fs/promises';
2
- import { readYAMLFile, writeYAMLFile } from '@shgysk8zer0/npm-utils/yaml.js';
3
- import { readJSONFile, writeJSONFile } from '@shgysk8zer0/npm-utils/json.js';
4
- import { getFileURL } from '@shgysk8zer0/npm-utils/path.js';
2
+ import * as importmap from './importmap.mjs';
3
+ import { sri, DEFAULT_ALGO } from './hash.js';
5
4
 
6
- const imports$1 = {
7
- "@shgysk8zer0/kazoo/": "https://unpkg.com/@shgysk8zer0/kazoo@1.0.9/",
8
- "@shgysk8zer0/konami": "https://unpkg.com/@shgysk8zer0/konami@1.1.1/konami.js",
9
- "@shgysk8zer0/polyfills": "https://unpkg.com/@shgysk8zer0/polyfills@0.4.3/all.min.js",
10
- "@shgysk8zer0/polyfills/": "https://unpkg.com/@shgysk8zer0/polyfills@0.4.3/",
11
- "@shgysk8zer0/jwk-utils": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.0.15/jwk-utils.min.js",
12
- "@shgysk8zer0/jwk-utils/": "https://unpkg.com/@shgysk8zer0/jwk-utils@1.0.15/",
13
- "@shgysk8zer0/jswaggersheets": "https://unpkg.com/@shgysk8zer0/jswaggersheets@1.1.0/swagger.js",
14
- "@shgysk8zer0/jswaggersheets/": "https://unpkg.com/@shgysk8zer0/jswaggersheets@1.1.0/",
15
- "@shgysk8zer0/jss/": "https://unpkg.com/@shgysk8zer0/jss@1.0.1/",
16
- "@shgysk8zer0/consts/": "https://unpkg.com/@shgysk8zer0/consts@1.0.8/",
17
- "@shgysk8zer0/http/": "https://unpkg.com/@shgysk8zer0/http@1.0.5/",
18
- "@shgysk8zer0/http-status": "https://unpkg.com/@shgysk8zer0/http-status@1.1.1/http-status.js",
19
- "@aegisjsproject/trusted-types": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.2/bundle.min.js",
20
- "@aegisjsproject/trusted-types/": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.2/",
21
- "@aegisjsproject/parsers": "https://unpkg.com/@aegisjsproject/parsers@0.0.9/bundle.min.js",
22
- "@aegisjsproject/parsers/": "https://unpkg.com/@aegisjsproject/parsers@0.0.9/",
23
- "@aegisjsproject/sanitizer": "https://unpkg.com/@aegisjsproject/sanitizer@0.1.1/sanitizer.js",
24
- "@aegisjsproject/sanitizer/": "https://unpkg.com/@aegisjsproject/sanitizer@0.1.1/",
25
- "@aegisjsproject/core": "https://unpkg.com/@aegisjsproject/core@0.2.14/core.js",
26
- "@aegisjsproject/core/": "https://unpkg.com/@aegisjsproject/core@0.2.14/",
27
- "@aegisjsproject/styles": "https://unpkg.com/@aegisjsproject/styles@0.1.2/styles.js",
28
- "@aegisjsproject/styles/": "https://unpkg.com/@aegisjsproject/styles@0.1.2/",
29
- "@aegisjsproject/component": "https://unpkg.com/@aegisjsproject/component@0.1.3/component.js",
30
- "@aegisjsproject/component/": "https://unpkg.com/@aegisjsproject/component@0.1.3/",
31
- "@aegisjsproject/markdown": "https://unpkg.com/@aegisjsproject/markdown@0.1.3/markdown.js",
32
- "@aegisjsproject/markdown/": "https://unpkg.com/@aegisjsproject/markdown@0.1.3/",
33
- "@aegisjsproject/aegis-md": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/aegis-md.js",
34
- "@aegisjsproject/aegis-md/": "https://unpkg.com/@aegisjsproject/aegis-md@0.0.4/",
35
- "@shgysk8zer0/components/": "https://unpkg.com/@shgysk8zer0/components@0.3.13/",
36
- "@kernvalley/components/": "https://unpkg.com/@kernvalley/components@2.0.5/",
37
- "@webcomponents/custom-elements": "https://unpkg.com/@webcomponents/custom-elements@1.6.0/custom-elements.min.js",
38
- leaflet: "https://unpkg.com/leaflet@1.9.4/dist/leaflet-src.esm.js",
39
- "urlpattern-polyfill": "https://unpkg.com/urlpattern-polyfill@10.0.0/index.js",
40
- "highlight.js": "https://unpkg.com/@highlightjs/cdn-assets@11.10.0/es/core.min.js",
41
- "highlight.js/": "https://unpkg.com/@highlightjs/cdn-assets@11.10.0/es/",
42
- "@highlightjs/cdn-assets": "https://unpkg.com/@highlightjs/cdn-assets@11.10.0/es/core.min.js",
43
- "@highlightjs/cdn-assets/": "https://unpkg.com/@highlightjs/cdn-assets@11.10.0/es/",
44
- marked: "https://unpkg.com/marked@14.1.2/lib/marked.esm.js",
45
- "marked-highlight": "https://unpkg.com/marked-highlight@2.1.4/src/index.js",
46
- yaml: "https://unpkg.com/yaml@2.5.1/browser/dist/index.js",
47
- "yaml/": "https://unpkg.com/yaml@2.5.1/browser/dist/",
48
- "firebase/": "https://www.gstatic.com/firebasejs/10.12.1/",
49
- "firebase/app": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app.js",
50
- "firebase/app-check": "https://www.gstatic.com/firebasejs/10.12.1/firebase-app-check.js",
51
- "firebase/auth": "https://www.gstatic.com/firebasejs/10.12.1/firebase-auth.js",
52
- "firebase/database": "https://www.gstatic.com/firebasejs/10.12.1/firebase-database.js",
53
- "firebase/firestore": "https://www.gstatic.com/firebasejs/10.12.1/firebase-firestore.js",
54
- "firebase/functions": "https://www.gstatic.com/firebasejs/10.12.1/firebase-functions.js",
55
- "firebase/messaging": "https://www.gstatic.com/firebasejs/10.12.1/firebase-messaging.js",
56
- "firebase/performance": "https://www.gstatic.com/firebasejs/10.12.1/firebase-performance.js",
57
- "firebase/remote-config": "https://www.gstatic.com/firebasejs/10.12.1/firebase-remote-config.js",
58
- "firebase/storage": "https://www.gstatic.com/firebasejs/10.12.1/firebase-storage.js",
59
- "firebase/analytics": "https://www.gstatic.com/firebasejs/10.12.1/firebase-analytics.js"
60
- };
61
- const scope$1 = {
62
- };
63
- var importmap = {
64
- imports: imports$1,
65
- scope: scope$1
66
- };
5
+ export const { imports, scope } = importmap;
6
+ export const ENCODING = 'utf8';
7
+ export { importmap };
8
+ export * as unpkg from './unpkg.js';
67
9
 
68
- const SHA384 = 'SHA-384';
69
- const DEFAULT_ALGO = SHA384;
70
-
71
- const BASE64 = 'base64';
72
- const SRI = 'sri';
73
- const HEX = 'hex';
74
- const BUFFER = 'buffer';
75
-
76
- async function hash(data, { algo = DEFAULT_ALGO, output = BUFFER } = {}) {
77
- const buffer = await new TextEncoder().encode(data);
78
- const hash = await crypto.subtle.digest(algo, buffer);
79
-
80
- switch (output) {
81
- case BUFFER:
82
- return hash;
83
-
84
- case HEX:
85
- return Array.from(
86
- new Uint8Array(hash),
87
- byte => byte.toString(16).padStart(2, '0')
88
- ).join('');
89
-
90
- case BASE64:
91
- return btoa(hash);
92
-
93
- case SRI: {
94
- const codeUnits = new Uint16Array(hash);
95
- const charCodes = new Uint8Array(codeUnits.buffer);
96
- const result = btoa(String.fromCharCode(...charCodes));
97
- return `${algo.replace('-', '').toLowerCase()}-${result}`;
98
- }
99
-
100
- default:
101
- throw new TypeError(`Unsupported output type: "${output}".`);
102
- }
103
- }
104
-
105
- const sri = async(data, { algo = SHA384 } = {}) => hash(data, { algo, output: SRI });
106
-
107
- const UNPKG = 'https://unpkg.com/';
108
-
109
- const cache = new Map();
110
-
111
- function parseUnpkgURL(src) {
112
- const url = new URL(src, UNPKG);
113
-
114
- if (! url.hostname === UNPKG || url.pathname.length === 1 || url.pathname === '/[object%20Object]') {
115
- throw new Error(`${src} is not an unpkg URL.`);
116
- } else {
117
- const path = url.pathname.substr(1).split('/');
118
-
119
- if (path.length === 0) {
120
- throw new Error(`Invalid unpkg URL: ${src}`);
121
- } else if (path.length !== 1 && path[0].startsWith('@')) {
122
- const [pkg, version = null] = path[1].split('@');
123
- return { scope: path[0], pkg, version, module: path.splice(2).join('/') };
124
- } else {
125
- const [pkg, version = null] = path[0].split('@');
126
- return { scope: null, pkg, version, module: path.splice(1).join('/') };
127
- }
128
- }
129
- }
130
-
131
- function getUnpkgURL({ scope, pkg, version, module = '' }) {
132
- // console.log({ scope, pkg, version });
133
- if (typeof pkg !== 'string' || pkg.length === 0) {
134
- throw new TypeError('Package name must be a non-empty string.');
135
- } else if (typeof version !== 'string' || version.length === 0) {
136
- throw new TypeError('Version must be a non-empty string.');
137
- } else if (typeof scope === 'string' && scope.length !== 0) {
138
- return new URL(`/${scope}/${pkg}@${version}/${module}`, UNPKG).href;
139
- } else {
140
- return new URL(`/${pkg}@${version}/${module}`, UNPKG).href;
141
- }
142
- }
143
-
144
- async function getLatestVersion({ scope, pkg, signal } = {}) {
145
- const path = typeof scope === 'string' ? `/${scope}/${pkg}/` : `/${pkg}/`;
146
-
147
- if (cache.has(path)) {
148
- return await cache.get(path);
149
- } else {
150
- const url = new URL(path, 'https://unpkg.com/');
151
- url.searchParams.set('meta', '');
152
-
153
- const promise = fetch(url, { method: 'HEAD', signal }).then(resp => {
154
- const { version } = parseUnpkgURL(resp.url);
155
- return version;
156
- });
157
-
158
- cache.set(path, promise);
159
- return promise;
160
- }
161
- }
162
-
163
- async function update(imports) {
164
- let updated = false;
165
-
166
- const entries = await Promise.all(Object.entries(imports)
167
- .filter(([,val]) => val.startsWith(UNPKG))
168
- .map(async ([key, val]) => {
169
- const { scope, pkg, version: oldVersion, module } = parseUnpkgURL(val);
170
- const version = await getLatestVersion({ scope, pkg });
171
-
172
- if (! updated && version > oldVersion) {
173
- updated = true;
174
- }
175
-
176
- return [key, getUnpkgURL({ scope, pkg, version, module })];
177
- })
178
- );
179
-
180
- return { imports: Object.fromEntries(entries), updated };
181
- }
182
-
183
- async function updateUnpkg(imports) {
184
- return update(imports);
185
- }
186
-
187
- async function updateYAML(file) {
188
- if (typeof file === 'string') {
189
- return await updateJSON(getFileURL(file));
190
- } else if (file instanceof URL && file.protocol === 'file:') {
191
- const importmap = await readYAMLFile(file);
192
- const { updated, imports } = await update(importmap.imports);
193
-
194
- if (updated) {
195
- await writeYAMLFile(file, { ...importmap, imports: { ...importmap.imports, ...imports }});
196
- return true;
197
- } else {
198
- return false;
199
- }
200
- } else {
201
- throw new TypeError('File must be a path or file: URL.');
202
- }
203
-
204
- }
205
-
206
- async function updateJSON(file) {
207
- if (typeof file === 'string') {
208
- return await updateJSON(getFileURL(file));
209
- } else if (file instanceof URL && file.protocol === 'file:') {
210
- const importmap = await readJSONFile(file);
211
- const { updated, imports } = await update(importmap.imports);
212
-
213
- if (updated) {
214
- await writeJSONFile(file, { ...importmap, imports: { ...importmap.imports, ...imports }});
215
- return true;
216
- } else {
217
- return false;
218
- }
219
- } else {
220
- throw new TypeError('File must be a path or file: URL.');
221
- }
222
- }
223
-
224
- var unpkg = /*#__PURE__*/Object.freeze({
225
- __proto__: null,
226
- update: update,
227
- updateJSON: updateJSON,
228
- updateUnpkg: updateUnpkg,
229
- updateYAML: updateYAML
230
- });
231
-
232
- const { imports, scope } = importmap;
233
- const ENCODING = 'utf8';
234
-
235
- function mergeWithImportmap({ imports = {}, scope = {}}) {
10
+ export function mergeWithImportmap({ imports = {}, scope = {}}) {
236
11
  return {
237
12
  imports: { ...importmap.imports, ...imports },
238
13
  scope: { ...importmap.scope, ...scope },
239
14
  };
240
15
  }
241
16
 
242
- async function createImportmapJSON(path = 'importmap.json', {
17
+ export async function createImportmapJSON(path = 'importmap.json', {
243
18
  importmap = { imports, scope },
244
19
  spaces = 2,
245
20
  signal,
@@ -247,19 +22,17 @@ async function createImportmapJSON(path = 'importmap.json', {
247
22
  await writeFile(path, JSON.stringify(importmap, null, spaces), { encoding: ENCODING, signal });
248
23
  }
249
24
 
250
- async function getImportmapIntegrity({
25
+ export async function getImportmapIntegrity({
251
26
  importmap = { imports, scope },
252
27
  algo = DEFAULT_ALGO,
253
28
  } = {}) {
254
29
  return await sri(JSON.stringify(importmap), { algo });
255
30
  }
256
31
 
257
- async function getImportmapScript({
32
+ export async function getImportmapScript({
258
33
  importmap = { imports, scope },
259
34
  algo = DEFAULT_ALGO,
260
35
  } = {}) {
261
36
  const integrity = await getImportmapIntegrity({ importmap, algo });
262
37
  return `<script type="importmap" integrity="${integrity}">${JSON.stringify(importmap)}</script>`;
263
38
  }
264
-
265
- export { ENCODING, createImportmapJSON, getImportmapIntegrity, getImportmapScript, importmap, imports, mergeWithImportmap, scope, unpkg };
package/package.json CHANGED
@@ -1,31 +1,31 @@
1
1
  {
2
2
  "name": "@shgysk8zer0/importmap",
3
- "version": "1.4.8",
3
+ "version": "1.4.9",
4
4
  "engines": {
5
5
  "node": ">=18.0.0"
6
6
  },
7
7
  "description": "Front-End dependencies based on `<script type=\"importmap\">`",
8
8
  "type": "module",
9
- "module": "./index.mjs",
9
+ "module": "./index.js",
10
10
  "main": "./index.cjs",
11
- "unpkg": "./index.mjs",
11
+ "unpkg": "./index.js",
12
12
  "exports": {
13
13
  ".": {
14
- "import": "./index.mjs",
14
+ "import": "./index.js",
15
15
  "require": "./index.cjs"
16
16
  },
17
17
  "./*.js": {
18
- "import": "./*.mjs",
18
+ "import": "./*.js",
19
19
  "require": "./*.cjs"
20
20
  },
21
21
  "./*.mjs": {
22
- "import": "./*.mjs"
22
+ "import": "./*.js"
23
23
  },
24
24
  "./*.cjs": {
25
25
  "require": "./*.cjs"
26
26
  },
27
27
  "./*": {
28
- "import": "./*.mjs",
28
+ "import": "./*.js",
29
29
  "require": "./*.cjs"
30
30
  }
31
31
  },
@@ -33,11 +33,11 @@
33
33
  "importmap-utils": "./cli.mjs"
34
34
  },
35
35
  "scripts": {
36
- "test": "npm run lint:js && npm run build && npm run test:imports",
37
- "preversion": "npm test",
38
- "prepare": "npm run build",
36
+ "test": "npm run lint:js && npm run test:imports",
37
+ "preversion": "npm test && npm run build",
38
+ "prepare": "npm test && npm run build",
39
39
  "update": "node ./update.js",
40
- "lint:js": "eslint .",
40
+ "lint:js": "eslint . --ignore-pattern 'importmap.mjs'",
41
41
  "fix:js": "eslint . --fix",
42
42
  "build": "npm run build:js",
43
43
  "build:js": "rollup -c",
@@ -59,12 +59,10 @@
59
59
  },
60
60
  "homepage": "https://github.com/shgysk8zer0/importmap#readme",
61
61
  "devDependencies": {
62
- "@babel/eslint-parser": "^7.25.1",
63
- "@babel/eslint-plugin": "^7.25.1",
64
- "@babel/plugin-syntax-import-assertions": "^7.25.6",
65
62
  "@rollup/plugin-json": "^6.1.0",
66
- "@shgysk8zer0/js-utils": "^1.0.1",
67
- "@shgysk8zer0/rollup-import": "^1.2.2"
63
+ "@shgysk8zer0/eslint-config": "^1.0.1",
64
+ "@shgysk8zer0/js-utils": "^1.0.2",
65
+ "@shgysk8zer0/rollup-import": "^1.2.4"
68
66
  },
69
67
  "dependencies": {
70
68
  "@shgysk8zer0/npm-utils": "^1.1.3",