refactor: use ~ as import alias

This commit is contained in:
鲁树人 2023-05-09 01:22:00 +01:00
parent d2ffba5495
commit 6afc825222
7 changed files with 32 additions and 12 deletions

View File

@ -22,6 +22,7 @@
"react-redux": "^8.0.5" "react-redux": "^8.0.5"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^20.1.1",
"@types/react": "^18.0.28", "@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11", "@types/react-dom": "^18.0.11",
"@typescript-eslint/eslint-plugin": "^5.57.1", "@typescript-eslint/eslint-plugin": "^5.57.1",

View File

@ -33,6 +33,9 @@ dependencies:
version: 8.0.5(@types/react-dom@18.0.11)(@types/react@18.0.28)(react-dom@18.2.0)(react@18.2.0)(redux@4.2.1) version: 8.0.5(@types/react-dom@18.0.11)(@types/react@18.0.28)(react-dom@18.2.0)(react@18.2.0)(redux@4.2.1)
devDependencies: devDependencies:
'@types/node':
specifier: ^20.1.1
version: 20.1.1
'@types/react': '@types/react':
specifier: ^18.0.28 specifier: ^18.0.28
version: 18.0.28 version: 18.0.28
@ -65,7 +68,7 @@ devDependencies:
version: 5.0.2 version: 5.0.2
vite: vite:
specifier: ^4.3.2 specifier: ^4.3.2
version: 4.3.2 version: 4.3.2(@types/node@20.1.1)
packages: packages:
@ -1867,6 +1870,10 @@ packages:
resolution: {integrity: sha512-r22s9tAS7imvBt2lyHC9B8AGwWnXaYb1tY09oyLkXDs4vArpYJzw09nj8MLx5VfciBPGIb+ZwG0ssYnEPJxn/g==} resolution: {integrity: sha512-r22s9tAS7imvBt2lyHC9B8AGwWnXaYb1tY09oyLkXDs4vArpYJzw09nj8MLx5VfciBPGIb+ZwG0ssYnEPJxn/g==}
dev: false dev: false
/@types/node@20.1.1:
resolution: {integrity: sha512-uKBEevTNb+l6/aCQaKVnUModfEMjAl98lw2Si9P5y4hLu9tm6AlX2ZIoXZX6Wh9lJueYPrGPKk5WMCNHg/u6/A==}
dev: true
/@types/parse-json@4.0.0: /@types/parse-json@4.0.0:
resolution: {integrity: sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==} resolution: {integrity: sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==}
dev: false dev: false
@ -2037,7 +2044,7 @@ packages:
'@babel/plugin-transform-react-jsx-self': 7.21.0(@babel/core@7.21.8) '@babel/plugin-transform-react-jsx-self': 7.21.0(@babel/core@7.21.8)
'@babel/plugin-transform-react-jsx-source': 7.19.6(@babel/core@7.21.8) '@babel/plugin-transform-react-jsx-source': 7.19.6(@babel/core@7.21.8)
react-refresh: 0.14.0 react-refresh: 0.14.0
vite: 4.3.2 vite: 4.3.2(@types/node@20.1.1)
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
dev: true dev: true
@ -3388,7 +3395,7 @@ packages:
react: 18.2.0 react: 18.2.0
dev: false dev: false
/vite@4.3.2: /vite@4.3.2(@types/node@20.1.1):
resolution: {integrity: sha512-9R53Mf+TBoXCYejcL+qFbZde+eZveQLDYd9XgULILLC1a5ZwPaqgmdVpL8/uvw2BM/1TzetWjglwm+3RO+xTyw==} resolution: {integrity: sha512-9R53Mf+TBoXCYejcL+qFbZde+eZveQLDYd9XgULILLC1a5ZwPaqgmdVpL8/uvw2BM/1TzetWjglwm+3RO+xTyw==}
engines: {node: ^14.18.0 || >=16.0.0} engines: {node: ^14.18.0 || >=16.0.0}
hasBin: true hasBin: true
@ -3413,6 +3420,7 @@ packages:
terser: terser:
optional: true optional: true
dependencies: dependencies:
'@types/node': 20.1.1
esbuild: 0.17.18 esbuild: 0.17.18
postcss: 8.4.23 postcss: 8.4.23
rollup: 3.21.5 rollup: 3.21.5

View File

@ -1,5 +1,5 @@
import { ConcurrentQueue } from '../util/ConcurrentQueue'; import { ConcurrentQueue } from '~/util/ConcurrentQueue';
import { WorkerClientBus } from '../util/WorkerEventBus'; import { WorkerClientBus } from '~/util/WorkerEventBus';
import { DECRYPTION_WORKER_ACTION_NAME } from './constants'; import { DECRYPTION_WORKER_ACTION_NAME } from './constants';
// TODO: Worker pool? // TODO: Worker pool?

View File

@ -1,4 +1,4 @@
import { WorkerServerBus } from '../util/WorkerEventBus'; import { WorkerServerBus } from '~/util/WorkerEventBus';
import { DECRYPTION_WORKER_ACTION_NAME } from './constants'; import { DECRYPTION_WORKER_ACTION_NAME } from './constants';
const bus = new WorkerServerBus(); const bus = new WorkerServerBus();

View File

@ -1,7 +1,7 @@
import { createSlice, createAsyncThunk } from '@reduxjs/toolkit'; import { createSlice, createAsyncThunk } from '@reduxjs/toolkit';
import type { PayloadAction } from '@reduxjs/toolkit'; import type { PayloadAction } from '@reduxjs/toolkit';
import type { RootState } from '../../store'; import type { RootState } from '~/store';
import { decryptionQueue } from '../../decrypt-worker/client'; import { decryptionQueue } from '~/decrypt-worker/client';
export enum ProcessState { export enum ProcessState {
UNTOUCHED = 'UNTOUCHED', UNTOUCHED = 'UNTOUCHED',

View File

@ -17,7 +17,12 @@
"strict": true, "strict": true,
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true, "noUnusedParameters": true,
"noFallthroughCasesInSwitch": true "noFallthroughCasesInSwitch": true,
"baseUrl": ".",
"paths": {
"~/*": ["src/*"]
}
}, },
"include": ["src"], "include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }] "references": [{ "path": "./tsconfig.node.json" }]

View File

@ -1,7 +1,13 @@
import { defineConfig } from 'vite' import path from 'path';
import react from '@vitejs/plugin-react' import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [react()], plugins: [react()],
}) resolve: {
alias: {
'~': path.resolve(__dirname, 'src'),
},
},
});