unplugin-icons
Advanced tools
Comparing version 0.11.4 to 0.12.0
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunkWYP7TNZUjs = require('./chunk-WYP7TNZU.js'); | ||
require('./chunk-6ORDXO2E.js'); | ||
require('./chunk-PZ3KAP26.js'); | ||
require('./chunk-6F4PWJZI.js'); | ||
require('./chunk-GMAU6NZD.js'); | ||
var _chunkAPGB4K3Qjs = require('./chunk-APGB4K3Q.js'); | ||
require('./chunk-KQK26EIK.js'); | ||
require('./chunk-GGNOJ77I.js'); | ||
require('./chunk-IZWKDL73.js'); | ||
exports.default = _chunkWYP7TNZUjs.src_default; | ||
exports.default = _chunkAPGB4K3Qjs.src_default; |
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunkPZ3KAP26js = require('./chunk-PZ3KAP26.js'); | ||
require('./chunk-GMAU6NZD.js'); | ||
var _chunkKQK26EIKjs = require('./chunk-KQK26EIK.js'); | ||
require('./chunk-IZWKDL73.js'); | ||
@@ -13,4 +13,4 @@ // src/loaders.ts | ||
`${dir}/${name}.svg`, | ||
`${dir}/${_chunkPZ3KAP26js.camelize.call(void 0, name)}.svg`, | ||
`${dir}/${_chunkPZ3KAP26js.pascalize.call(void 0, name)}.svg` | ||
`${dir}/${_chunkKQK26EIKjs.camelize.call(void 0, name)}.svg`, | ||
`${dir}/${_chunkKQK26EIKjs.pascalize.call(void 0, name)}.svg` | ||
]; | ||
@@ -17,0 +17,0 @@ for (const path of pathes) { |
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunkWYP7TNZUjs = require('./chunk-WYP7TNZU.js'); | ||
require('./chunk-6ORDXO2E.js'); | ||
require('./chunk-PZ3KAP26.js'); | ||
require('./chunk-6F4PWJZI.js'); | ||
require('./chunk-GMAU6NZD.js'); | ||
var _chunkAPGB4K3Qjs = require('./chunk-APGB4K3Q.js'); | ||
require('./chunk-KQK26EIK.js'); | ||
require('./chunk-GGNOJ77I.js'); | ||
require('./chunk-IZWKDL73.js'); | ||
@@ -13,7 +12,7 @@ // src/nuxt.ts | ||
config.plugins = config.plugins || []; | ||
config.plugins.unshift(_chunkWYP7TNZUjs.src_default.webpack(options)); | ||
config.plugins.unshift(_chunkAPGB4K3Qjs.src_default.webpack(options)); | ||
}); | ||
this.nuxt.hook("vite:extend", async (vite) => { | ||
vite.config.plugins = vite.config.plugins || []; | ||
vite.config.plugins.push(_chunkWYP7TNZUjs.src_default.vite(options)); | ||
vite.config.plugins.push(_chunkAPGB4K3Qjs.src_default.vite(options)); | ||
}); | ||
@@ -20,0 +19,0 @@ } |
@@ -1,12 +0,13 @@ | ||
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunk6ORDXO2Ejs = require('./chunk-6ORDXO2E.js'); | ||
var _chunkKQK26EIKjs = require('./chunk-KQK26EIK.js'); | ||
require('./chunk-IZWKDL73.js'); | ||
// src/resolver.ts | ||
var _utils = require('@antfu/utils'); | ||
var _chunkPZ3KAP26js = require('./chunk-PZ3KAP26.js'); | ||
require('./chunk-GMAU6NZD.js'); | ||
// src/core/collections.ts | ||
var collections = ["mdi", "mdi-light", "ic", "ph", "icon-park-outline", "icon-park", "uil", "bx", "ri", "la", "iconoir", "jam", "ion", "bi", "clarity", "carbon", "cil", "gg", "tabler", "teenyicons", "fa-solid", "fa-regular", "vaadin", "icomoon-free", "eva", "pixelarticons", "majesticons", "ci", "eos-icons", "dashicons", "entypo", "zondicons", "flat-color-icons", "octicon", "codicon", "ant-design", "lucide", "fe", "radix-icons", "line-md", "system-uicons", "akar-icons", "uiw", "uim", "uit", "uis", "gridicons", "mono-icons", "heroicons-outline", "heroicons-solid", "file-icons", "mi", "ps", "el", "foundation", "typcn", "subway", "raphael", "icons8", "wpf", "iwwa", "topcoat", "ei", "bytesize", "fluent", "grommet-icons", "pepicons", "maki", "oi", "et", "vscode-icons", "fontisto", "fa", "zmdi", "whh", "si-glyph", "ls", "simple-line-icons", "flat-ui", "vs", "websymbol", "il", "bpmn", "fontelico", "feather", "noto", "noto-v1", "twemoji", "openmoji", "emojione", "emojione-monotone", "emojione-v1", "fxemoji", "logos", "cib", "simple-icons", "fa-brands", "brandico", "entypo-social", "cryptocurrency", "gis", "map", "geo", "cif", "fad", "wi", "healthicons", "medical-icon"]; | ||
// src/resolver.ts | ||
var _utils = require('@antfu/utils'); | ||
var _json = require('@iconify/json'); var _json2 = _interopRequireDefault(_json); | ||
function ComponentsResolver(options = {}) { | ||
@@ -16,3 +17,3 @@ var _a; | ||
prefix: rawPrefix = (_a = options.componentPrefix) != null ? _a : "i", | ||
enabledCollections = Object.keys(_json2.default.collections()), | ||
enabledCollections = collections, | ||
alias = {}, | ||
@@ -22,5 +23,5 @@ customCollections = [], | ||
} = options; | ||
const prefix = rawPrefix ? `${_chunkPZ3KAP26js.camelToKebab.call(void 0, rawPrefix)}-` : ""; | ||
const prefix = rawPrefix ? `${_chunkKQK26EIKjs.camelToKebab.call(void 0, rawPrefix)}-` : ""; | ||
const ext = extension ? extension.startsWith(".") ? extension : `.${extension}` : ""; | ||
const collections = _utils.uniq.call(void 0, [ | ||
const collections2 = _utils.uniq.call(void 0, [ | ||
..._utils.toArray.call(void 0, enabledCollections), | ||
@@ -30,9 +31,9 @@ ..._utils.toArray.call(void 0, customCollections), | ||
]); | ||
collections.sort((a, b) => b.length - a.length); | ||
collections2.sort((a, b) => b.length - a.length); | ||
return (name) => { | ||
const kebab = _chunkPZ3KAP26js.camelToKebab.call(void 0, name); | ||
const kebab = _chunkKQK26EIKjs.camelToKebab.call(void 0, name); | ||
if (!kebab.startsWith(prefix)) | ||
return; | ||
const slice = kebab.slice(prefix.length); | ||
const collection = collections.find((i) => slice.startsWith(`${i}-`)) || collections.find((i) => slice.startsWith(i)); | ||
const collection = collections2.find((i) => slice.startsWith(`${i}-`)) || collections2.find((i) => slice.startsWith(i)); | ||
if (!collection) | ||
@@ -46,5 +47,4 @@ return; | ||
const resolvedCollection = alias[collection] || collection; | ||
if (!customCollections.includes(resolvedCollection) && !_chunk6ORDXO2Ejs.getBuiltinIcon.call(void 0, resolvedCollection, icon)) | ||
return; | ||
return `~icons/${resolvedCollection}/${icon}${ext}`; | ||
if (collections2.includes(resolvedCollection)) | ||
return `~icons/${resolvedCollection}/${icon}${ext}`; | ||
}; | ||
@@ -51,0 +51,0 @@ } |
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunkWYP7TNZUjs = require('./chunk-WYP7TNZU.js'); | ||
require('./chunk-6ORDXO2E.js'); | ||
require('./chunk-PZ3KAP26.js'); | ||
require('./chunk-6F4PWJZI.js'); | ||
require('./chunk-GMAU6NZD.js'); | ||
var _chunkAPGB4K3Qjs = require('./chunk-APGB4K3Q.js'); | ||
require('./chunk-KQK26EIK.js'); | ||
require('./chunk-GGNOJ77I.js'); | ||
require('./chunk-IZWKDL73.js'); | ||
// src/rollup.ts | ||
var rollup_default = _chunkWYP7TNZUjs.src_default.rollup; | ||
var rollup_default = _chunkAPGB4K3Qjs.src_default.rollup; | ||
@@ -12,0 +11,0 @@ |
@@ -29,2 +29,19 @@ import { Awaitable } from '@antfu/utils'; | ||
/** | ||
* Icon source for Iconify | ||
* | ||
* 'legacy' - @iconify/json package | ||
* 'modern' - @iconify-json/* packages for each icon set | ||
* 'auto' - auto detect | ||
* | ||
* @default 'auto' | ||
*/ | ||
iconSource?: 'legacy' | 'modern' | 'auto'; | ||
/** | ||
* Auto install icon sources package when the usages is detected | ||
* | ||
* @default false | ||
* @deprecated Experimentally, be careful | ||
*/ | ||
autoInstall?: boolean; | ||
/** | ||
* Compiler | ||
@@ -31,0 +48,0 @@ * |
@@ -1,2 +0,2 @@ | ||
"use strict";require('./chunk-6F4PWJZI.js'); | ||
require('./chunk-GMAU6NZD.js'); | ||
"use strict";require('./chunk-GGNOJ77I.js'); | ||
require('./chunk-IZWKDL73.js'); |
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunkWYP7TNZUjs = require('./chunk-WYP7TNZU.js'); | ||
require('./chunk-6ORDXO2E.js'); | ||
require('./chunk-PZ3KAP26.js'); | ||
require('./chunk-6F4PWJZI.js'); | ||
require('./chunk-GMAU6NZD.js'); | ||
var _chunkAPGB4K3Qjs = require('./chunk-APGB4K3Q.js'); | ||
require('./chunk-KQK26EIK.js'); | ||
require('./chunk-GGNOJ77I.js'); | ||
require('./chunk-IZWKDL73.js'); | ||
// src/vite.ts | ||
var vite_default = _chunkWYP7TNZUjs.src_default.vite; | ||
var vite_default = _chunkAPGB4K3Qjs.src_default.vite; | ||
@@ -12,0 +11,0 @@ |
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); | ||
var _chunkWYP7TNZUjs = require('./chunk-WYP7TNZU.js'); | ||
require('./chunk-6ORDXO2E.js'); | ||
require('./chunk-PZ3KAP26.js'); | ||
require('./chunk-6F4PWJZI.js'); | ||
require('./chunk-GMAU6NZD.js'); | ||
var _chunkAPGB4K3Qjs = require('./chunk-APGB4K3Q.js'); | ||
require('./chunk-KQK26EIK.js'); | ||
require('./chunk-GGNOJ77I.js'); | ||
require('./chunk-IZWKDL73.js'); | ||
// src/webpack.ts | ||
var webpack_default = _chunkWYP7TNZUjs.src_default.webpack; | ||
var webpack_default = _chunkAPGB4K3Qjs.src_default.webpack; | ||
@@ -12,0 +11,0 @@ |
{ | ||
"name": "unplugin-icons", | ||
"version": "0.11.4", | ||
"version": "0.12.0", | ||
"description": "Access thousands of icons as components on-demand universally", | ||
@@ -58,4 +58,4 @@ "homepage": "https://github.com/antfu/unplugin-icons", | ||
"scripts": { | ||
"build": "tsup src/*.ts --clean --format cjs,esm --dts --external vue && esno scripts/postbuild.ts", | ||
"dev": "tsup src/*.ts --clean --format cjs,esm --dts --watch src --external vue", | ||
"build": "tsup && esno scripts/postbuild.ts", | ||
"dev": "tsup --watch src", | ||
"example:build": "npm -C examples/vite-vue3 run build", | ||
@@ -68,20 +68,26 @@ "example:dev": "npm -C examples/vite-vue3 run dev", | ||
"dependencies": { | ||
"@antfu/install-pkg": "^0.0.0", | ||
"@antfu/utils": "^0.3.0", | ||
"@iconify/json-tools": "^1.0.10", | ||
"has-pkg": "^0.0.1", | ||
"unplugin": "^0.2.11" | ||
"@iconify/utils": "^1.0.10", | ||
"debug": "^4.3.2", | ||
"local-pkg": "^0.1.0", | ||
"unplugin": "^0.2.16" | ||
}, | ||
"devDependencies": { | ||
"@antfu/eslint-config": "^0.9.0", | ||
"@iconify/types": "^1.0.9", | ||
"@svgr/core": "^5.5.0", | ||
"@types/node": "^16.9.1", | ||
"@typescript-eslint/eslint-plugin": "^4.31.1", | ||
"@vue/compiler-sfc": "^3.2.11", | ||
"@types/debug": "^4.1.7", | ||
"@types/node": "^16.10.2", | ||
"@typescript-eslint/eslint-plugin": "^4.32.0", | ||
"@vue/compiler-sfc": "^3.2.19", | ||
"bumpp": "^7.1.1", | ||
"cross-env": "^7.0.3", | ||
"eslint": "^7.32.0", | ||
"esno": "^0.9.1", | ||
"rollup": "^2.56.3", | ||
"tsup": "^4.14.0", | ||
"esno": "^0.10.0", | ||
"rollup": "^2.58.0", | ||
"tsup": "^5.2.1", | ||
"typescript": "^4.4.3", | ||
"vite": "^2.5.7" | ||
"vite": "^2.6.2" | ||
}, | ||
@@ -96,2 +102,5 @@ "peerDependencies": { | ||
"peerDependenciesMeta": { | ||
"@iconify/json": { | ||
"optional": true | ||
}, | ||
"@svgr/core": { | ||
@@ -98,0 +107,0 @@ "optional": true |
@@ -7,3 +7,3 @@ # unplugin-icons | ||
###### Features | ||
### Features | ||
@@ -67,10 +67,46 @@ - ๐ Universal | ||
Install the plugin and peer dependency `@iconify/json` | ||
### Plugin | ||
```bash | ||
npm i -D unplugin-icons @iconify/json | ||
npm i -D unplugin-icons | ||
``` | ||
### Build Tools | ||
### Icons Data | ||
We use [Iconify](https://iconify.design/) as the icons data source (supports 100+ iconsets). | ||
You have two ways to install them: | ||
###### Full Collection | ||
```bash | ||
npm i -D @iconify/json | ||
``` | ||
`@iconify/json` (~120MB) includes all the iconsets from Iconify so you can install once and use any of them as you want (only the icons you actually use will be bundle into the production build). | ||
###### By Icon Set | ||
If you only want to use a few of the icon sets and don't want to download the entire collection, you can also install them individually with `@iconify-json/[collection-id]`. | ||
For example, to install [Material Design Icons](), you can do: | ||
```bash | ||
npm i -D @iconify-json/mdi | ||
``` | ||
To boost your workflow, it's also possible to let `unplugin-icons` handle that installation by enabling the `autoInstall` option. | ||
```ts | ||
Icons({ | ||
// expiremental | ||
autoInstall: true | ||
}) | ||
``` | ||
It will install the icon set when you import them. The right package manager will be auto-detected (`npm`, `yarn` or `pnpm`). | ||
## Configuration | ||
###### Build Tools | ||
<details> | ||
@@ -215,3 +251,3 @@ <summary>Vite</summary><br> | ||
### Frameworks | ||
###### Frameworks | ||
@@ -218,0 +254,0 @@ |
@@ -1,11 +0,7 @@ | ||
declare module 'virtual:icons/*' { | ||
import { SvelteComponentDev } from 'svelte/internal' | ||
const component: SvelteComponentDev | ||
export default component | ||
declare module "virtual:icons/*" { | ||
export { SvelteComponentDev as default } from "svelte/internal"; | ||
} | ||
declare module '~icons/*' { | ||
import { SvelteComponentDev } from 'svelte/internal' | ||
const component: SvelteComponentDev | ||
export default component | ||
declare module "~icons/*" { | ||
export { SvelteComponentDev as default } from "svelte/internal"; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
67377
1386
688
12
15
51
10
+ Added@antfu/install-pkg@^0.0.0
+ Added@iconify/utils@^1.0.10
+ Addeddebug@^4.3.2
+ Addedlocal-pkg@^0.1.0
+ Added@antfu/install-pkg@0.0.00.1.1(transitive)
+ Added@antfu/utils@0.5.2(transitive)
+ Added@iconify/types@1.1.0(transitive)
+ Added@iconify/utils@1.0.33(transitive)
+ Addedbuiltins@4.1.0(transitive)
+ Addedcross-spawn@7.0.3(transitive)
+ Addedexeca@5.1.1(transitive)
+ Addedfind-up@5.0.0(transitive)
+ Addedget-stream@6.0.1(transitive)
+ Addedhuman-signals@2.1.0(transitive)
+ Addedimport-meta-resolve@1.1.1(transitive)
+ Addedis-stream@2.0.1(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedkolorist@1.8.0(transitive)
+ Addedlocal-pkg@0.1.00.4.3(transitive)
+ Addedlocate-path@6.0.0(transitive)
+ Addedmerge-stream@2.0.0(transitive)
+ Addedmimic-fn@2.1.0(transitive)
+ Addedmlly@0.2.10(transitive)
+ Addednpm-run-path@4.0.1(transitive)
+ Addedonetime@5.1.2(transitive)
+ Addedp-limit@3.1.0(transitive)
+ Addedp-locate@5.0.0(transitive)
+ Addedpath-exists@4.0.0(transitive)
+ Addedpath-key@3.1.1(transitive)
+ Addedsemver@7.6.3(transitive)
+ Addedshebang-command@2.0.0(transitive)
+ Addedshebang-regex@3.0.0(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedstrip-final-newline@2.0.0(transitive)
+ Addedwhich@2.0.2(transitive)
+ Addedyocto-queue@0.1.0(transitive)
- Removedhas-pkg@^0.0.1
- Removedhas-pkg@0.0.1(transitive)
Updatedunplugin@^0.2.16