diff --git a/package.json b/package.json index 82f3225..8f2460b 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ }, "license": "MIT", "devDependencies": { + "@astropub/config-to-alias": "^1.0.1", "@unocss/preset-attributify": "^0.58.3", "@unocss/reset": "^0.58.3", "sass": "^1.70.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1cdf488..7b3cc8d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,6 +16,9 @@ dependencies: version: 1.8.10 devDependencies: + '@astropub/config-to-alias': + specifier: ^1.0.1 + version: 1.0.1(vite@4.5.2) '@unocss/preset-attributify': specifier: ^0.58.3 version: 0.58.3 @@ -59,6 +62,15 @@ packages: resolution: {integrity: sha512-gFPqTG7otEJ8uP6wrhDv6mqwGWYZKNvAcCq6u9hOj0c+IKCEsY4L1oC9trPq2SaWIzAfHvqfBDxF591JkMf+kg==} dev: true + /@astropub/config-to-alias@1.0.1(vite@4.5.2): + resolution: {integrity: sha512-EgtXLol1m+d6n2X+3BZn/hHDlh+M0UVKm5bTtYyD8HzwASaXu5AzmkBQlBTCUHVhwmKca0M8VzBq6blVDMg+jw==} + peerDependencies: + vite: ^4 + dependencies: + tsconfig-resolver: 3.0.1 + vite: 4.5.2(sass@1.70.0) + dev: true + /@babel/code-frame@7.23.5: resolution: {integrity: sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==} engines: {node: '>=6.9.0'} @@ -696,6 +708,14 @@ packages: resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} dev: true + /@types/json5@0.0.30: + resolution: {integrity: sha512-sqm9g7mHlPY/43fcSNrCYfOeX9zkTTK+euO5E6+CVijSMm5tTjkVdwdqRkY3ljjIAf8679vps5jKUoJBCLsMDA==} + dev: true + + /@types/resolve@1.20.6: + resolution: {integrity: sha512-A4STmOXPhMUtHH+S6ymgE2GiBSMqf4oTvcQZMcHzokuTLVYzXTB8ttjcgxOVaAp2lGwEdzZ0J+cRbbeevQj1UQ==} + dev: true + /@unocss/astro@0.58.3(vite@4.5.2): resolution: {integrity: sha512-qJL+XkWYJhEIX4AmOtbfb2Zu4holTDpRscfvVci4T+2VWjyE3mgtsyNzi9ZChe/hdEPRa7g26gSpNQeMhjh/Kw==} peerDependencies: @@ -1183,6 +1203,10 @@ packages: dev: true optional: true + /function-bind@1.1.2: + resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + dev: true + /gensync@1.0.0-beta.2: resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} engines: {node: '>=6.9.0'} @@ -1217,6 +1241,13 @@ packages: engines: {node: '>=4'} dev: true + /hasown@2.0.0: + resolution: {integrity: sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==} + engines: {node: '>= 0.4'} + dependencies: + function-bind: 1.1.2 + dev: true + /html-entities@2.3.3: resolution: {integrity: sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==} dev: true @@ -1237,6 +1268,12 @@ packages: binary-extensions: 2.2.0 dev: true + /is-core-module@2.13.1: + resolution: {integrity: sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==} + dependencies: + hasown: 2.0.0 + dev: true + /is-extglob@2.1.1: resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} engines: {node: '>=0.10.0'} @@ -1445,6 +1482,10 @@ packages: engines: {node: '>=8'} dev: true + /path-parse@1.0.7: + resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} + dev: true + /pathe@1.1.2: resolution: {integrity: sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==} dev: true @@ -1490,6 +1531,15 @@ packages: picomatch: 2.3.1 dev: true + /resolve@1.22.8: + resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} + hasBin: true + dependencies: + is-core-module: 2.13.1 + path-parse: 1.0.7 + supports-preserve-symlinks-flag: 1.0.0 + dev: true + /reusify@1.0.4: resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} @@ -1584,6 +1634,11 @@ packages: engines: {node: '>=0.10.0'} dev: true + /strip-bom@4.0.0: + resolution: {integrity: sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==} + engines: {node: '>=8'} + dev: true + /strip-final-newline@2.0.0: resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} engines: {node: '>=6'} @@ -1596,6 +1651,11 @@ packages: has-flag: 3.0.0 dev: true + /supports-preserve-symlinks-flag@1.0.0: + resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} + engines: {node: '>= 0.4'} + dev: true + /to-fast-properties@2.0.0: resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} engines: {node: '>=4'} @@ -1613,6 +1673,22 @@ packages: engines: {node: '>=6'} dev: true + /tsconfig-resolver@3.0.1: + resolution: {integrity: sha512-ZHqlstlQF449v8glscGRXzL6l2dZvASPCdXJRWG4gHEZlUVx2Jtmr+a2zeVG4LCsKhDXKRj5R3h0C/98UcVAQg==} + dependencies: + '@types/json5': 0.0.30 + '@types/resolve': 1.20.6 + json5: 2.2.3 + resolve: 1.22.8 + strip-bom: 4.0.0 + type-fest: 0.13.1 + dev: true + + /type-fest@0.13.1: + resolution: {integrity: sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==} + engines: {node: '>=10'} + dev: true + /typescript@4.9.5: resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==} engines: {node: '>=4.2.0'} diff --git a/src/App.tsx b/src/App.tsx index b882223..e215178 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,8 +1,8 @@ -import ABCPlayer from './components/Player'; -import CustomMenu from './components/Menu'; -import ThemeToggle from './components/ThemeToggle'; -import { ListFile, MusicFile } from './type'; -import { useFetch } from './hooks/useFetch'; +import ABCPlayer from '𝄞/components/Player'; +import CustomMenu from '𝄞/components/Menu'; +import ThemeToggle from '𝄞/components/ThemeToggle'; +import { ListFile, MusicFile } from '𝄞/type'; +import { useFetch } from '𝄞/hooks/useFetch'; import { Show } from 'solid-js'; const App = () => { diff --git a/src/components/Menu/index.tsx b/src/components/Menu/index.tsx index 1e6eb46..c21f325 100644 --- a/src/components/Menu/index.tsx +++ b/src/components/Menu/index.tsx @@ -1,5 +1,5 @@ import { Show, For, createSignal } from "solid-js"; -import { ListFile } from "../../type"; +import { ListFile } from "𝄞/type"; const getFileName = (path: string) => path.match(/\/(.*?).abc$/)?.at(-1); const [getCurrentName, setCurrentName] = createSignal("index"); diff --git a/src/components/Message/index.ts b/src/components/Message/index.ts index 8e2aacc..745bdeb 100644 --- a/src/components/Message/index.ts +++ b/src/components/Message/index.ts @@ -1,4 +1,4 @@ -import { sleep } from "./../../utils"; +import { sleep } from "𝄞/utils"; export class Launcher { private queue: HTMLDivElement; diff --git a/src/components/Player/index.tsx b/src/components/Player/index.tsx index cdd9cfe..acaca42 100644 --- a/src/components/Player/index.tsx +++ b/src/components/Player/index.tsx @@ -1,9 +1,9 @@ import { Accessor, createEffect, on, createSignal } from "solid-js"; -import message from "./../Message"; +import message from "𝄞/components/Message"; import abcjs from "abcjs"; import CursorControl from "./cursorControl"; import SynthController from "./synthController"; -import { name, key } from "./../../utils"; +import { name, key } from "𝄞/utils"; import "./index.scss"; const ABCPlayer = (props: { getMusicData: Accessor }) => { diff --git a/src/components/ThemeToggle/index.tsx b/src/components/ThemeToggle/index.tsx index 2e93735..3ff9b0a 100644 --- a/src/components/ThemeToggle/index.tsx +++ b/src/components/ThemeToggle/index.tsx @@ -1,6 +1,6 @@ import type { Component } from "solid-js"; -import moon from "./../../assets/moon.svg?raw"; -import sun from "./../../assets/sun.svg?raw"; +import moon from "𝄞/assets/moon.svg?raw"; +import sun from "𝄞/assets/sun.svg?raw"; import "./index.scss"; const themeTuple = ["dark", "light"] as const; diff --git a/src/main.tsx b/src/main.tsx index 0015e39..ba44ac1 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,10 +1,10 @@ /* @refresh reload */ import { render } from "solid-js/web"; import "abcjs/abcjs-audio.css"; -import App from "./App"; +import App from "𝄞/App"; import "@unocss/reset/normalize.css"; import "uno.css"; -import "./index.scss"; +import "𝄞/index.scss"; const root = document.getElementById("root"); diff --git a/tsconfig.json b/tsconfig.json index 5d2faf0..6788ad1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,6 +5,10 @@ "moduleResolution": "node", "allowSyntheticDefaultImports": true, "esModuleInterop": true, + "baseUrl": ".", + "paths": { + "𝄞/*": ["src/*"] + }, "jsx": "preserve", "jsxImportSource": "solid-js", "types": ["vite/client"], diff --git a/vite.config.ts b/vite.config.ts index 8ca4b49..2cd3812 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,7 +1,8 @@ -import { defineConfig } from 'vite'; -import solid from 'vite-plugin-solid'; +import { defineConfig } from "vite"; +import solid from "vite-plugin-solid"; import uno from "unocss/vite"; +import alias from '@astropub/config-to-alias/vite'; export default defineConfig({ - plugins: [uno(), solid()], + plugins: [uno(), solid(), alias()], });