# @dinofe/xt-core

> 提取的一些常用工具方法，包括：Axios二次封装、基础方法等。

Latest version **1.1.0** (published 2025-06-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @dinofe/xt-core
pnpm add @dinofe/xt-core
yarn add @dinofe/xt-core
bun add @dinofe/xt-core
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2025-06-29 |
| First published | 2021-06-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 1.6 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | JohnieXu |
| Maintainers | johniexu |
| Keywords | utils, business lib, http |

## Links

- npm: https://www.npmjs.com/package/@dinofe/xt-core
- Repository: https://github.com/idinofe/xt-core
- Issues: https://github.com/idinofe/xt-core/issues
- npm.io page: https://npm.io/package/@dinofe/xt-core

## Dependencies (6)

- [qs](https://npm.io/package/qs.md) ^6.11.2
- [dexie](https://npm.io/package/dexie.md) ^3.0.3
- [big.js](https://npm.io/package/big.js.md) ^6.2.1
- [apisauce](https://npm.io/package/apisauce.md) ^3.0.1
- [decrypt-core](https://npm.io/package/decrypt-core.md) ^1.2.2
- [@types/big.js](https://npm.io/package/@types/big.js.md) ^6.1.6

## Recent versions

- 1.1.0 (latest) — 2025-06-29
- 1.0.0-7 (next) — 2023-10-29
- 1.1.0-1 — 2025-06-22
- 1.1.0-0 — 2025-06-22
- 1.0.0-6 — 2023-10-13
- 1.0.0-5 — 2023-09-30
- 1.0.0-4 — 2023-09-23
- 1.0.0-3 — 2023-09-14
- 1.0.0-2 — 2023-09-05
- 1.0.0-1 — 2023-08-29
- 1.0.0-0 — 2023-08-16
- 0.0.12 — 2023-07-13
- 0.0.11 — 2023-07-13
- 0.0.10 — 2023-07-13
- 0.0.5 — 2023-07-08
- … 4 more at https://npm.io/package/@dinofe/xt-core/versions

## README

<div align="center" style="margin: 16px auto;">
<img src="tsdoc/.vuepress/public/logo_full.jpg" style="width: 400px;">
<p>提取的一些常用工具方法，包括：Axios二次封装、基础方法等。</p>

![npm (scoped)](https://img.shields.io/npm/v/%40dinofe/xt-core)
![npm](https://img.shields.io/npm/dm/%40dinofe/xt-core)
![GitHub contributors](https://img.shields.io/github/contributors/idinotes/xt-core)
</div>

## 🚀 特性

- 🎪[在线文档和 demo](https://idinofe.github.io/xt-core/)
- 🌎无编译器场景：可直接使用 CDN 版本
- 🦾类型支持良好：使用 [TypeScript](https://www.typescriptlang.org/)，[TS Docs](https://github.com/microsoft/tsdoc) 编写
- ⚡摇树优化：按功能模块定义导出可通过按需引入模块减少打包体积，支持 5 大模块：`common` `http` `url` `web` `wechat`

## 📦 安装

```bash
npm i @dinofe/xt-core
```

### 示例

- [Node.js](./example/node/)
- [CDN](https://jsfiddle.net/johniexu/1vhrydpe/2/)
- [React](./example/react/)
- [Vue2](./example/vue2/)
- [Vue3](./example/vue3/)

### CDN

```html
<script src="https://unpkg.com/@dinofe/xt-core@next/dist/umd/xt-core.min.js"></script>
```

引入此脚本之后，所有 API 都会挂载到 `widnow.XtCore` 上。

## 🦄 使用

支持按需引入各模块自己的 API

从 `wechat` 模块引入 `genOAuthUrl` 方法：

```js
import { genOAuthUrl } from '@dinofe/xt-core/wechat'

const wechatOptions = {
  wx_appid: '123456',
  wx_component_appid: '1123456',
  wx_scope: 'snsapi_base',
  redirect_url: 'https://www.github.com',
  state: '0'
}
const url = genOAuthUrl(wechatOptions)
console.log(url)
```

5 大模块导出的所有 API 都可以直接引入

直接导引入 `genOAuthUrl` 方法：

```js
import { genOAuthUrl } from '@dinofe/xt-core'
// ... 用法和上面相同
```

支持的方法列表请查看 [API 文档](https://idinofe.github.io/xt-core/api/xt-core.html#functions)

## 🧱 参与贡献

本地开发环境要求 Node.js 版本 >= 18.x，推荐使用 v20.x。

<details>
  <summary>脚本命令</summary>

1. 启动项目

  ```bash
  npm run vitest
  ```

  或者

  ```bash
  npm run vitest:ui
  ```

2. 构建打包

  ```bash
  npm run build
  ```

3. 预览文档

  编译项目，生成类型声明

  ```bash
  npm run docs:build
  ```

  启动文档本地预览

  ```bash
  cd ./tsdoc
  npm run docs:dev
  ```

  > 说明：如果源码有变更需要手动重新执行 `npm run docs:build`

4. 发布测试包（预发布）

  > 需要先切换到npm官方源、并登录账号

  ```bash
  npm run releaseit
  ```

  或者

  ```bash
  npx release-it -i patch --preRelease
  ```
</details>

<details>
  <summary>使用预览版</summary>
  
  预览版使用 `next` tag 发布，安装命令如下：

  ```bash
  npm i @dinofe/xt-core@next
  ```
</details>

## 📄 开源协议

[MIT License](./LICENSE)

---
_Source: https://npm.io/package/@dinofe/xt-core · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
