@kamen/create-webapp 1.0.24 → 1.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +23 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -177,6 +177,29 @@ export function createResourceIframe(code, container = document.body) {
|
|
|
177
177
|
return createResourceTag(code, 'iframe', 'src', 'text/html', container);
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
+
/**
|
|
181
|
+
* @param {string} [module='axios']
|
|
182
|
+
* @returns {Promise}
|
|
183
|
+
*/
|
|
184
|
+
export function npmModule(module = 'axios') {
|
|
185
|
+
const cdns = [
|
|
186
|
+
`https://esm.sh/${module}`,
|
|
187
|
+
`https://esm.run/${module}`,
|
|
188
|
+
`https://jspm.dev/${module}`,
|
|
189
|
+
`https://unpkg.com/${module}?module`,
|
|
190
|
+
`https://cdn.skypack.dev/${module}`
|
|
191
|
+
];
|
|
192
|
+
return Promise.any(cdns.map(cdn => import(cdn)));
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* @param {string[]} [modules=[]]
|
|
197
|
+
* @returns {Promise}
|
|
198
|
+
*/
|
|
199
|
+
export function npmModules(modules = []) {
|
|
200
|
+
return Promise.allSettled(modules.map(npmModule));
|
|
201
|
+
}
|
|
202
|
+
|
|
180
203
|
/**
|
|
181
204
|
* @param {number} [version=2]
|
|
182
205
|
* @param {Node} [root=document]
|