@shgysk8zer0/importmap 1.4.8 → 1.4.10
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 +11 -0
- package/cli.cjs +151 -0
- package/cli.js +149 -0
- package/cli.mjs +6 -6
- package/importmap.cjs +62 -0
- package/importmap.js +59 -0
- package/index.cjs +8 -6
- package/{index.mjs → index.js} +8 -6
- package/package.json +14 -16
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,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
7
|
|
|
7
8
|
## [Unreleased]
|
|
8
9
|
|
|
10
|
+
## [v1.4.10] - 20204-09-20
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Export the correct files
|
|
14
|
+
|
|
15
|
+
## [v1.4.9] - 2024-09-20
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- Update dependencies and config
|
|
19
|
+
|
|
9
20
|
## [v1.4.8] - 2024-09-19
|
|
10
21
|
|
|
11
22
|
### 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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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/index.cjs
CHANGED
|
@@ -62,10 +62,12 @@ const imports$1 = {
|
|
|
62
62
|
};
|
|
63
63
|
const scope$1 = {
|
|
64
64
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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: { ...
|
|
240
|
-
scope: { ...
|
|
241
|
+
imports: { ...imports$1, ...imports },
|
|
242
|
+
scope: { ...scope$1, ...scope },
|
|
241
243
|
};
|
|
242
244
|
}
|
|
243
245
|
|
package/{index.mjs → index.js}
RENAMED
|
@@ -60,10 +60,12 @@ const imports$1 = {
|
|
|
60
60
|
};
|
|
61
61
|
const scope$1 = {
|
|
62
62
|
};
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
|
|
64
|
+
var importmap = /*#__PURE__*/Object.freeze({
|
|
65
|
+
__proto__: null,
|
|
66
|
+
imports: imports$1,
|
|
67
|
+
scope: scope$1
|
|
68
|
+
});
|
|
67
69
|
|
|
68
70
|
const SHA384 = 'SHA-384';
|
|
69
71
|
const DEFAULT_ALGO = SHA384;
|
|
@@ -234,8 +236,8 @@ const ENCODING = 'utf8';
|
|
|
234
236
|
|
|
235
237
|
function mergeWithImportmap({ imports = {}, scope = {}}) {
|
|
236
238
|
return {
|
|
237
|
-
imports: { ...
|
|
238
|
-
scope: { ...
|
|
239
|
+
imports: { ...imports$1, ...imports },
|
|
240
|
+
scope: { ...scope$1, ...scope },
|
|
239
241
|
};
|
|
240
242
|
}
|
|
241
243
|
|
package/package.json
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shgysk8zer0/importmap",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.10",
|
|
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.
|
|
9
|
+
"module": "./index.js",
|
|
10
10
|
"main": "./index.cjs",
|
|
11
|
-
"unpkg": "./index.
|
|
11
|
+
"unpkg": "./index.js",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
|
-
"import": "./index.
|
|
14
|
+
"import": "./index.js",
|
|
15
15
|
"require": "./index.cjs"
|
|
16
16
|
},
|
|
17
17
|
"./*.js": {
|
|
18
|
-
"import": "./*.
|
|
18
|
+
"import": "./*.js",
|
|
19
19
|
"require": "./*.cjs"
|
|
20
20
|
},
|
|
21
21
|
"./*.mjs": {
|
|
22
|
-
"import": "./*.
|
|
22
|
+
"import": "./*.js"
|
|
23
23
|
},
|
|
24
24
|
"./*.cjs": {
|
|
25
25
|
"require": "./*.cjs"
|
|
26
26
|
},
|
|
27
27
|
"./*": {
|
|
28
|
-
"import": "./*.
|
|
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
|
|
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/
|
|
67
|
-
"@shgysk8zer0/
|
|
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",
|