diff --git a/README.md b/README.md index 9417137..766adcc 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![codecov](https://codecov.io/gh/ha0z1/idmp/branch/main/graph/badge.svg)](https://app.codecov.io/gh/ha0z1/idmp/blob/main/src%2Findex.ts) [![contributors](https://img.shields.io/github/contributors/ha0z1/idmp)](https://github.com/ha0z1/idmp/graphs/contributors) [![LICENSE](https://img.shields.io/npm/l/idmp)](https://github.com/ha0z1/idmp/blob/main/LICENSE) -[![Size](https://img.shields.io/bundlephobia/minzip/idmp.svg)](https://unpkg.com/idmp/dist/) +[![Size](https://img.shields.io/bundlephobia/minzip/idmp.svg)](https://cdn.jsdelivr.net/npm/idmp/+esm) An elegant library to solve duplicate and concurrent calls for idempotent functions, pure function. Less than 1 KB after Gzip diff --git a/README.zh-CN.md b/README.zh-CN.md index e17c514..1517ead 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -5,7 +5,7 @@ [![codecov](https://codecov.io/gh/ha0z1/idmp/branch/main/graph/badge.svg)](https://app.codecov.io/gh/ha0z1/idmp/blob/main/src%2Findex.ts) [![contributors](https://img.shields.io/github/contributors/ha0z1/idmp)](https://github.com/ha0z1/idmp/graphs/contributors) [![LICENSE](https://img.shields.io/npm/l/idmp)](https://github.com/ha0z1/idmp/blob/main/LICENSE) -[![Size](https://img.shields.io/bundlephobia/minzip/idmp.svg)](https://unpkg.com/idmp/dist/) +[![Size](https://img.shields.io/bundlephobia/minzip/idmp.svg)](https://cdn.jsdelivr.net/npm/idmp/+esm) 一个优雅地解决幂等(idempotent) 函数的重复和并发调用的小库,纯函数,Gzip 后不到 1 KB diff --git a/package.json b/package.json index 667c224..d8c7c57 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "idmp", - "version": "1.9.0", + "version": "1.9.1", "keywords": [ "cache response", "swr without hooks", @@ -49,6 +49,7 @@ "typescript": "^5.3.3", "vite": "^5.0.10", "vite-node": "^1.1.0", + "vite-plugin-banner": "^0.7.1", "vite-plugin-dts": "^3.6.4", "vitest": "^1.1.0" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c6db4b5..c9960e3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -47,6 +47,9 @@ devDependencies: vite-node: specifier: ^1.1.0 version: 1.1.0(@types/node@20.10.5)(terser@5.24.0) + vite-plugin-banner: + specifier: ^0.7.1 + version: 0.7.1 vite-plugin-dts: specifier: ^3.6.4 version: 3.6.4(@types/node@20.10.5)(typescript@5.3.3)(vite@5.0.10) @@ -3100,6 +3103,10 @@ packages: - terser dev: true + /vite-plugin-banner@0.7.1: + resolution: {integrity: sha512-Bww2Xd5tOGsZ1yZ9rQiGneryvsL1u86znPrqeQjCsXPsG72pnSdV5lcQA+cy8UNDguMqyTJiCevlNUbLnT85UA==} + dev: true + /vite-plugin-dts@3.6.4(@types/node@20.10.5)(typescript@5.3.3)(vite@5.0.10): resolution: {integrity: sha512-yOVhUI/kQhtS6lCXRYYLv2UUf9bftcwQK9ROxCX2ul17poLQs02ctWX7+vXB8GPRzH8VCK3jebEFtPqqijXx6w==} engines: {node: ^14.18.0 || >=16.0.0} diff --git a/scripts/build.ts b/scripts/build.ts index 8529d24..bdaea28 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -2,6 +2,8 @@ import { build, mergeConfig, type InlineConfig } from 'vite' // import { defineConfig } from 'vite' import react from '@vitejs/plugin-react-swc' import dts from 'vite-plugin-dts' +import banner from 'vite-plugin-banner' +import { version } from '../package.json' type DeepPartial = T extends object ? { @@ -12,7 +14,13 @@ const buildFile = async (buildOptions: DeepPartial) => { await build( mergeConfig( { - plugins: [react(), dts()], + plugins: [ + react(), + dts(), + banner( + `/*! idmp v${version} | (c) github/haozi | MIT */`, + ), + ], build: { sourcemap: false, // target: "chrome51",