From a1a9a4d8393743579b4b4fc4d853106939d402ec Mon Sep 17 00:00:00 2001 From: Sukomal Dutta <100500478+Sukomal07@users.noreply.github.com> Date: Wed, 1 Nov 2023 20:23:17 +0530 Subject: [PATCH] fix export IconNode type (#1656) * fix export IconNode type * add Types exports --- packages/lucide/rollup.config.mjs | 8 ++++---- packages/lucide/src/lucide.ts | 15 +++++++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/packages/lucide/rollup.config.mjs b/packages/lucide/rollup.config.mjs index de4df672d..5d77520b8 100644 --- a/packages/lucide/rollup.config.mjs +++ b/packages/lucide/rollup.config.mjs @@ -52,11 +52,11 @@ const configs = bundles name: outputFileName, ...(preserveModules ? { - dir: `${outputDir}/${format}`, - } + dir: `${outputDir}/${format}`, + } : { - file: `${outputDir}/${format}/${outputFileName}${minify ? '.min' : ''}.js`, - }), + file: `${outputDir}/${format}/${outputFileName}${minify ? '.min' : ''}.js`, + }), format, sourcemap: true, preserveModules, diff --git a/packages/lucide/src/lucide.ts b/packages/lucide/src/lucide.ts index 43e4ec4af..922a77c81 100644 --- a/packages/lucide/src/lucide.ts +++ b/packages/lucide/src/lucide.ts @@ -8,7 +8,7 @@ import * as iconAndAliases from './iconsAndAliases'; const createIcons = ({ icons = {}, nameAttr = 'data-lucide', attrs = {} } = {}) => { if (!Object.values(icons).length) { throw new Error( - "Please provide an icons object.\nIf you want to use all the icons you can import it like:\n `import { createIcons, icons } from 'lucide';\nlucide.createIcons({icons});`", + "Please provide an icons object.\nIf you want to use all the icons you can import it like:\n `import { createIcons, icons } from 'lucide';\nlucide.createIcons({icons});`" ); } @@ -18,16 +18,18 @@ const createIcons = ({ icons = {}, nameAttr = 'data-lucide', attrs = {} } = {}) const elementsToReplace = document.querySelectorAll(`[${nameAttr}]`); Array.from(elementsToReplace).forEach((element) => - replaceElement(element, { nameAttr, icons, attrs }), + replaceElement(element, { nameAttr, icons, attrs }) ); /** @todo: remove this block in v1.0 */ if (nameAttr === 'data-lucide') { const deprecatedElements = document.querySelectorAll('[icon-name]'); if (deprecatedElements.length > 0) { - console.warn('[Lucide] Some icons were found with the now deprecated icon-name attribute. These will still be replaced for backwards compatibility, but will no longer be supported in v1.0 and you should switch to data-lucide'); + console.warn( + '[Lucide] Some icons were found with the now deprecated icon-name attribute. These will still be replaced for backwards compatibility, but will no longer be supported in v1.0 and you should switch to data-lucide' + ); Array.from(deprecatedElements).forEach((element) => - replaceElement(element, { nameAttr: 'icon-name', icons, attrs }), + replaceElement(element, { nameAttr: 'icon-name', icons, attrs }) ); } } @@ -45,3 +47,8 @@ export { default as createElement } from './createElement'; */ export { iconAndAliases as icons }; export * from './icons'; + +/* + Types exports. +*/ +export * from './types';