# @aiwheels/rollup-plugin-build-config

> > TODO:生成 rollup 打包配置工具

Latest version **0.0.2** (published 2022-01-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install @aiwheels/rollup-plugin-build-config
pnpm add @aiwheels/rollup-plugin-build-config
yarn add @aiwheels/rollup-plugin-build-config
bun add @aiwheels/rollup-plugin-build-config
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2022-01-14 |
| First published | 2022-01-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 21.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | aaron-zm |

## Links

- npm: https://www.npmjs.com/package/@aiwheels/rollup-plugin-build-config
- npm.io page: https://npm.io/package/@aiwheels/rollup-plugin-build-config

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ^4.17.21

## Recent versions

- 0.0.2 (latest) — 2022-01-14

## README

# api-js 工具

## 安装

```shell
# 通过 npm 安装
npm i @aiwheels/axios-api-js -S

# 通过 yarn 安装
yarn add @aiwheels/axios-api-js -S

# 通过 pnpm 安装
pnpm add @aiwheels/axios-api-js -S
```

## methods

## 示例代码

```js
import { createApiService } from '@aiwheels/axios-api-js';
import axios from 'axios';

const http = axios.create();

const createApi = createApiService(http);

createApi({
  url: 'xxx',
  method: 'get',
}).request({
  body: {},
});
```

## API

### createApiService

```ts
interface ApiConfig {
  url: string | ((path: ApiRequestConfig['path']) => string);
  method: Method;
  cache: boolean;
  cacheTime: number;
  headers: AxiosRequestConfig['headers'];
  axiosConfig: AxiosRequestConfig;
}

interface ApiRequestConfig<T = any> {
  headers?: AxiosRequestConfig<T>['headers'];
  path?: Record<string, string>;
  query?: Record<string, string>;
  body?: AxiosRequestConfig<T>['data'];
  axiosConfig?: AxiosRequestConfig<T>;
}

class Api {
  http: AxiosInstance;

  config: ApiConfig;

  cache: Record<
    string,
    {
      promise: Promise<any>;
      expireTime: number | null;
    }
  >;

  constructor(http: AxiosInstance, config: ApiConfig): Api;

  request<T = never, R = AxiosResponse<T>>(requestConfig?: ApiRequestConfig<T>): Promise<R>;

  clearCache(): void;
}

function createApiService(http: AxiosInstance): (apiConfig: ApiConfig) => Api;
```

---
_Source: https://npm.io/package/@aiwheels/rollup-plugin-build-config · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
