@rainte/js 0.0.16 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5007 -1901
- package/dist/index.umd.cjs +8 -6
- package/package.json +29 -25
- package/.prettierrc.json +0 -8
- package/dist/types/lib/index.d.ts +0 -7
- package/dist/types/src/date/index.d.ts +0 -11
- package/dist/types/src/fast/index.d.ts +0 -8
- package/dist/types/src/file/index.d.ts +0 -3
- package/dist/types/src/hash/index.d.ts +0 -1
- package/dist/types/src/http/axios.d.ts +0 -6
- package/dist/types/src/http/index.d.ts +0 -6
- package/dist/types/src/json/index.d.ts +0 -3
- package/dist/types/src/main.d.ts +0 -1
- package/dist/types/src/storage/index.d.ts +0 -16
- package/dist/types/vite.config.d.ts +0 -2
- package/index.html +0 -13
- package/lib/index.ts +0 -7
- package/public/vite.svg +0 -1
- package/src/date/index.ts +0 -19
- package/src/fast/index.ts +0 -27
- package/src/file/index.ts +0 -25
- package/src/hash/index.ts +0 -24
- package/src/http/axios.ts +0 -66
- package/src/http/index.ts +0 -21
- package/src/json/index.ts +0 -14
- package/src/main.ts +0 -21
- package/src/storage/index.ts +0 -28
- package/src/vite-env.d.ts +0 -1
- package/tsconfig.json +0 -26
- package/vite.config.ts +0 -12
package/package.json
CHANGED
|
@@ -1,25 +1,29 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@rainte/js",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@rainte/js",
|
|
3
|
+
"version": "0.0.18",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist",
|
|
7
|
+
"index.d.ts"
|
|
8
|
+
],
|
|
9
|
+
"main": "./dist/index.umd.cjs",
|
|
10
|
+
"module": "./dist/index.js",
|
|
11
|
+
"types": "./dist/types/lib/index.d.ts",
|
|
12
|
+
"scripts": {
|
|
13
|
+
"dev": "vite",
|
|
14
|
+
"build": "tsc && vite build",
|
|
15
|
+
"release": "pnpm build && npm version patch && npm publish --access public --registry=https://registry.npmjs.org"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"axios": "^1.8.3",
|
|
19
|
+
"dayjs": "^1.11.13",
|
|
20
|
+
"dexie": "^4.0.11",
|
|
21
|
+
"jsan": "^3.1.14"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/jsan": "^3.1.5",
|
|
25
|
+
"@types/node": "^22.13.10",
|
|
26
|
+
"typescript": "^5.8.2",
|
|
27
|
+
"vite": "^6.2.2"
|
|
28
|
+
}
|
|
29
|
+
}
|
package/.prettierrc.json
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * as date from '../src/date';
|
|
2
|
-
export * as fast from '../src/fast';
|
|
3
|
-
export * as file from '../src/file';
|
|
4
|
-
export * as hash from '../src/hash';
|
|
5
|
-
export * as http from '../src/http';
|
|
6
|
-
export * as json from '../src/json';
|
|
7
|
-
export * as storage from '../src/storage';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare const find: (list: any[], value: any, label?: string) => any;
|
|
2
|
-
export declare const url: {
|
|
3
|
-
search: () => URLSearchParams;
|
|
4
|
-
open: (url?: string | URL, target?: string, features?: string) => void;
|
|
5
|
-
};
|
|
6
|
-
export declare const sleep: (ms: number) => Promise<unknown>;
|
|
7
|
-
export declare const log: (message: any, type?: string) => void;
|
|
8
|
-
export declare const fail: (message: string) => never;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const SHA256: (input: unknown, toJson?: Boolean) => Promise<any>;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const ACCESS_TOKEN = "access_token";
|
|
2
|
-
export declare const message: (data: any, text?: string) => any;
|
|
3
|
-
export declare const axios: import("axios").AxiosInstance;
|
|
4
|
-
export declare const tokenRequestInterceptor: () => number;
|
|
5
|
-
export declare const responseInterceptor: (onRejected?: ((error: any) => any) | null) => number;
|
|
6
|
-
export declare const retry: (error: any, refreshURL: string, refreshRequest: () => Promise<any>) => Promise<unknown>;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
export * from './axios';
|
|
3
|
-
export declare const get: (url: string, params?: Record<string, any>) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
4
|
-
export declare const post: (url: string, data?: Record<string, any>) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
5
|
-
export declare const download: (config: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
6
|
-
export declare const request: (config: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { Options } from 'jsan';
|
|
2
|
-
export declare const stringify: (value?: unknown, replacer?: (key: string, value: unknown) => unknown | Array<number | string> | null, space?: string | number, _options?: Options | boolean) => string;
|
|
3
|
-
export declare const parse: (text: string, reviver?: (key: string, value: unknown) => unknown) => unknown;
|
package/dist/types/src/main.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export declare const session: {
|
|
2
|
-
getRaw: (key: string, defaultValue?: any) => any;
|
|
3
|
-
setRaw: (key: string, value: string) => void;
|
|
4
|
-
get: (key: string, defaultValue?: any) => any;
|
|
5
|
-
set: (key: string, value: any) => void;
|
|
6
|
-
del: (key: string) => void;
|
|
7
|
-
clear: () => void;
|
|
8
|
-
};
|
|
9
|
-
export declare const local: {
|
|
10
|
-
getRaw: (key: string, defaultValue?: any) => any;
|
|
11
|
-
setRaw: (key: string, value: string) => void;
|
|
12
|
-
get: (key: string, defaultValue?: any) => any;
|
|
13
|
-
set: (key: string, value: any) => void;
|
|
14
|
-
del: (key: string) => void;
|
|
15
|
-
clear: () => void;
|
|
16
|
-
};
|
package/index.html
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>Rainte</title>
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<div id="app"></div>
|
|
11
|
-
<script type="module" src="/src/main.ts"></script>
|
|
12
|
-
</body>
|
|
13
|
-
</html>
|
package/lib/index.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * as date from '../src/date'
|
|
2
|
-
export * as fast from '../src/fast'
|
|
3
|
-
export * as file from '../src/file'
|
|
4
|
-
export * as hash from '../src/hash'
|
|
5
|
-
export * as http from '../src/http'
|
|
6
|
-
export * as json from '../src/json'
|
|
7
|
-
export * as storage from '../src/storage'
|
package/public/vite.svg
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/src/date/index.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import dayjs from 'dayjs'
|
|
2
|
-
import customParseFormat from 'dayjs/plugin/customParseFormat'
|
|
3
|
-
import duration from 'dayjs/plugin/duration'
|
|
4
|
-
import utc from 'dayjs/plugin/utc'
|
|
5
|
-
|
|
6
|
-
dayjs.extend(customParseFormat)
|
|
7
|
-
dayjs.extend(duration)
|
|
8
|
-
dayjs.extend(utc)
|
|
9
|
-
|
|
10
|
-
export { dayjs }
|
|
11
|
-
export const FORMAT = {
|
|
12
|
-
DATETIME: 'YYYY-MM-DD HH:mm:ss',
|
|
13
|
-
DATE: 'YYYY-MM-DD',
|
|
14
|
-
TIME: 'HH:mm:ss',
|
|
15
|
-
YEAR: 'YYYY',
|
|
16
|
-
MONTH: 'YYYY-MM',
|
|
17
|
-
HOUR: 'YYYY-MM-DD HH',
|
|
18
|
-
MINUTE: 'YYYY-MM-DD HH:mm'
|
|
19
|
-
}
|
package/src/fast/index.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export const find = (list: any[], value: any, label = '') => {
|
|
2
|
-
return (
|
|
3
|
-
list.find((item: any) => {
|
|
4
|
-
return item.value == (Array.isArray(value) ? value[0] : value)
|
|
5
|
-
})?.label ?? label
|
|
6
|
-
)
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const url = {
|
|
10
|
-
search: () => new URLSearchParams(location.search),
|
|
11
|
-
open: (url?: string | URL, target?: string, features?: string) => {
|
|
12
|
-
target = target || '_blank'
|
|
13
|
-
window.open(url, target, features)
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const sleep = (ms: number) => {
|
|
18
|
-
return new Promise((resolve) => setTimeout(resolve, ms))
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const log = (message: any, type?: string) => {
|
|
22
|
-
type ? console.log(type, message) : console.log(message)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const fail = (message: string) => {
|
|
26
|
-
throw new Error(message)
|
|
27
|
-
}
|
package/src/file/index.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export const toBase64 = (blob: Blob) => {
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
const reader = new FileReader()
|
|
4
|
-
reader.onload = (event) => resolve(event.target?.result)
|
|
5
|
-
reader.onerror = (event) => reject(event.target?.error)
|
|
6
|
-
reader.readAsDataURL(blob)
|
|
7
|
-
}).then((res) => res as string)
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const toBlob = (base64: string) => {
|
|
11
|
-
const character = atob(base64.split(',')[1] || base64)
|
|
12
|
-
const bytes = new Uint8Array(character.length)
|
|
13
|
-
for (let i = 0; i < character.length; i++) {
|
|
14
|
-
bytes[i] = character.charCodeAt(i)
|
|
15
|
-
}
|
|
16
|
-
return new Blob([bytes])
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const download = (filename: string, obj: Blob | MediaSource) => {
|
|
20
|
-
const link = document.createElement('a')
|
|
21
|
-
link.href = URL.createObjectURL(obj)
|
|
22
|
-
link.download = filename
|
|
23
|
-
link.click()
|
|
24
|
-
URL.revokeObjectURL(link.href)
|
|
25
|
-
}
|
package/src/hash/index.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as json from '../json'
|
|
2
|
-
|
|
3
|
-
let crypto: any
|
|
4
|
-
|
|
5
|
-
if (typeof window === 'undefined') {
|
|
6
|
-
crypto = require('crypto')
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const SHA256 = async (input: unknown, toJson: Boolean = true) => {
|
|
10
|
-
const text = toJson ? json.stringify(input) : input
|
|
11
|
-
|
|
12
|
-
if (typeof window !== 'undefined') {
|
|
13
|
-
const encoder = new TextEncoder()
|
|
14
|
-
const data = encoder.encode(text as string)
|
|
15
|
-
const hashBuffer = await crypto.subtle.digest('SHA-256', data)
|
|
16
|
-
const hashArray = Array.from(new Uint8Array(hashBuffer))
|
|
17
|
-
const hashHex = hashArray.map((byte) => byte.toString(16).padStart(2, '0')).join('')
|
|
18
|
-
return hashHex
|
|
19
|
-
} else {
|
|
20
|
-
const hash = crypto.createHash('sha256')
|
|
21
|
-
hash.update(text)
|
|
22
|
-
return hash.digest('hex')
|
|
23
|
-
}
|
|
24
|
-
}
|
package/src/http/axios.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import Axios from 'axios'
|
|
2
|
-
import { local } from '../storage'
|
|
3
|
-
|
|
4
|
-
export const ACCESS_TOKEN = 'access_token'
|
|
5
|
-
|
|
6
|
-
export const message = (data: any, text = '请求异常.') => {
|
|
7
|
-
return data.message || data.msg || text
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const axios = Axios.create({
|
|
11
|
-
baseURL: '',
|
|
12
|
-
timeout: 3000,
|
|
13
|
-
headers: { 'Content-Type': 'application/json' }
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
export const tokenRequestInterceptor = () => {
|
|
17
|
-
return axios.interceptors.request.use((config) => {
|
|
18
|
-
const token = local.get(ACCESS_TOKEN)
|
|
19
|
-
token && (config.headers.Authorization = `Bearer ${token}`)
|
|
20
|
-
return config
|
|
21
|
-
})
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const responseInterceptor = (onRejected?: ((error: any) => any) | null) => {
|
|
25
|
-
return axios.interceptors.response.use(
|
|
26
|
-
(response) => {
|
|
27
|
-
const data = response.data
|
|
28
|
-
if (response.status === 200) {
|
|
29
|
-
return data.data
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const error = new Error(message(data))
|
|
33
|
-
return onRejected ? onRejected(error) : Promise.reject(error)
|
|
34
|
-
},
|
|
35
|
-
(error) => {
|
|
36
|
-
return onRejected ? onRejected(error) : Promise.reject(error)
|
|
37
|
-
}
|
|
38
|
-
)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
let isRefreshing = false
|
|
42
|
-
let requests: any[] = []
|
|
43
|
-
|
|
44
|
-
export const retry = (error: any, refreshURL: string, refreshRequest: () => Promise<any>) => {
|
|
45
|
-
const { response } = error
|
|
46
|
-
|
|
47
|
-
if (response.config.url == refreshURL) {
|
|
48
|
-
isRefreshing = false
|
|
49
|
-
requests = []
|
|
50
|
-
return Promise.reject(error)
|
|
51
|
-
} else {
|
|
52
|
-
if (!isRefreshing) {
|
|
53
|
-
isRefreshing = true
|
|
54
|
-
refreshRequest()
|
|
55
|
-
.then(() => requests.forEach((cb) => cb()))
|
|
56
|
-
.finally(() => {
|
|
57
|
-
isRefreshing = false
|
|
58
|
-
requests = []
|
|
59
|
-
})
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return new Promise((resolve) => {
|
|
63
|
-
requests.push(() => resolve(axios(response.config)))
|
|
64
|
-
})
|
|
65
|
-
}
|
|
66
|
-
}
|
package/src/http/index.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { axios } from './axios'
|
|
2
|
-
import { AxiosRequestConfig } from 'axios'
|
|
3
|
-
|
|
4
|
-
export * from './axios'
|
|
5
|
-
|
|
6
|
-
export const get = (url: string, params?: Record<string, any>) => {
|
|
7
|
-
return request({ url, method: 'GET', params })
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const post = (url: string, data?: Record<string, any>) => {
|
|
11
|
-
return request({ url, method: 'POST', data })
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const download = (config: AxiosRequestConfig) => {
|
|
15
|
-
config.responseType = config.responseType || 'blob'
|
|
16
|
-
return request(config)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const request = (config: AxiosRequestConfig) => {
|
|
20
|
-
return axios.request(config)
|
|
21
|
-
}
|
package/src/json/index.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import jsan, { Options } from 'jsan'
|
|
2
|
-
|
|
3
|
-
export const stringify = (
|
|
4
|
-
value: unknown = null,
|
|
5
|
-
replacer?: (key: string, value: unknown) => unknown | Array<number | string> | null,
|
|
6
|
-
space?: string | number,
|
|
7
|
-
_options: Options | boolean = true
|
|
8
|
-
) => {
|
|
9
|
-
return jsan.stringify(value, replacer, space, _options)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const parse = (text: string, reviver?: (key: string, value: unknown) => unknown) => {
|
|
13
|
-
return jsan.parse(text, reviver)
|
|
14
|
-
}
|
package/src/main.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as date from './date'
|
|
2
|
-
import * as fast from './fast'
|
|
3
|
-
|
|
4
|
-
const make = (content: string, tag: keyof HTMLElementTagNameMap = 'li') => {
|
|
5
|
-
const ele = document.createElement(tag)
|
|
6
|
-
ele.textContent = content
|
|
7
|
-
return ele
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const list = [
|
|
11
|
-
{ label: 'label1', value: 'value1' },
|
|
12
|
-
{ label: 'label2', value: 'value2' },
|
|
13
|
-
{ label: 'label3', value: 'value3' }
|
|
14
|
-
]
|
|
15
|
-
|
|
16
|
-
document
|
|
17
|
-
.querySelector<HTMLDivElement>('#app')
|
|
18
|
-
?.appendChild(document.createElement('ul'))
|
|
19
|
-
?.appendChild(make(date.dayjs().format(date.FORMAT.DATETIME)))
|
|
20
|
-
?.appendChild(make(fast.find(list, 'value3', '无知')))
|
|
21
|
-
?.appendChild(make(fast.find(list, 'value0', '无知')))
|
package/src/storage/index.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as json from '../json'
|
|
2
|
-
|
|
3
|
-
const cache = (storage?: Storage) => {
|
|
4
|
-
return {
|
|
5
|
-
getRaw: (key: string, defaultValue: any = null) => {
|
|
6
|
-
return storage?.getItem(key) || defaultValue
|
|
7
|
-
},
|
|
8
|
-
setRaw: (key: string, value: string) => {
|
|
9
|
-
storage?.setItem(key, value)
|
|
10
|
-
},
|
|
11
|
-
get: (key: string, defaultValue: any = null) => {
|
|
12
|
-
const res = storage?.getItem(key)
|
|
13
|
-
return res ? json.parse(res) : defaultValue
|
|
14
|
-
},
|
|
15
|
-
set: (key: string, value: any) => {
|
|
16
|
-
storage?.setItem(key, json.stringify(value))
|
|
17
|
-
},
|
|
18
|
-
del: (key: string) => {
|
|
19
|
-
storage?.removeItem(key)
|
|
20
|
-
},
|
|
21
|
-
clear: () => {
|
|
22
|
-
storage?.clear()
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const session = cache(sessionStorage)
|
|
28
|
-
export const local = cache(localStorage)
|
package/src/vite-env.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
package/tsconfig.json
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"useDefineForClassFields": true,
|
|
5
|
-
"module": "ESNext",
|
|
6
|
-
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
"declaration": true, // 自动生成声明文件.
|
|
9
|
-
"declarationDir": "dist/types", // 声明文件输出的目录.
|
|
10
|
-
"emitDeclarationOnly": true, // 只输出声明文件,不转译ts文件.
|
|
11
|
-
|
|
12
|
-
/* Bundler mode */
|
|
13
|
-
"moduleResolution": "bundler",
|
|
14
|
-
"allowImportingTsExtensions": true,
|
|
15
|
-
"isolatedModules": true,
|
|
16
|
-
"moduleDetection": "force",
|
|
17
|
-
// "noEmit": true,
|
|
18
|
-
|
|
19
|
-
/* Linting */
|
|
20
|
-
"strict": true,
|
|
21
|
-
"noUnusedLocals": true,
|
|
22
|
-
"noUnusedParameters": true,
|
|
23
|
-
"noFallthroughCasesInSwitch": true
|
|
24
|
-
},
|
|
25
|
-
"include": ["src", "lib", "vite.config.ts"]
|
|
26
|
-
}
|