snipe/web/node_modules/@iconify/utils/lib/loader/external-pkg.js
pyr0ball 7a704441a6 feat(snipe): Vue 3 frontend scaffold + Docker web service
- web/: Vue 3 + Vite + UnoCSS + Pinia, dark tactical theme (amber/#0d1117)
- AppNav, ListingCard, SearchView with filters/sort, composables
  (useSnipeMode, useKonamiCode, useMotion), Pinia search store
- Steal shimmer, auction countdown, Snipe Mode easter egg all native in Vue
- docker/web/: nginx + multi-stage Dockerfile (node build → nginx serve)
- compose.yml: api (8510) + web (8509) services
- Dockerfile CMD updated to uvicorn for upcoming FastAPI layer
- Clean build: 0 TS errors, 380 modules
2026-03-25 15:11:35 -07:00

45 lines
No EOL
1.5 KiB
JavaScript

import { getPossibleIconNames } from "./utils.js";
import { searchForIcon } from "./modern.js";
import { warnOnce } from "./warn.js";
import { loadCollectionFromFS } from "./fs.js";
/**
* Creates a CustomIconLoader collection from an external package collection.
*
* @param packageName The package name.
* @param autoInstall {AutoInstall} [autoInstall=false] - whether to automatically install
*/
function createExternalPackageIconLoader(packageName, autoInstall = false, cwd) {
let scope;
let collection;
const collections = {};
if (typeof packageName === "string") {
if (packageName.length === 0) {
warnOnce(`invalid package name, it is empty`);
return collections;
}
if (packageName[0] === "@") {
if (packageName.indexOf("/") === -1) {
warnOnce(`invalid scoped package name "${packageName}"`);
return collections;
}
[scope, collection] = packageName.split("/");
} else {
scope = "";
collection = packageName;
}
} else [scope, collection] = packageName;
collections[collection] = createCustomIconLoader(scope, collection, autoInstall, cwd);
return collections;
}
function createCustomIconLoader(scope, collection, autoInstall, cwd) {
const iconSetPromise = loadCollectionFromFS(collection, autoInstall, scope, cwd);
return (async (icon) => {
const iconSet = await iconSetPromise;
let result;
if (iconSet) result = await searchForIcon(iconSet, collection, getPossibleIconNames(icon));
return result;
});
}
export { createExternalPackageIconLoader };