From ad0aa52f0fa3cf2e34806e24a368c7fea113fdee Mon Sep 17 00:00:00 2001 From: Viki Date: Fri, 14 Jun 2024 14:40:25 +0800 Subject: [PATCH] fix: fix import path --- scripts/update-hooks-data.ts | 1 + src/use-network/index.ts | 2 +- website/package.json | 14 ++++++++++---- website/pnpm-lock.yaml | 14 -------------- website/src/components/utils.ts | 2 +- website/uno.config.ts | 4 ++++ 6 files changed, 17 insertions(+), 20 deletions(-) diff --git a/scripts/update-hooks-data.ts b/scripts/update-hooks-data.ts index b604c7dd..3f042f04 100644 --- a/scripts/update-hooks-data.ts +++ b/scripts/update-hooks-data.ts @@ -2,6 +2,7 @@ import fs from 'node:fs' import path from 'node:path' import url from 'node:url' +// TODO: re-write use import.meta.dirname const __dirname = path.dirname(url.fileURLToPath(import.meta.url)) const srcDir = path.resolve(__dirname, '../src') const targetPath = path.resolve(__dirname, '../website/src/pages/search/hooks.json') diff --git a/src/use-network/index.ts b/src/use-network/index.ts index ce8b732e..f460333b 100644 --- a/src/use-network/index.ts +++ b/src/use-network/index.ts @@ -1,7 +1,7 @@ -import { useStableFn } from '@shined/use' import { useEffect, useRef } from 'react' import { useEventListener } from '../use-event-listener' import { useSetState } from '../use-set-state' +import { useStableFn } from '../use-stable-fn' import { useSupported } from '../use-supported' import { now } from '../utils' diff --git a/website/package.json b/website/package.json index 816ec363..6db2c071 100644 --- a/website/package.json +++ b/website/package.json @@ -27,9 +27,7 @@ "@docusaurus/module-type-aliases": "3.3.2", "@docusaurus/tsconfig": "3.3.2", "@docusaurus/types": "3.3.2", - "@iconify-json/mdi": "^1.1.66", "@unocss/postcss": "^0.59.4", - "@unocss/preset-icons": "^0.59.4", "gray-matter": "^4.0.3", "react": "^18.3.1", "react-dom": "^18.3.1", @@ -37,8 +35,16 @@ "unocss": "^0.59.4" }, "browserslist": { - "production": [">0.5%", "not dead", "not op_mini all"], - "development": ["last 3 chrome version", "last 3 firefox version", "last 5 safari version"] + "production": [ + ">0.5%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 3 chrome version", + "last 3 firefox version", + "last 5 safari version" + ] }, "engines": { "node": ">=18.0" diff --git a/website/pnpm-lock.yaml b/website/pnpm-lock.yaml index c9b5f428..47f6287b 100644 --- a/website/pnpm-lock.yaml +++ b/website/pnpm-lock.yaml @@ -46,15 +46,9 @@ devDependencies: '@docusaurus/types': specifier: 3.3.2 version: 3.3.2(react-dom@18.3.1)(react@18.3.1) - '@iconify-json/mdi': - specifier: ^1.1.66 - version: 1.1.66 '@unocss/postcss': specifier: ^0.59.4 version: 0.59.4(postcss@8.4.38) - '@unocss/preset-icons': - specifier: ^0.59.4 - version: 0.59.4 gray-matter: specifier: ^4.0.3 version: 4.0.3 @@ -2573,12 +2567,6 @@ packages: dependencies: '@hapi/hoek': 9.3.0 - /@iconify-json/mdi@1.1.66: - resolution: {integrity: sha512-7KPF2RVUUWav/hXCM8Ti/smqu3cmgePJpiX9CSkldiL+80+eBRBeKlc4vPOc9jhAItlqIU1vKsbKoPP0JIfgbg==} - dependencies: - '@iconify/types': 2.0.0 - dev: true - /@iconify/types@2.0.0: resolution: {integrity: sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==} dev: true @@ -9747,10 +9735,8 @@ time: /@docusaurus/tsconfig@3.3.2: '2024-05-03T14:30:07.590Z' /@docusaurus/types@3.3.2: '2024-05-03T14:30:07.929Z' /@formkit/auto-animate@0.8.2: '2024-04-10T16:20:50.136Z' - /@iconify-json/mdi@1.1.66: '2024-04-07T15:24:26.533Z' /@mdx-js/react@3.0.1: '2024-02-12T10:50:27.073Z' /@unocss/postcss@0.59.4: '2024-04-18T11:36:16.010Z' - /@unocss/preset-icons@0.59.4: '2024-04-18T11:35:26.193Z' /braces@3.0.3: '2024-05-21T08:59:11.390Z' /change-case@5.4.4: '2024-04-03T22:34:57.150Z' /clsx@2.1.1: '2024-04-23T05:26:04.645Z' diff --git a/website/src/components/utils.ts b/website/src/components/utils.ts index c1d0b9c1..14c01c0f 100644 --- a/website/src/components/utils.ts +++ b/website/src/components/utils.ts @@ -1,5 +1,5 @@ export const repoBase = 'https://github.com/sheinsight/use/blob/main/src' -export const OTP = () => Math.random().toString().slice(-6) +export const OTP = (): string => Math.random().toString().slice(-6) export const wait = (ms = 300, res: string = OTP()): Promise => new Promise((resolve) => setTimeout(() => resolve(res), ms)) diff --git a/website/uno.config.ts b/website/uno.config.ts index 00f741ce..62db7a32 100644 --- a/website/uno.config.ts +++ b/website/uno.config.ts @@ -9,6 +9,10 @@ export default defineConfig({ dark: { dark: '[data-theme="dark"]' }, }), presetIcons({ + cdn: 'https://esm.sh/', + // collections: { + // mdi: () => import('@iconify-json/mdi/icons.json').then((i) => i.default), + // }, extraProperties: { display: 'inline-block', },