diff --git a/.github/workflows/lucide-astro.yml b/.github/workflows/lucide-astro.yml index 47a1fc8dd..6da4b03eb 100644 --- a/.github/workflows/lucide-astro.yml +++ b/.github/workflows/lucide-astro.yml @@ -46,3 +46,19 @@ jobs: - name: Test run: pnpm --filter @lucide/astro test + + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10 + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + node-version-file: 'package.json' + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Typecheck + run: pnpm --filter @lucide/astro typecheck diff --git a/.github/workflows/lucide-font.yml b/.github/workflows/lucide-font.yml index 7548723cb..2709fed13 100644 --- a/.github/workflows/lucide-font.yml +++ b/.github/workflows/lucide-font.yml @@ -37,3 +37,19 @@ jobs: with: name: lucide-font path: lucide-font + + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10 + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + cache: 'pnpm' + node-version-file: 'package.json' + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Typecheck + run: pnpm --filter build-font typecheck diff --git a/.github/workflows/lucide-lab.yml b/.github/workflows/lucide-lab.yml index 67c7e7e20..1afd71f0d 100644 --- a/.github/workflows/lucide-lab.yml +++ b/.github/workflows/lucide-lab.yml @@ -29,3 +29,19 @@ jobs: - name: Build run: pnpm --filter @lucide/lab build + + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10 + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + cache: 'pnpm' + node-version-file: 'package.json' + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Typecheck + run: pnpm --filter @lucide/lab typecheck diff --git a/.github/workflows/lucide-preact.yml b/.github/workflows/lucide-preact.yml index f842c1b47..926d4f0aa 100644 --- a/.github/workflows/lucide-preact.yml +++ b/.github/workflows/lucide-preact.yml @@ -31,3 +31,19 @@ jobs: - name: Test run: pnpm --filter lucide-preact test + + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10 + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + cache: 'pnpm' + node-version-file: 'package.json' + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Typecheck + run: pnpm --filter lucide-preact typecheck diff --git a/.github/workflows/lucide-react-native.yml b/.github/workflows/lucide-react-native.yml index 6f8d83079..1f0d67255 100644 --- a/.github/workflows/lucide-react-native.yml +++ b/.github/workflows/lucide-react-native.yml @@ -47,3 +47,19 @@ jobs: - name: Test run: pnpm --filter lucide-react-native test + + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10 + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + cache: 'pnpm' + node-version-file: 'package.json' + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Typecheck + run: pnpm --filter lucide-react-native typecheck diff --git a/.github/workflows/lucide-react.yml b/.github/workflows/lucide-react.yml index 3e8676365..5a81ab25a 100644 --- a/.github/workflows/lucide-react.yml +++ b/.github/workflows/lucide-react.yml @@ -70,3 +70,19 @@ jobs: - name: Run integration checks run: pnpm test:integrations:react + + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10 + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + cache: 'pnpm' + node-version-file: 'package.json' + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Typecheck + run: pnpm --filter lucide-react typecheck diff --git a/.github/workflows/lucide-shared.yml b/.github/workflows/lucide-shared.yml index efea0dc77..c367600d2 100644 --- a/.github/workflows/lucide-shared.yml +++ b/.github/workflows/lucide-shared.yml @@ -27,4 +27,20 @@ jobs: run: pnpm install --frozen-lockfile - name: Test - run: pnpm --filter lucide-react test + run: pnpm --filter @lucide/shared test + + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10 + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + cache: 'pnpm' + node-version-file: 'package.json' + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Typecheck + run: pnpm --filter @lucide/shared typecheck diff --git a/.github/workflows/lucide-solid.yml b/.github/workflows/lucide-solid.yml index d78602a35..f2e4895b1 100644 --- a/.github/workflows/lucide-solid.yml +++ b/.github/workflows/lucide-solid.yml @@ -47,3 +47,19 @@ jobs: - name: Test run: pnpm --filter lucide-solid test + + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10 + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + cache: 'pnpm' + node-version-file: 'package.json' + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Typecheck + run: pnpm --filter lucide-solid typecheck diff --git a/.github/workflows/lucide-static.yml b/.github/workflows/lucide-static.yml index fee24bf72..ec9b5e674 100644 --- a/.github/workflows/lucide-static.yml +++ b/.github/workflows/lucide-static.yml @@ -26,3 +26,19 @@ jobs: - name: Build run: pnpm --filter lucide-static build + + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10 + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + cache: 'pnpm' + node-version-file: 'package.json' + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Typecheck + run: pnpm --filter lucide-static typecheck diff --git a/.github/workflows/lucide-svelte-5.yml b/.github/workflows/lucide-svelte-5.yml index 4f48fcf19..946d650d3 100644 --- a/.github/workflows/lucide-svelte-5.yml +++ b/.github/workflows/lucide-svelte-5.yml @@ -61,5 +61,5 @@ jobs: - name: Install dependencies run: pnpm install --frozen-lockfile - - name: Test + - name: Typecheck run: pnpm --filter @lucide/svelte typecheck diff --git a/.github/workflows/lucide.yml b/.github/workflows/lucide.yml index 844d2647f..5cc24ce31 100644 --- a/.github/workflows/lucide.yml +++ b/.github/workflows/lucide.yml @@ -46,3 +46,19 @@ jobs: - name: Test run: pnpm --filter lucide test + + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10 + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + cache: 'pnpm' + node-version-file: 'package.json' + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Typecheck + run: pnpm --filter lucide typecheck diff --git a/.gitignore b/.gitignore index 9003ed236..9bb98e488 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .DS_Store .idea .next +.astro .obsidian .now .cache diff --git a/packages/astro/package.json b/packages/astro/package.json index 331fe75b4..abc2b3e5c 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -45,9 +45,11 @@ "copy:license": "cp ../../LICENSE ./LICENSE", "copy:utils": "cpy ../../packages/shared/src/build/{buildLucideIconNode.ts,defaultAttributes.ts,types.ts} ../../packages/shared/src/utils/{hasA11yProp.ts,toKebabCase.ts,mergeClasses.ts} ./src/utils/", "test": "pnpm copy:utils && pnpm build:icons && vitest run", - "test:watch": "pnpm build:icons && vitest run --watch" + "test:watch": "pnpm build:icons && vitest run --watch", + "typecheck": "pnpm copy:utils && pnpm build:icons && astro check" }, "devDependencies": { + "@astrojs/check": "^0.9.10", "@astrojs/ts-plugin": "^1.10.11", "@lucide/build-icons": "workspace:*", "@testing-library/dom": "^10.4.1", diff --git a/packages/astro/src/Icon.astro b/packages/astro/src/Icon.astro index 7d54bedfa..a2bacca75 100644 --- a/packages/astro/src/Icon.astro +++ b/packages/astro/src/Icon.astro @@ -11,7 +11,7 @@ const { 'stroke-width': strokeWidth = 2, absoluteStrokeWidth = false, nonScalingStroke = false, - iconNode, + iconNode = [], icon = { node: iconNode, aliases: [], diff --git a/packages/lab/package.json b/packages/lab/package.json index 6191fdca2..2155c1c72 100644 --- a/packages/lab/package.json +++ b/packages/lab/package.json @@ -36,7 +36,8 @@ "build:icons": "build-icons --input=../../lab --output=./src --templateSrc=./scripts/exportTemplate.mts --iconFileExtension=.ts --exportModuleNameCasing=camel --renderUniqueKey --exportFileName=index.ts", "build:lib": "node ./scripts/buildLib.mts", "build:bundle": "rollup -c rollup.config.mjs", - "clean": "rm -f src/icons/*.ts && rm -rf dist && rm -rf icons && rm -f icon-nodes.json" + "clean": "rm -f src/icons/*.ts && rm -rf dist && rm -rf icons && rm -f icon-nodes.json", + "typecheck": "pnpm build:icons && tsc --noEmit" }, "devDependencies": { "@lucide/build-icons": "workspace:*", diff --git a/packages/lab/tsconfig.json b/packages/lab/tsconfig.json index 479ed0ac1..4ae8ddc18 100644 --- a/packages/lab/tsconfig.json +++ b/packages/lab/tsconfig.json @@ -14,5 +14,6 @@ "allowImportingTsExtensions": true, "sourceMap": true, "outDir": "./dist" - } + }, + "include": ["src", "scripts"] } diff --git a/packages/lucide-preact/package.json b/packages/lucide-preact/package.json index 0b9883c26..c0637adf2 100644 --- a/packages/lucide-preact/package.json +++ b/packages/lucide-preact/package.json @@ -44,7 +44,8 @@ "build:icons": "build-icons --output=./src --templateSrc=./scripts/exportTemplate.mts --renderUniqueKey --withAliases --aliasesFileExtension=.ts --iconFileExtension=.ts --exportFileName=index.ts", "build:bundles": "rollup -c ./rollup.config.mjs", "test": "pnpm build:icons && vitest run", - "test:watch": "vitest watch" + "test:watch": "vitest watch", + "typecheck": "pnpm build:icons && tsc" }, "devDependencies": { "@lucide/build-icons": "workspace:*", diff --git a/packages/lucide-preact/tests/testIconNodes.ts b/packages/lucide-preact/tests/testIconNodes.ts index 8c593572d..6da6aefd3 100644 --- a/packages/lucide-preact/tests/testIconNodes.ts +++ b/packages/lucide-preact/tests/testIconNodes.ts @@ -1,4 +1,4 @@ -import { IconNode } from '../src/createLucideIcon'; +import type { IconNode } from '../src/types'; export const airVent: IconNode = [ [ diff --git a/packages/lucide-preact/tsconfig.json b/packages/lucide-preact/tsconfig.json index 5e21a5f7e..4cf0d753e 100644 --- a/packages/lucide-preact/tsconfig.json +++ b/packages/lucide-preact/tsconfig.json @@ -19,7 +19,6 @@ "resolveJsonModule": true, "allowSyntheticDefaultImports": true, "sourceMap": true, - "outDir": "./dist", "jsx": "react-jsx", "jsxImportSource": "preact", "types": ["@testing-library/jest-dom/vitest"] diff --git a/packages/lucide-react-native/__mocks__/react-native-svg/index.ts b/packages/lucide-react-native/__mocks__/react-native-svg/index.ts index b61dec342..4a95a054f 100644 --- a/packages/lucide-react-native/__mocks__/react-native-svg/index.ts +++ b/packages/lucide-react-native/__mocks__/react-native-svg/index.ts @@ -1,12 +1,12 @@ // https://github.com/FormidableLabs/react-native-svg-mock import React from 'react'; -import type { LucideProps } from '../../src/createReactComponent'; +import type { LucideProps } from '../../src/types'; export type { SvgProps } from 'react-native-svg'; const createComponent = function (name: string) { // React Native identifies elements by `testID`, the DOM equivalent is `data-testid` - const component = ({ testID, ...props }: LucideProps) => { - return React.createElement(name, { ...props, 'data-testid': testID }, props.children); + const component = ({ testID, children, ...props }: LucideProps) => { + return React.createElement(name, { ...props, children, 'data-testid': testID }); }; component.displayName = name; diff --git a/packages/lucide-react-native/package.json b/packages/lucide-react-native/package.json index d672a4830..c68e8566c 100644 --- a/packages/lucide-react-native/package.json +++ b/packages/lucide-react-native/package.json @@ -61,7 +61,8 @@ "build:icons": "build-icons --output=./src --templateSrc=./scripts/exportTemplate.mts --renderUniqueKey --iconFileExtension=.ts --exportFileName=index.ts --withAliases --separateAliasesFile --separateAliasesFileIgnore=fingerprint --aliasesFileExtension=.ts", "build:bundles": "rollup -c ./rollup.config.mjs", "test": "pnpm build:icons && vitest run", - "test:watch": "vitest watch" + "test:watch": "vitest watch", + "typecheck": "pnpm build:icons && tsc" }, "devDependencies": { "@lucide/build-icons": "workspace:*", diff --git a/packages/lucide-react-native/src/Icon.ts b/packages/lucide-react-native/src/Icon.ts index 184a8e48e..270b67ae1 100644 --- a/packages/lucide-react-native/src/Icon.ts +++ b/packages/lucide-react-native/src/Icon.ts @@ -85,7 +85,7 @@ const Icon = forwardRef( const hasAccessibleProp = Boolean(children) || hasA11yProp(rest); const [, svgAttributes, builtIconNode = []] = buildLucideIconForReact(icon, { - color: color ?? contextColor, + color: (color ?? contextColor) as string, width: width ?? size ?? contextSize, height: height ?? size ?? contextSize, strokeWidth: strokeWidth ?? contextStrokeWidth, diff --git a/packages/lucide-react-native/src/context.ts b/packages/lucide-react-native/src/context.ts index 3dd87faa8..347f90592 100644 --- a/packages/lucide-react-native/src/context.ts +++ b/packages/lucide-react-native/src/context.ts @@ -9,12 +9,14 @@ const LucideContext = createContext<{ */ absoluteStrokeWidth?: boolean; nonScalingStroke?: boolean; + className?: string; }>({ size: 24, color: 'currentColor', strokeWidth: 2, absoluteStrokeWidth: false, nonScalingStroke: false, + className: '', }); interface LucideProviderProps { @@ -27,6 +29,7 @@ interface LucideProviderProps { */ absoluteStrokeWidth?: boolean; nonScalingStroke?: boolean; + className?: string; } export function LucideProvider({ @@ -36,6 +39,7 @@ export function LucideProvider({ strokeWidth, absoluteStrokeWidth, nonScalingStroke, + className, }: LucideProviderProps) { const value = useMemo( () => ({ @@ -44,8 +48,9 @@ export function LucideProvider({ strokeWidth, absoluteStrokeWidth, nonScalingStroke, + className, }), - [size, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke], + [size, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className], ); return createElement(LucideContext.Provider, { value }, children); diff --git a/packages/lucide-react-native/src/types.ts b/packages/lucide-react-native/src/types.ts index fc3dfe772..48945f072 100644 --- a/packages/lucide-react-native/src/types.ts +++ b/packages/lucide-react-native/src/types.ts @@ -18,6 +18,7 @@ export interface LucideProps extends SvgProps { size?: string | number; width?: string | number; height?: string | number; + className?: string; /** * @deprecated Use `nonScalingStroke` instead. */ diff --git a/packages/lucide-react-native/tests/context.spec.tsx b/packages/lucide-react-native/tests/context.spec.tsx index d4a166b9a..fefc970ff 100644 --- a/packages/lucide-react-native/tests/context.spec.tsx +++ b/packages/lucide-react-native/tests/context.spec.tsx @@ -76,5 +76,23 @@ describe('Using LucideProvider', () => { expect(IconComponent).toHaveAttribute('height', '32'); expect(IconComponent).toHaveAttribute('stroke', 'blue'); expect(IconComponent).toHaveAttribute('stroke-width', '3'); + expect(IconComponent).toHaveAttribute('stroke-width', '3'); + }); + it('should merge provider and icon className values', () => { + cleanup(); + const testId = 'house-icon'; + const { getByTestId } = render( + + + , + ); + + expect(getByTestId(testId)).toHaveAttribute( + 'class', + 'lucide lucide-house lucide-home provider-class icon-class', + ); }); }); diff --git a/packages/lucide-react-native/tsconfig.json b/packages/lucide-react-native/tsconfig.json index a79eb44b0..a6e45f1c6 100644 --- a/packages/lucide-react-native/tsconfig.json +++ b/packages/lucide-react-native/tsconfig.json @@ -17,7 +17,9 @@ "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, "esModuleInterop": true, - "skipLibCheck": false + "skipLibCheck": true, + "types": ["@testing-library/jest-dom/vitest"] }, - "exclude": ["node_modules"] + "exclude": ["node_modules"], + "include": ["src", "tests", "__mocks__", "vitest.config.mts"] } diff --git a/packages/lucide-react/package.json b/packages/lucide-react/package.json index a179c65f6..38bf3c8ea 100644 --- a/packages/lucide-react/package.json +++ b/packages/lucide-react/package.json @@ -44,7 +44,7 @@ "clean": "rm -rf dist && rm -rf stats && rm -rf ./src/icons/*.ts && rm -f dynamic.{d.ts,d.mts,mts,mjs,mjs.map} && rm -f dynamicIconImports.d.ts", "build:icons": "build-icons --output=./src --templateSrc=./scripts/exportTemplate.mts --renderUniqueKey --withAliases --withDynamicImports --separateAliasesFile --separateAliasesFileIgnore=fingerprint --aliasesFileExtension=.ts --iconFileExtension=.ts --exportFileName=index.ts", "build:bundles": "rollup -c ./rollup.config.mjs", - "typecheck": "tsc", + "typecheck": "pnpm build:icons && tsc --noEmit", "typecheck:watch": "tsc -w", "test": "pnpm build:icons && vitest run", "test:watch": "vitest watch" diff --git a/packages/lucide-solid/package.json b/packages/lucide-solid/package.json index 7851295fe..06fd88a4a 100644 --- a/packages/lucide-solid/package.json +++ b/packages/lucide-solid/package.json @@ -57,12 +57,12 @@ "scripts": { "build": "pnpm clean && pnpm copy:license && pnpm build:icons && pnpm build:bundle", "copy:license": "cp ../../LICENSE ./LICENSE", - "clean": "rm -rf dist && rm -rf stats && rm -rf ./src/icons/*.ts", + "clean": "rm -rf dist && rm -rf stats && rm -rf ./src/icons/*.ts ./src/icons/*.tsx", "build:transpile": "tsc --jsx preserve -t es2020 --rootDir src --outDir dist --noEmit false", "build:version": "node ./scripts/replaceVersion.mjs", "build:bundle": "rollup -c rollup.config.mjs", "build:icons": "build-icons --output=./src --templateSrc=./scripts/exportTemplate.mts --renderUniqueKey --withAliases --separateAliasesFile --separateAliasesFileIgnore=fingerprint --aliasesFileExtension=.ts --iconFileExtension=.tsx --exportFileName=index.ts", - "typecheck": "tsc", + "typecheck": "pnpm build:icons && tsc", "typecheck:watch": "tsc -w", "test": "pnpm build:icons && vitest run", "test:watch": "vitest watch" diff --git a/packages/lucide-solid/src/types.ts b/packages/lucide-solid/src/types.ts index 209acad63..344a49f0b 100644 --- a/packages/lucide-solid/src/types.ts +++ b/packages/lucide-solid/src/types.ts @@ -6,9 +6,9 @@ import type { export type SVGAttributes = Partial>; -export type LucideIconNode = SharedLucideIconNode; +export type LucideIconNode = SharedLucideIconNode; -export type LucideIconData = SharedLucideIconData; +export type LucideIconData = SharedLucideIconData; /** * @deprecated Use LucideIconNode instead. diff --git a/packages/lucide-solid/tsconfig.json b/packages/lucide-solid/tsconfig.json index a0f34da4d..ffe4dacd2 100644 --- a/packages/lucide-solid/tsconfig.json +++ b/packages/lucide-solid/tsconfig.json @@ -15,8 +15,7 @@ "types": ["vite/client", "@testing-library/jest-dom/vitest"], "noEmit": true, "isolatedModules": true, - "outDir": "./dist", - "declarationDir": "./dist", + "skipLibCheck": true, "declaration": true } } diff --git a/packages/lucide-static/package.json b/packages/lucide-static/package.json index 3030f1cf6..d599da9e3 100644 --- a/packages/lucide-static/package.json +++ b/packages/lucide-static/package.json @@ -34,7 +34,8 @@ "build:icons": "build-icons --output=./src --templateSrc=./scripts/exportTemplate.mts --iconFileExtension=.ts --withAliases --aliasNamesOnly --aliasesFileExtension=.ts --exportFileName=index.ts", "build:lib": "node ./scripts/buildLib.mts", "build:bundles": "rollup -c rollup.config.mjs", - "clean": "rm -rf lib && rm -rf build && rm -rf icons && rm -f sprite.svg" + "clean": "rm -rf lib && rm -rf build && rm -rf icons && rm -f sprite.svg", + "typecheck": "pnpm build:icons && tsc --noEmit" }, "devDependencies": { "@lucide/build-icons": "workspace:*", diff --git a/packages/lucide-static/scripts/migrateIconsToTags.mts b/packages/lucide-static/scripts/migrateIconsToTags.mts index 64228b1cf..03970e9b5 100644 --- a/packages/lucide-static/scripts/migrateIconsToTags.mts +++ b/packages/lucide-static/scripts/migrateIconsToTags.mts @@ -9,7 +9,7 @@ const icons = await readAllMetadata(ICONS_DIR); const tags = Object.keys(icons) .sort() - .reduce((acc, iconName) => { + .reduce>((acc, iconName) => { acc[iconName] = icons[iconName].tags; return acc; }, {}); diff --git a/packages/lucide-static/tsconfig.json b/packages/lucide-static/tsconfig.json index 479ed0ac1..4ae8ddc18 100644 --- a/packages/lucide-static/tsconfig.json +++ b/packages/lucide-static/tsconfig.json @@ -14,5 +14,6 @@ "allowImportingTsExtensions": true, "sourceMap": true, "outDir": "./dist" - } + }, + "include": ["src", "scripts"] } diff --git a/packages/lucide/package.json b/packages/lucide/package.json index 6aafc661b..1f59bb2f1 100644 --- a/packages/lucide/package.json +++ b/packages/lucide/package.json @@ -39,7 +39,8 @@ "build:icons": "build-icons --output=./src --templateSrc=./scripts/exportTemplate.mts --iconFileExtension=.ts --withAliases --aliasNamesOnly --aliasesFileExtension=.ts --exportFileName=index.ts", "build:bundle": "rollup -c rollup.config.mjs", "test": "pnpm build:icons && vitest run", - "test:watch": "vitest watch" + "test:watch": "vitest watch", + "typecheck": "pnpm build:icons && tsc --noEmit" }, "devDependencies": { "@lucide/build-icons": "workspace:*", diff --git a/packages/lucide/src/replaceElement.ts b/packages/lucide/src/replaceElement.ts index 306df5bee..e3dacfc4f 100644 --- a/packages/lucide/src/replaceElement.ts +++ b/packages/lucide/src/replaceElement.ts @@ -22,7 +22,7 @@ export const getAttrs = (element: Element): Record => * @returns {Array} */ export const getClassNames = ( - attrs: Record | string, + attrs: Record | string, ): string | string[] => { if (typeof attrs === 'string') return attrs; if (!attrs || !attrs.class) return ''; diff --git a/packages/lucide/tsconfig.json b/packages/lucide/tsconfig.json index b6614e7e8..dea9fd65f 100644 --- a/packages/lucide/tsconfig.json +++ b/packages/lucide/tsconfig.json @@ -11,6 +11,7 @@ "allowJs": true, "lib": ["esnext", "dom"], "resolveJsonModule": true, + "skipLibCheck": true, "sourceMap": true, "outDir": "./dist" } diff --git a/packages/shared/package.json b/packages/shared/package.json index c74f005e3..bf0c86002 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -10,7 +10,8 @@ "license": "ISC", "scripts": { "test": "vitest run", - "test:watch": "vitest watch" + "test:watch": "vitest watch", + "typecheck": "tsc" }, "exports": { ".": "./src/index.ts", @@ -20,6 +21,7 @@ } }, "devDependencies": { + "@types/node": "^26.4.1", "vite": "^7.3.6" } } diff --git a/packages/shared/tests/toLucideIconData.spec.ts b/packages/shared/tests/toLucideIconData.spec.ts index b08c79f07..bbb321b93 100644 --- a/packages/shared/tests/toLucideIconData.spec.ts +++ b/packages/shared/tests/toLucideIconData.spec.ts @@ -1,9 +1,10 @@ import { describe, it, expect } from 'vitest'; import { toLucideIconData } from '../src/utils/toLucideIconData'; +import type { LucideIconNode } from '../src/build/types'; describe('toLucideIconData', () => { it('converts legacy name and node to icon data object', () => { - const iconNode = [['path', { d: 'M0 0h1' }]]; + const iconNode: LucideIconNode[] = [['path', { d: 'M0 0h1' }]]; expect(toLucideIconData('AirVent', iconNode)).toEqual({ name: 'air-vent', @@ -13,7 +14,7 @@ describe('toLucideIconData', () => { }); it('adds aliases when provided for legacy input', () => { - const iconNode = [['path', { d: 'M0 0h1' }]]; + const iconNode: LucideIconNode[] = [['path', { d: 'M0 0h1' }]]; expect(toLucideIconData('AirVent', iconNode, ['vent'])).toEqual({ name: 'air-vent', diff --git a/packages/shared/tsconfig.json b/packages/shared/tsconfig.json new file mode 100644 index 000000000..e6e47d48c --- /dev/null +++ b/packages/shared/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "types": ["node"] + }, + "include": ["src", "tests"] +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 256b73851..3d6fb2a21 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -543,6 +543,9 @@ importers: packages/astro: devDependencies: + '@astrojs/check': + specifier: ^0.9.10 + version: 0.9.10(@emnapi/runtime@1.11.3)(prettier-plugin-astro@0.14.1)(prettier@3.9.6)(typescript@6.0.3) '@astrojs/ts-plugin': specifier: ^1.10.11 version: 1.10.11(typescript@6.0.3) @@ -915,6 +918,9 @@ importers: packages/shared: devDependencies: + '@types/node': + specifier: ^26.4.1 + version: 26.4.1 vite: specifier: ^7.3.6 version: 7.3.6(@types/node@26.4.1)(jiti@2.7.0)(less@4.9.1(supports-color@10.2.2))(lightningcss@1.33.0)(sass@1.103.1)(stylus@0.56.0(supports-color@10.2.2))(terser@5.51.2)(yaml@2.9.0) @@ -1418,6 +1424,16 @@ packages: resolution: {integrity: sha512-93Z1N+BQNXysodoicpOIyNh2drHfz/CTf9nnT0FEx72GJcIiwgydD7tGAr78j41LsYn3hlRn+LdGPuBLn1Bl8Q==} engines: {node: ^22.13.0 || >=24.0.0} + '@astrojs/astro2tsx@0.1.0': + resolution: {integrity: sha512-tgprkax8mcF+BiHJQBdoQ+REqtvvnLlYzV0yCeLMdcv3pJIutdlinWNHUzN1jMOT5VRlYTtMmDdaoPrtd3cBAQ==} + engines: {node: ^20.19.0 || >=22.12.0} + + '@astrojs/check@0.9.10': + resolution: {integrity: sha512-zgx/UQMozdjOa3bOxjgeCFdtpE3c9rRX6xHwa+2QXvy8z8Akifu2AtubHyv/zzC2znO8dl8fFWL4K+Ba9kS8HQ==} + hasBin: true + peerDependencies: + typescript: ^5.0.0 || ^6.0.0 + '@astrojs/compiler-binding-darwin-arm64@0.4.0': resolution: {integrity: sha512-ZVUwHundaQyFNjE6uoa0usaC0WOCitDCLS/4mdb4rOiJXwVUuKJBMxI5WMzXLWmamsXtK/Z//ifLXvV5Yeh4Hw==} engines: {node: ^20.19.0 || >=22.12.0} @@ -1489,6 +1505,18 @@ packages: '@astrojs/internal-helpers@0.11.0': resolution: {integrity: sha512-3rzxJ+xbo0+8YyqOzLziIN32wmsHdCjEVz2sGOpRxJ+Ben/KiLph4ItxBy1abEL+E8fkRzqjg0rfXmaHJGw9JA==} + '@astrojs/language-server@2.17.0': + resolution: {integrity: sha512-ZvT7UEo7/jBdfjXD3nNYssziEezNKM8G6FUYRnGUidAs7FmowqsQhQ0Xwl5Q4tjqlOjhnpxQuoEb4jwESL+nKQ==} + hasBin: true + peerDependencies: + prettier: ^3.0.0 + prettier-plugin-astro: '>=0.11.0' + peerDependenciesMeta: + prettier: + optional: true + prettier-plugin-astro: + optional: true + '@astrojs/markdown-satteri@0.4.1': resolution: {integrity: sha512-EniHbFNa6SQHDih7JnpPos3NWXO6hdt4raBcOosfGmlfc3gP9CI/sESA3VOf1PgJZ7SFfewlZW9Livn0JugEZg==} @@ -2538,6 +2566,27 @@ packages: search-insights: optional: true + '@emmetio/abbreviation@2.3.3': + resolution: {integrity: sha512-mgv58UrU3rh4YgbE/TzgLQwJ3pFsHHhCLqY20aJq+9comytTXUDNGG/SMtSeMJdkpxgXSXunBGLD8Boka3JyVA==} + + '@emmetio/css-abbreviation@2.1.8': + resolution: {integrity: sha512-s9yjhJ6saOO/uk1V74eifykk2CBYi01STTK3WlXWGOepyKa23ymJ053+DNQjpFcy1ingpaO7AxCcwLvHFY9tuw==} + + '@emmetio/css-parser@0.4.1': + resolution: {integrity: sha512-2bC6m0MV/voF4CTZiAbG5MWKbq5EBmDPKu9Sb7s7nVcEzNQlrZP6mFFFlIaISM8X6514H9shWMme1fCm8cWAfQ==} + + '@emmetio/html-matcher@1.3.0': + resolution: {integrity: sha512-NTbsvppE5eVyBMuyGfVu2CRrLvo7J4YHb6t9sBFLyY03WYhXET37qA4zOYUjBWFCRHO7pS1B9khERtY0f5JXPQ==} + + '@emmetio/scanner@1.0.4': + resolution: {integrity: sha512-IqRuJtQff7YHHBk4G8YZ45uB9BaAGcwQeVzgj/zj8/UdOhtQpEIupUhSk8dys6spFIWVZVeK20CzGEnqR5SbqA==} + + '@emmetio/stream-reader-utils@0.1.0': + resolution: {integrity: sha512-ZsZ2I9Vzso3Ho/pjZFsmmZ++FWeEd/txqybHTm4OgaZzdS8V9V/YYWQwg5TC38Z7uLWUV1vavpLLbjJtKubR1A==} + + '@emmetio/stream-reader@2.2.0': + resolution: {integrity: sha512-fXVXEyFA5Yv3M3n8sUGT7+fvecGrZP4k6FnWWMSZVQf69kAq0LLpaBQLGcPR30m3zMmKYhECP4k/ZkzvhEW5kw==} + '@emnapi/core@1.10.0': resolution: {integrity: sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==} @@ -2547,6 +2596,9 @@ packages: '@emnapi/core@1.11.2': resolution: {integrity: sha512-TC8MkTuZUtcTSiFeuC0ksCh9QIJ5+F21MvZ4Wn4ORfYaFJ/0dsiudv5tVkejgwZlwQ39jL9WWDe2lz8x0WglOA==} + '@emnapi/core@1.11.3': + resolution: {integrity: sha512-zLpS5asjEb7lq8jYLq37N6XKaE41DIexlY1rF/z4/tIl3wo13Sqm28fRyfIsKZD+NZ8mM5RoKkpW/rBcuoSZSg==} + '@emnapi/runtime@1.10.0': resolution: {integrity: sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==} @@ -2565,6 +2617,9 @@ packages: '@emnapi/wasi-threads@1.2.2': resolution: {integrity: sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==} + '@emnapi/wasi-threads@1.2.3': + resolution: {integrity: sha512-ELEBe8PsLvvJ6QMr0zLt8ffvOHW/dc1m3CEzNMg7aJUv3bMaoDtw2TXyDAwkYBuroxxuHEwhRTLJSe5sya547g==} + '@esbuild/aix-ppc64@0.28.2': resolution: {integrity: sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==} engines: {node: '>=18'} @@ -5574,9 +5629,30 @@ packages: '@vitest/utils@4.1.10': resolution: {integrity: sha512-fy9am/HWxbaGt/Sawrp90vt6Y6jQwf1RX77cz3uwoJwJVMli/e1IEwRPnMNJ7vKfPTwo0diXifkpPvwH9v7nGA==} + '@volar/kit@2.4.28': + resolution: {integrity: sha512-cKX4vK9dtZvDRaAzeoUdaAJEew6IdxHNCRrdp5Kvcl6zZOqb6jTOfk3kXkIkG3T7oTFXguEMt5+9ptyqYR84Pg==} + peerDependencies: + typescript: '*' + '@volar/language-core@2.4.28': resolution: {integrity: sha512-w4qhIJ8ZSitgLAkVay6AbcnC7gP3glYM3fYwKV3srj8m494E3xtrCv6E+bWviiK/8hs6e6t1ij1s2Endql7vzQ==} + '@volar/language-server@2.4.28': + resolution: {integrity: sha512-NqcLnE5gERKuS4PUFwlhMxf6vqYo7hXtbMFbViXcbVkbZ905AIVWhnSo0ZNBC2V127H1/2zP7RvVOVnyITFfBw==} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + + '@volar/language-service@2.4.28': + resolution: {integrity: sha512-Rh/wYCZJrI5vCwMk9xyw/Z+MsWxlJY1rmMZPsxUoJKfzIRjS/NF1NmnuEcrMbEVGja00aVpCsInJfixQTMdvLw==} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + '@volar/source-map@2.4.28': resolution: {integrity: sha512-yX2BDBqJkRXfKw8my8VarTyjv48QwxdJtvRgUpNE5erCsgEUdI2DsLbpa+rOQVAJYshY99szEcRDmyHbF10ggQ==} @@ -5588,6 +5664,9 @@ packages: typescript: optional: true + '@vscode/emmet-helper@2.11.0': + resolution: {integrity: sha512-QLxjQR3imPZPQltfbWRnHU6JecWTF1QSWhx3GAKQpslx7y3Dp6sIIXhKjiUJ/BR9FX8PVthjr9PD6pNwOJfAzw==} + '@vscode/l10n@0.0.18': resolution: {integrity: sha512-KYSIHVmslkaCDyw013pphY+d7x1qV8IZupYfeIfzNA+nsaWHbn5uPuQRvdRFsa9zFzGeudPuoGoZ1Op4jrJXIQ==} @@ -5818,6 +5897,14 @@ packages: ts-node: optional: true + ajv-draft-04@1.0.0: + resolution: {integrity: sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==} + peerDependencies: + ajv: ^8.5.0 + peerDependenciesMeta: + ajv: + optional: true + ajv-formats@3.0.1: resolution: {integrity: sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==} peerDependencies: @@ -5826,6 +5913,11 @@ packages: ajv: optional: true + ajv-i18n@4.2.0: + resolution: {integrity: sha512-v/ei2UkCEeuKNXh8RToiFsUclmU+G57LO1Oo22OagNMENIw+Yb8eMwvHu7Vn9fmkjJyv6XclhJ8TbuigSglPkg==} + peerDependencies: + ajv: ^8.0.0-beta.0 + ajv@6.15.0: resolution: {integrity: sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==} @@ -6985,6 +7077,9 @@ packages: element-to-path@1.2.1: resolution: {integrity: sha512-JNFZS0yI3Myywn/ltFj/yTihHNzMTYk0ycHcgcjlvA/dYMUjMIGqvbezPZeXN3U1Klp/aiigr2mpmhVRfudtbg==} + emmet@2.4.11: + resolution: {integrity: sha512-23QPJB3moh/U9sT4rQzGgeyyGIrcM+GH5uVYg2C6wZIxAIJq7Ng3QLT79tl8FUwDXhyq9SusfknOrofAKqvgyQ==} + emoji-regex-xs@1.0.0: resolution: {integrity: sha512-LRlerrMYoIDrT6jgpeZ2YYl/L8EulRTt5hQcYjy5AInh7HWXKimpqx68aknBFpGL2+/IcogTcaydJEgaTmOpDg==} @@ -8259,6 +8354,9 @@ packages: resolution: {integrity: sha512-1e4qoRgnn448pRuMvKGsFFymUCquZV0mpGgOyIKNgD3JVDTsVJyRBGH/Fm0tBb8WsWGgmB1mDe6/yJMQM37DUA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + jsonc-parser@2.3.1: + resolution: {integrity: sha512-H8jvkz1O50L3dMZCsLqiuB2tA7muqbSg1AtGEkN0leAqGjsUzDJir3Zwr02BhqdcITPg3ei3mZ+HjMocAknhhg==} + jsonc-parser@3.3.1: resolution: {integrity: sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==} @@ -9787,6 +9885,12 @@ packages: resolution: {integrity: sha512-U7XpAktpbSgHTRSNRrjKSrjYkZKuhUukfoBlXWXUExCAqhzh1TU3BDRAfJmarcl5voKS+pbKU9MvyLWKZ4UEEg==} engines: {node: '>= 0.8.0'} + request-light@0.5.8: + resolution: {integrity: sha512-3Zjgh+8b5fhRJBQZoy+zbVKpAQGLyka0MPgW3zruTF4dFFJ8Fqcfu9YsAvi/rvdcaTeWG3MkbZv4WKxAn/84Lg==} + + request-light@0.7.0: + resolution: {integrity: sha512-lMbBMrDoxgsyO+yB3sDcrDuX85yYt7sS8BfQd11jtbW/z5ZWgLZRcEGLsLoYw7I0WSUGQBs8CC8ScIxkTX1+6Q==} + require-directory@2.1.1: resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} engines: {node: '>=0.10.0'} @@ -10734,6 +10838,12 @@ packages: resolution: {integrity: sha512-phPGCwqr2+Qo0fwniCE8e4pKnGu/yFb5nD5Y8bf0EEeiI5GklnACYA9GFy/DrAeRrKHXvHn+1SUsOWgJp6RO+g==} engines: {node: '>= 0.4'} + typesafe-path@0.2.2: + resolution: {integrity: sha512-OJabfkAg1WLZSqJAJ0Z6Sdt3utnbzr/jh+NAHoyWHJe8CMSy79Gm085094M9nvTPy22KzTVn5Zq5mbapCI/hPA==} + + typescript-auto-import-cache@0.3.6: + resolution: {integrity: sha512-RpuHXrknHdVdK7wv/8ug3Fr0WNsNi5l5aB8MYYuXhq2UH5lnEB1htJ1smhtD5VeCsGr2p8mUDtd83LCQDFVgjQ==} + typescript-eslint@8.69.0: resolution: {integrity: sha512-B3MltX0VqjUBNEe3b3sSuiRbfa6XrfHFtBiPamjT5AsW/dfq+y+bc0wyuS9DxAS1LyzCxRp2+rxzpLUvqM2BvA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -11202,15 +11312,111 @@ packages: vlq@1.0.1: resolution: {integrity: sha512-gQpnTgkubC6hQgdIcRdYGDSDc+SaujOdyesZQMv6JlfQee/9Mp0Qhnys6WxDWvQnL5WZdT7o2Ul187aSt0Rq+w==} + volar-service-css@0.0.71: + resolution: {integrity: sha512-wRRFt9BpjMKCazcgOh67MSjUjiWUCAh99DyYSDIOTuxaRjEtDC7PpB0k1Y1wbJIW/pVtMUSVbpPo3UGSm0Byxw==} + peerDependencies: + '@volar/language-service': ~2.4.0 + peerDependenciesMeta: + '@volar/language-service': + optional: true + + volar-service-emmet@0.0.71: + resolution: {integrity: sha512-zqjzt6bN95e3CUstBm0PBFAJnrfz0ZAARka87fart46/gNCLLuP3Vujy8V/J8HEziTFLnfkgIASLFYPUhonJcA==} + peerDependencies: + '@volar/language-service': ~2.4.0 + peerDependenciesMeta: + '@volar/language-service': + optional: true + + volar-service-html@0.0.71: + resolution: {integrity: sha512-e8tHPhgQ7ooLfudAEIku+kgd9pWkq3SSz8RbnQDI1+Eb8wbenkLGHqoirLqz5ORLV6wIMr2Iv08RWBG5eOcgpw==} + peerDependencies: + '@volar/language-service': ~2.4.0 + peerDependenciesMeta: + '@volar/language-service': + optional: true + + volar-service-prettier@0.0.71: + resolution: {integrity: sha512-Rz7JVH3qD108UCdmIEiZvOBNljMt2nLFdbN8AXcDfn7xD9F5I2aCIsDVqBbXw21PsnxG0b7MfwtNF+zPS/NKUg==} + peerDependencies: + '@volar/language-service': ~2.4.0 + prettier: ^2.2 || ^3.0 + peerDependenciesMeta: + '@volar/language-service': + optional: true + prettier: + optional: true + + volar-service-typescript-twoslash-queries@0.0.71: + resolution: {integrity: sha512-9K2k72s4n7rV9s4bX0MyjbX9iBribvKZbBJKuEmTCZfeWJXs6Yh7bGpY4eoc7UufAjvpheBqwyZCOIPBvxCv0A==} + peerDependencies: + '@volar/language-service': ~2.4.0 + typescript: '*' + peerDependenciesMeta: + '@volar/language-service': + optional: true + typescript: + optional: true + + volar-service-typescript@0.0.71: + resolution: {integrity: sha512-yTtM/BVT6hoyEYnDtaCyAtNhdNeS/mhTTABlBOdw3NNiRBUin3IznFJpgfjer4c6RYopiPjjQjc9VFhxVl1mLw==} + peerDependencies: + '@volar/language-service': ~2.4.0 + typescript: '*' + peerDependenciesMeta: + '@volar/language-service': + optional: true + typescript: + optional: true + + volar-service-yaml@0.0.71: + resolution: {integrity: sha512-qYGWGuVpUTnZGu5P/CR4KLK4aIR8RrcVnmfZ2eRcj9q/I8VZCoC5yy9FtEvfNvnDp4MU17yhdJcvpQPIqhJS2Q==} + peerDependencies: + '@volar/language-service': ~2.4.0 + peerDependenciesMeta: + '@volar/language-service': + optional: true + vscode-css-languageservice@6.3.10: resolution: {integrity: sha512-eq5N9Er3fC4vA9zd9EFhyBG90wtCCuXgRSpAndaOgXMh1Wgep5lBgRIeDgjZBW9pa+332yC9+49cZMW8jcL3MA==} + vscode-html-languageservice@5.6.2: + resolution: {integrity: sha512-ulCrSnFnfQ16YzvwnYUgEbUEl/ZG7u2eV27YhvLObSHKkb8fw1Z9cgsnUwjTEeDIdJDoTDTDpxuhQwoenoLNMg==} + + vscode-json-languageservice@4.1.8: + resolution: {integrity: sha512-0vSpg6Xd9hfV+eZAaYN63xVVMOTmJ4GgHxXnkLCh+9RsQBkWKIghzLhW2B9ebfG+LQQg8uLtsQ2aUKjTgE+QOg==} + engines: {npm: '>=7.0.0'} + + vscode-jsonrpc@8.2.0: + resolution: {integrity: sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA==} + engines: {node: '>=14.0.0'} + + vscode-jsonrpc@9.0.2: + resolution: {integrity: sha512-SbQSV9yRemARxeXw6LU5sS6Zq0e9/DgCCX5yelH263ZQWukbTk8EF8fjTrr1dziasf4GwlJbvTwFnTrnQFWZXQ==} + engines: {node: '>=14.0.0'} + + vscode-languageserver-protocol@3.17.5: + resolution: {integrity: sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg==} + + vscode-languageserver-protocol@3.18.3: + resolution: {integrity: sha512-DF49+WeV5py4zO5hhobp60jjsDSK0lAqA0OuKBLBvp423HPWQcCbhZz3JgyfIewsEz2f8U+X75xNIFHdiXZm2w==} + vscode-languageserver-textdocument@1.0.14: resolution: {integrity: sha512-EQyqJMi552E4ZTf46izQ4Fj6XquqxCySR3J5ZSD1SisMf6RfpeOWHxGBE8Gr6V0/3GHIGdAzDn8F8+1nTGCnoQ==} vscode-languageserver-types@3.17.5: resolution: {integrity: sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==} + vscode-languageserver-types@3.18.3: + resolution: {integrity: sha512-XIlzJ7Qp/jzSI1ds7/FwPAWrPeTZA7pAtlW4hdJ1J6xXWJL6dR9QYnDhJOdLzdKhUQ5Mm6mvUMw+3DcOQQasPw==} + + vscode-languageserver@9.0.1: + resolution: {integrity: sha512-woByF3PDpkHFUreUa7Hos7+pUWdeWMXRd26+ZX2A8cFx6v/JPTtd4/uN0/jB6XQHYaOlHbio03NTHCqrgG5n7g==} + hasBin: true + + vscode-nls@5.2.0: + resolution: {integrity: sha512-RAaHx7B14ZU04EU31pT+rKz2/zSl7xMsfIZuo8pd+KZO6PXtQmpevpq3vxvWNcrGbdmhM/rr5Uw5Mz+NBfhVng==} + vscode-uri@3.2.0: resolution: {integrity: sha512-m2gXo3bn0G1kT9InzMf07fTbqMbGtyckj3bH5ktLO+1Ssv+yiATZ4dhwaQv9UZWxJh6E9IFGnQyjgWVDWVBDrg==} @@ -11447,6 +11653,15 @@ packages: resolution: {integrity: sha512-odxVsHAkZYYglR30aPYRY4nUGJnoJ2y1ww2HDvZALo0BDETv9kWbi16J52eHs+PWRNmF4ub6nZqfVOeesOvntg==} engines: {node: ^14.17.0 || >=16.0.0} + yaml-language-server@1.23.0: + resolution: {integrity: sha512-3qVyCOexLCWw06PQa5kRPwvMWMZ/eZeCRWUvgD6a0OkqL/4iCnxy2WumbWifa937Uo5xhyWJ0uxlU39ljhNh7A==} + hasBin: true + + yaml@2.8.3: + resolution: {integrity: sha512-AvbaCLOO2Otw/lW5bmh9d/WEdcDFdQp2Z2ZUH3pX9U2ihyUY0nvLv7J6TrWowklRGPYbB/IuIMfYgxaCPg5Bpg==} + engines: {node: '>= 14.6'} + hasBin: true + yaml@2.9.0: resolution: {integrity: sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA==} engines: {node: '>= 14.6'} @@ -11972,6 +12187,25 @@ snapshots: is-potential-custom-element-name: 1.0.1 lru-cache: 11.5.2 + '@astrojs/astro2tsx@0.1.0(@emnapi/runtime@1.11.3)': + dependencies: + '@emnapi/core': 1.11.3 + '@napi-rs/wasm-runtime': 1.2.4(@emnapi/core@1.11.3)(@emnapi/runtime@1.11.3) + transitivePeerDependencies: + - '@emnapi/runtime' + + '@astrojs/check@0.9.10(@emnapi/runtime@1.11.3)(prettier-plugin-astro@0.14.1)(prettier@3.9.6)(typescript@6.0.3)': + dependencies: + '@astrojs/language-server': 2.17.0(@emnapi/runtime@1.11.3)(prettier-plugin-astro@0.14.1)(prettier@3.9.6)(typescript@6.0.3) + chokidar: 4.0.3 + kleur: 4.1.5 + typescript: 6.0.3 + yargs: 18.1.0 + transitivePeerDependencies: + - '@emnapi/runtime' + - prettier + - prettier-plugin-astro + '@astrojs/compiler-binding-darwin-arm64@0.4.0': optional: true @@ -12039,6 +12273,32 @@ snapshots: smol-toml: 1.8.0 unified: 11.0.5 + '@astrojs/language-server@2.17.0(@emnapi/runtime@1.11.3)(prettier-plugin-astro@0.14.1)(prettier@3.9.6)(typescript@6.0.3)': + dependencies: + '@astrojs/astro2tsx': 0.1.0(@emnapi/runtime@1.11.3) + '@astrojs/yaml2ts': 0.2.4 + '@volar/kit': 2.4.28(typescript@6.0.3) + '@volar/language-core': 2.4.28 + '@volar/language-server': 2.4.28(typescript@6.0.3) + '@volar/language-service': 2.4.28(typescript@6.0.3) + muggle-string: 0.4.1 + tinyglobby: 0.2.17 + volar-service-css: 0.0.71(@volar/language-service@2.4.28(typescript@6.0.3)) + volar-service-emmet: 0.0.71(@volar/language-service@2.4.28(typescript@6.0.3)) + volar-service-html: 0.0.71(@volar/language-service@2.4.28(typescript@6.0.3)) + volar-service-prettier: 0.0.71(@volar/language-service@2.4.28(typescript@6.0.3))(prettier@3.9.6) + volar-service-typescript: 0.0.71(@volar/language-service@2.4.28(typescript@6.0.3))(typescript@6.0.3) + volar-service-typescript-twoslash-queries: 0.0.71(@volar/language-service@2.4.28(typescript@6.0.3))(typescript@6.0.3) + volar-service-yaml: 0.0.71(@volar/language-service@2.4.28(typescript@6.0.3)) + vscode-html-languageservice: 5.6.2 + vscode-uri: 3.2.0 + optionalDependencies: + prettier: 3.9.6 + prettier-plugin-astro: 0.14.1 + transitivePeerDependencies: + - '@emnapi/runtime' + - typescript + '@astrojs/markdown-satteri@0.4.1': dependencies: '@astrojs/internal-helpers': 0.11.0 @@ -13318,6 +13578,29 @@ snapshots: transitivePeerDependencies: - '@algolia/client-search' + '@emmetio/abbreviation@2.3.3': + dependencies: + '@emmetio/scanner': 1.0.4 + + '@emmetio/css-abbreviation@2.1.8': + dependencies: + '@emmetio/scanner': 1.0.4 + + '@emmetio/css-parser@0.4.1': + dependencies: + '@emmetio/stream-reader': 2.2.0 + '@emmetio/stream-reader-utils': 0.1.0 + + '@emmetio/html-matcher@1.3.0': + dependencies: + '@emmetio/scanner': 1.0.4 + + '@emmetio/scanner@1.0.4': {} + + '@emmetio/stream-reader-utils@0.1.0': {} + + '@emmetio/stream-reader@2.2.0': {} + '@emnapi/core@1.10.0': dependencies: '@emnapi/wasi-threads': 1.2.1 @@ -13336,6 +13619,11 @@ snapshots: tslib: 2.8.1 optional: true + '@emnapi/core@1.11.3': + dependencies: + '@emnapi/wasi-threads': 1.2.3 + tslib: 2.8.1 + '@emnapi/runtime@1.10.0': dependencies: tslib: 2.8.1 @@ -13354,7 +13642,6 @@ snapshots: '@emnapi/runtime@1.11.3': dependencies: tslib: 2.8.1 - optional: true '@emnapi/wasi-threads@1.2.1': dependencies: @@ -13366,6 +13653,10 @@ snapshots: tslib: 2.8.1 optional: true + '@emnapi/wasi-threads@1.2.3': + dependencies: + tslib: 2.8.1 + '@esbuild/aix-ppc64@0.28.2': optional: true @@ -14363,6 +14654,12 @@ snapshots: '@tybys/wasm-util': 0.10.3 optional: true + '@napi-rs/wasm-runtime@1.2.4(@emnapi/core@1.11.3)(@emnapi/runtime@1.11.3)': + dependencies: + '@emnapi/core': 1.11.3 + '@emnapi/runtime': 1.11.3 + '@tybys/wasm-util': 0.10.3 + '@next/env@16.3.4': {} '@next/swc-darwin-arm64@16.3.4': @@ -15674,7 +15971,6 @@ snapshots: '@tybys/wasm-util@0.10.3': dependencies: tslib: 2.8.1 - optional: true '@types/aria-query@5.0.4': {} @@ -16231,10 +16527,42 @@ snapshots: convert-source-map: 2.0.0 tinyrainbow: 3.1.1 + '@volar/kit@2.4.28(typescript@6.0.3)': + dependencies: + '@volar/language-service': 2.4.28(typescript@6.0.3) + '@volar/typescript': 2.4.28(typescript@6.0.3) + typesafe-path: 0.2.2 + typescript: 6.0.3 + vscode-languageserver-textdocument: 1.0.14 + vscode-uri: 3.2.0 + '@volar/language-core@2.4.28': dependencies: '@volar/source-map': 2.4.28 + '@volar/language-server@2.4.28(typescript@6.0.3)': + dependencies: + '@volar/language-core': 2.4.28 + '@volar/language-service': 2.4.28(typescript@6.0.3) + '@volar/typescript': 2.4.28(typescript@6.0.3) + path-browserify: 1.0.1 + request-light: 0.7.0 + vscode-languageserver: 9.0.1 + vscode-languageserver-protocol: 3.18.3 + vscode-languageserver-textdocument: 1.0.14 + vscode-uri: 3.2.0 + optionalDependencies: + typescript: 6.0.3 + + '@volar/language-service@2.4.28(typescript@6.0.3)': + dependencies: + '@volar/language-core': 2.4.28 + vscode-languageserver-protocol: 3.18.3 + vscode-languageserver-textdocument: 1.0.14 + vscode-uri: 3.2.0 + optionalDependencies: + typescript: 6.0.3 + '@volar/source-map@2.4.28': {} '@volar/typescript@2.4.28(typescript@6.0.3)': @@ -16245,6 +16573,14 @@ snapshots: optionalDependencies: typescript: 6.0.3 + '@vscode/emmet-helper@2.11.0': + dependencies: + emmet: 2.4.11 + jsonc-parser: 2.3.1 + vscode-languageserver-textdocument: 1.0.14 + vscode-languageserver-types: 3.17.5 + vscode-uri: 3.2.0 + '@vscode/l10n@0.0.18': {} '@vue/compiler-core@3.5.42': @@ -16457,10 +16793,18 @@ snapshots: optionalDependencies: ts-node: 10.9.2(@swc/core@1.7.23(@swc/helpers@0.5.23))(@types/node@26.4.1)(typescript@6.0.3) + ajv-draft-04@1.0.0(ajv@8.20.0): + optionalDependencies: + ajv: 8.20.0 + ajv-formats@3.0.1(ajv@8.20.0): optionalDependencies: ajv: 8.20.0 + ajv-i18n@4.2.0(ajv@8.20.0): + dependencies: + ajv: 8.20.0 + ajv@6.15.0: dependencies: fast-deep-equal: 3.1.3 @@ -17787,6 +18131,11 @@ snapshots: element-to-path@1.2.1: {} + emmet@2.4.11: + dependencies: + '@emmetio/abbreviation': 2.3.3 + '@emmetio/css-abbreviation': 2.1.8 + emoji-regex-xs@1.0.0: {} emoji-regex@10.6.0: {} @@ -19223,6 +19572,8 @@ snapshots: espree: 9.6.1 semver: 7.8.5 + jsonc-parser@2.3.1: {} + jsonc-parser@3.3.1: {} jsonfile@4.0.0: @@ -21197,6 +21548,10 @@ snapshots: rename-keys@1.2.0: {} + request-light@0.5.8: {} + + request-light@0.7.0: {} + require-directory@2.1.1: {} require-from-string@2.0.2: {} @@ -22419,6 +22774,12 @@ snapshots: reflect.getprototypeof: 1.0.10 optional: true + typesafe-path@0.2.2: {} + + typescript-auto-import-cache@0.3.6: + dependencies: + semver: 7.8.5 + typescript-eslint@8.69.0(eslint@10.9.1(jiti@2.7.0)(supports-color@10.2.2))(supports-color@10.2.2)(typescript@6.0.3): dependencies: '@typescript-eslint/eslint-plugin': 8.69.0(@typescript-eslint/parser@8.69.0(eslint@10.9.1(jiti@2.7.0)(supports-color@10.2.2))(supports-color@10.2.2)(typescript@6.0.3))(eslint@10.9.1(jiti@2.7.0)(supports-color@10.2.2))(supports-color@10.2.2)(typescript@6.0.3) @@ -22959,6 +23320,64 @@ snapshots: vlq@1.0.1: {} + volar-service-css@0.0.71(@volar/language-service@2.4.28(typescript@6.0.3)): + dependencies: + vscode-css-languageservice: 6.3.10 + vscode-languageserver-textdocument: 1.0.14 + vscode-uri: 3.2.0 + optionalDependencies: + '@volar/language-service': 2.4.28(typescript@6.0.3) + + volar-service-emmet@0.0.71(@volar/language-service@2.4.28(typescript@6.0.3)): + dependencies: + '@emmetio/css-parser': 0.4.1 + '@emmetio/html-matcher': 1.3.0 + '@vscode/emmet-helper': 2.11.0 + vscode-uri: 3.2.0 + optionalDependencies: + '@volar/language-service': 2.4.28(typescript@6.0.3) + + volar-service-html@0.0.71(@volar/language-service@2.4.28(typescript@6.0.3)): + dependencies: + vscode-html-languageservice: 5.6.2 + vscode-languageserver-textdocument: 1.0.14 + vscode-uri: 3.2.0 + optionalDependencies: + '@volar/language-service': 2.4.28(typescript@6.0.3) + + volar-service-prettier@0.0.71(@volar/language-service@2.4.28(typescript@6.0.3))(prettier@3.9.6): + dependencies: + vscode-uri: 3.2.0 + optionalDependencies: + '@volar/language-service': 2.4.28(typescript@6.0.3) + prettier: 3.9.6 + + volar-service-typescript-twoslash-queries@0.0.71(@volar/language-service@2.4.28(typescript@6.0.3))(typescript@6.0.3): + dependencies: + vscode-uri: 3.2.0 + optionalDependencies: + '@volar/language-service': 2.4.28(typescript@6.0.3) + typescript: 6.0.3 + + volar-service-typescript@0.0.71(@volar/language-service@2.4.28(typescript@6.0.3))(typescript@6.0.3): + dependencies: + path-browserify: 1.0.1 + semver: 7.8.5 + typescript-auto-import-cache: 0.3.6 + vscode-languageserver-textdocument: 1.0.14 + vscode-nls: 5.2.0 + vscode-uri: 3.2.0 + optionalDependencies: + '@volar/language-service': 2.4.28(typescript@6.0.3) + typescript: 6.0.3 + + volar-service-yaml@0.0.71(@volar/language-service@2.4.28(typescript@6.0.3)): + dependencies: + vscode-uri: 3.2.0 + yaml-language-server: 1.23.0 + optionalDependencies: + '@volar/language-service': 2.4.28(typescript@6.0.3) + vscode-css-languageservice@6.3.10: dependencies: '@vscode/l10n': 0.0.18 @@ -22966,10 +23385,47 @@ snapshots: vscode-languageserver-types: 3.17.5 vscode-uri: 3.2.0 + vscode-html-languageservice@5.6.2: + dependencies: + '@vscode/l10n': 0.0.18 + vscode-languageserver-textdocument: 1.0.14 + vscode-languageserver-types: 3.17.5 + vscode-uri: 3.2.0 + + vscode-json-languageservice@4.1.8: + dependencies: + jsonc-parser: 3.3.1 + vscode-languageserver-textdocument: 1.0.14 + vscode-languageserver-types: 3.17.5 + vscode-nls: 5.2.0 + vscode-uri: 3.2.0 + + vscode-jsonrpc@8.2.0: {} + + vscode-jsonrpc@9.0.2: {} + + vscode-languageserver-protocol@3.17.5: + dependencies: + vscode-jsonrpc: 8.2.0 + vscode-languageserver-types: 3.17.5 + + vscode-languageserver-protocol@3.18.3: + dependencies: + vscode-jsonrpc: 9.0.2 + vscode-languageserver-types: 3.18.3 + vscode-languageserver-textdocument@1.0.14: {} vscode-languageserver-types@3.17.5: {} + vscode-languageserver-types@3.18.3: {} + + vscode-languageserver@9.0.1: + dependencies: + vscode-languageserver-protocol: 3.17.5 + + vscode-nls@5.2.0: {} + vscode-uri@3.2.0: {} vue-component-type-helpers@3.3.11: {} @@ -23209,6 +23665,23 @@ snapshots: eslint-visitor-keys: 3.4.3 yaml: 2.9.0 + yaml-language-server@1.23.0: + dependencies: + '@vscode/l10n': 0.0.18 + ajv: 8.20.0 + ajv-draft-04: 1.0.0(ajv@8.20.0) + ajv-i18n: 4.2.0(ajv@8.20.0) + prettier: 3.9.6 + request-light: 0.5.8 + vscode-json-languageservice: 4.1.8 + vscode-languageserver: 9.0.1 + vscode-languageserver-textdocument: 1.0.14 + vscode-languageserver-types: 3.17.5 + vscode-uri: 3.2.0 + yaml: 2.8.3 + + yaml@2.8.3: {} + yaml@2.9.0: {} yargs-parser@20.2.9: {} diff --git a/tools/build-font/package.json b/tools/build-font/package.json index 88134db75..114b8a55a 100644 --- a/tools/build-font/package.json +++ b/tools/build-font/package.json @@ -7,7 +7,8 @@ "type": "module", "scripts": { "start": "node ./src/main.ts", - "test": "vitest run" + "test": "vitest run", + "typecheck": "tsc" }, "keywords": [], "author": "", diff --git a/tools/build-font/src/buildFont.spec.ts b/tools/build-font/src/buildFont.spec.ts index c50393132..de5d73abb 100644 --- a/tools/build-font/src/buildFont.spec.ts +++ b/tools/build-font/src/buildFont.spec.ts @@ -18,6 +18,7 @@ describe('buildFont', () => { }); it('calls svgtofont with expected settings and unicode resolver', async () => { + // @ts-expect-error Mocking svgtofont for testing purposes vi.mocked(svgtofont).mockResolvedValue(undefined); await buildFont({ @@ -35,13 +36,23 @@ describe('buildFont', () => { const [options] = vi.mocked(svgtofont).mock.calls[0]; + if (options === undefined) throw new Error('svgtofont options are undefined'); + expect(options.src).toBe('/icons'); expect(options.dist).toBe('/dist'); expect(options.fontName).toBe('lucide'); expect(options.classNamePrefix).toBe('icon'); expect(options.addLigatures).toBe(true); - expect(options.getIconUnicode('camera')).toEqual([String.fromCharCode(57400), 57400]); - expect(() => options.getIconUnicode('missing')).toThrow('No codepoint found for icon: missing'); + const getIconUnicode = options.getIconUnicode; + + if (getIconUnicode === undefined) { + throw new Error('getIconUnicode is undefined'); + } + + expect(getIconUnicode('camera', '57400', 0)).toEqual([String.fromCharCode(57400), 57400]); + expect(() => getIconUnicode('missing', '57400', 0)).toThrow( + 'No codepoint found for icon: missing', + ); }); it('logs errors from svgtofont and still finishes timing', async () => { diff --git a/tools/build-font/tsconfig.json b/tools/build-font/tsconfig.json index a9a7df10d..e0b361b59 100644 --- a/tools/build-font/tsconfig.json +++ b/tools/build-font/tsconfig.json @@ -10,6 +10,7 @@ "esModuleInterop": true, "lib": ["esnext"], "resolveJsonModule": true, + "skipLibCheck": true, "allowImportingTsExtensions": true, "noEmit": true, "sourceMap": true,