deploy: v0.12 fix 存档key名

This commit is contained in:
2026-06-24 03:09:02 +00:00
parent 7a08d49fe3
commit e0a5281119
58743 changed files with 7297269 additions and 39505 deletions
+24
View File
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>
+97
View File
@@ -0,0 +1,97 @@
<p align="center">
<a href="https://github.com/childrentime/reactuse">
<img src="https://reactuse.com/img/og.png" alt="ReactUse - Collection of essential React Hooks" width="300">
</a>
</p>
<p align="center">
<img alt="NPM Version" src="https://img.shields.io/npm/v/@reactuses/core?style=for-the-badge&labelColor=24292e">
<img alt="NPM Downloads" src="https://img.shields.io/npm/dm/@reactuses/core?color=50a36f&label=&style=for-the-badge&labelColor=24292e">
<img alt="UnLicense" src="https://img.shields.io/npm/l/@reactuses/core?style=for-the-badge&labelColor=24292e">
<img alt="Tree Shaking Friendly" src="https://img.shields.io/badge/Tree%20Shaking-Friendly-brightgreen?style=for-the-badge&labelColor=24292e">
<img alt="TypeScript Support" src="https://img.shields.io/badge/TypeScript-Support-blue?style=for-the-badge&labelColor=24292e">
</p>
## MCP Support
If you want to use the MCP (Model Context Protocol) integration with reactuse, you can easily set it up with the following configuration. This allows you to run the `@reactuses/mcp` utility via `npx` for enhanced command-line support and automation.
Add the following to your configuration:
```json
"@reactuses/mcp": {
"command": "npx",
"args": ["-y", "@reactuses/mcp@latest"],
"type": "stdio"
}
```
## QuickStart
```tsx harmony
import { useToggle } from '@reactuses/core'
function Demo() {
const [on, toggle] = useToggle(true)
return (
<div>
<div>{on ? 'ON' : 'OFF'}</div>
<button onClick={toggle}>Toggle</button>
<button onClick={() => toggle(true)}>set ON</button>
<button onClick={() => toggle(false)}>set OFF</button>
</div>
)
}
```
Refer to [documentations](https://reactuse.com/) for more details.
---
## Who's Using This
[![PDD](https://img.shields.io/badge/PDD-E_Commerce-orange?style=for-the-badge)](https://www.pinduoduo.com/)
[![Shopee](https://img.shields.io/badge/Shopee-E_Commerce-red?style=for-the-badge)](https://shopee.com/)
[![Ctrip](https://img.shields.io/badge/Ctrip-Travel-blue?style=for-the-badge)](https://www.ctrip.com/)
[![Bambu Lab](https://img.shields.io/badge/Bambu_Lab-3D_Printing-green?style=for-the-badge)](https://bambulab.com/)
---
## Documentation & Live Examples
- [Documentation](https://reactuse.com/)
---
## Feedback
You can submit an [issue](https://github.com/childrentime/reactuse/issues) or provide feedback on [Discord](https://discord.gg/HMsq6cFkKp).
---
## Contribute
See the [**Contributing Guide**](https://github.com/childrentime/reactuse/blob/main/CONTRIBUTING.md)
## ChangeLog
See the [**ChangeLog**](https://github.com/childrentime/reactuse/blob/main/packages/core/changelog.md)
---
## Thanks
This project is heavily inspired by the following awesome projects.
- [streamich/react-use](https://github.com/streamich/react-use)
- [ahooks](https://github.com/alibaba/hooks)
- [vueuse](https://github.com/vueuse/vueuse)
---
## Sponsor Me
If my work has helped you, consider buying me a cup of coffee. Thank you very much🥰!.
[Buy me a coffee](https://www.buymeacoffee.com/lianwenwu)
+4566
View File
File diff suppressed because it is too large Load Diff
+4502
View File
File diff suppressed because it is too large Load Diff
+4502
View File
File diff suppressed because it is too large Load Diff
+4502
View File
File diff suppressed because it is too large Load Diff
+4445
View File
File diff suppressed because it is too large Load Diff
+113
View File
@@ -0,0 +1,113 @@
Object.defineProperty(exports, '__esModule', { value: true });
var QRCode = require('qrcode');
var React = require('react');
var lodashEs = require('lodash-es');
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
var QRCode__default = /*#__PURE__*/_interopDefault(QRCode);
process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test';
const isBrowser = typeof window !== 'undefined';
const useIsomorphicLayoutEffect = isBrowser ? React.useLayoutEffect : React.useEffect;
const updateReducer = (num)=>(num + 1) % 1000000;
function useUpdate() {
const [, update] = React.useReducer(updateReducer, 0);
return update;
}
const useCustomCompareEffect = (effect, deps, depsEqual)=>{
if (process.env.NODE_ENV !== 'production') {
if (!Array.isArray(deps) || !deps.length) {
console.warn('`useCustomCompareEffect` should not be used with no dependencies. Use React.useEffect instead.');
}
if (typeof depsEqual !== 'function') {
console.warn('`useCustomCompareEffect` should be used with depsEqual callback for comparing deps list');
}
}
const ref = React.useRef(undefined);
const forceUpdate = useUpdate();
if (!ref.current) {
ref.current = deps;
}
useIsomorphicLayoutEffect(()=>{
if (!depsEqual(deps, ref.current)) {
ref.current = deps;
forceUpdate();
}
});
// eslint-disable-next-line react-hooks/exhaustive-deps
React.useEffect(effect, ref.current);
};
const useDeepCompareEffect = (effect, deps)=>{
if (process.env.NODE_ENV !== 'production') {
if (!Array.isArray(deps) || !deps.length) {
console.warn('`useDeepCompareEffect` should not be used with no dependencies. Use React.useEffect instead.');
}
}
useCustomCompareEffect(effect, deps, lodashEs.isEqual);
};
const defaultOptions = {};
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _async_to_generator(fn) {
return function() {
var self = this, args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
function generateQRCode(text, options) {
return QRCode__default.default.toDataURL(text, options);
}
const useQRCode = (text, options = defaultOptions)=>{
const [qrCode, setQRCode] = React.useState('');
const [error, setError] = React.useState(null);
useDeepCompareEffect(()=>{
const generate = ()=>_async_to_generator(function*() {
try {
const qrCode = yield generateQRCode(text, options);
setQRCode(qrCode);
} catch (error) {
setError(error);
}
})();
generate();
}, [
text,
options
]);
return {
qrCode,
error
};
};
exports.generateQRCode = generateQRCode;
exports.useQRCode = useQRCode;
+40
View File
@@ -0,0 +1,40 @@
import QRCode, { QRCodeToDataURLOptions } from 'qrcode';
/**
* @title UseQRCode
*/
type UseQRCode = (
/**
* @zh 文本
* @zh-Hant 文本
* @en Text
*/
text: string,
/**
* @zh 传递给 `QRCode.toDataURL` 的选项
* @zh-Hant 傳遞給 `QRCode.toDataURL` 的選項
* @en Options passed to `QRCode.toDataURL`
*/
options?: QRCodeToDataURLOptions) => UseQRCodeReturn;
/**
* @title UseQRCodeReturn
*/
interface UseQRCodeReturn {
/**
* @zh 生成的二维码
* @zh-Hant 生成的二維碼
* @en Generated QR code
*/
qrCode: string;
/**
* @zh 错误
* @zh-Hant 錯誤
* @en Error
*/
error: unknown;
}
declare function generateQRCode(text: string, options?: QRCode.QRCodeToDataURLOptions): Promise<string>;
declare const useQRCode: UseQRCode;
export { generateQRCode, useQRCode };
+40
View File
@@ -0,0 +1,40 @@
import QRCode, { QRCodeToDataURLOptions } from 'qrcode';
/**
* @title UseQRCode
*/
type UseQRCode = (
/**
* @zh 文本
* @zh-Hant 文本
* @en Text
*/
text: string,
/**
* @zh 传递给 `QRCode.toDataURL` 的选项
* @zh-Hant 傳遞給 `QRCode.toDataURL` 的選項
* @en Options passed to `QRCode.toDataURL`
*/
options?: QRCodeToDataURLOptions) => UseQRCodeReturn;
/**
* @title UseQRCodeReturn
*/
interface UseQRCodeReturn {
/**
* @zh 生成的二维码
* @zh-Hant 生成的二維碼
* @en Generated QR code
*/
qrCode: string;
/**
* @zh 错误
* @zh-Hant 錯誤
* @en Error
*/
error: unknown;
}
declare function generateQRCode(text: string, options?: QRCode.QRCodeToDataURLOptions): Promise<string>;
declare const useQRCode: UseQRCode;
export { generateQRCode, useQRCode };
+106
View File
@@ -0,0 +1,106 @@
import QRCode from 'qrcode';
import { useLayoutEffect, useEffect, useReducer, useRef, useState } from 'react';
import { isEqual } from 'lodash-es';
process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test';
const isBrowser = typeof window !== 'undefined';
const useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect;
const updateReducer = (num)=>(num + 1) % 1000000;
function useUpdate() {
const [, update] = useReducer(updateReducer, 0);
return update;
}
const useCustomCompareEffect = (effect, deps, depsEqual)=>{
if (process.env.NODE_ENV !== 'production') {
if (!Array.isArray(deps) || !deps.length) {
console.warn('`useCustomCompareEffect` should not be used with no dependencies. Use React.useEffect instead.');
}
if (typeof depsEqual !== 'function') {
console.warn('`useCustomCompareEffect` should be used with depsEqual callback for comparing deps list');
}
}
const ref = useRef(undefined);
const forceUpdate = useUpdate();
if (!ref.current) {
ref.current = deps;
}
useIsomorphicLayoutEffect(()=>{
if (!depsEqual(deps, ref.current)) {
ref.current = deps;
forceUpdate();
}
});
// eslint-disable-next-line react-hooks/exhaustive-deps
useEffect(effect, ref.current);
};
const useDeepCompareEffect = (effect, deps)=>{
if (process.env.NODE_ENV !== 'production') {
if (!Array.isArray(deps) || !deps.length) {
console.warn('`useDeepCompareEffect` should not be used with no dependencies. Use React.useEffect instead.');
}
}
useCustomCompareEffect(effect, deps, isEqual);
};
const defaultOptions = {};
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _async_to_generator(fn) {
return function() {
var self = this, args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
function generateQRCode(text, options) {
return QRCode.toDataURL(text, options);
}
const useQRCode = (text, options = defaultOptions)=>{
const [qrCode, setQRCode] = useState('');
const [error, setError] = useState(null);
useDeepCompareEffect(()=>{
const generate = ()=>_async_to_generator(function*() {
try {
const qrCode = yield generateQRCode(text, options);
setQRCode(qrCode);
} catch (error) {
setError(error);
}
})();
generate();
}, [
text,
options
]);
return {
qrCode,
error
};
};
export { generateQRCode, useQRCode };
+107
View File
@@ -0,0 +1,107 @@
{
"name": "@reactuses/core",
"version": "6.1.9",
"license": "Unlicense",
"homepage": "https://www.reactuse.com/",
"repository": {
"type": "git",
"url": "git+https://github.com/childrentime/reactuse.git",
"directory": "packages/core"
},
"bugs": {
"url": "https://github.com/childrentime/reactuse/issues"
},
"keywords": [
"react",
"react-use",
"react hooks",
"hook",
"hooks",
"component"
],
"sideEffects": false,
"exports": {
"./package.json": "./package.json",
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
},
"./useQRCode": {
"import": {
"types": "./dist/useQRCode.d.mts",
"default": "./dist/useQRCode.mjs"
},
"require": {
"types": "./dist/useQRCode.d.cts",
"default": "./dist/useQRCode.cjs"
}
}
},
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"LICENSE",
"README.md",
"dist",
"package.json"
],
"scripts": {
"lint": "eslint \"{hooks,tests}/**/*.{ts,tsx}\"",
"build": "esno scripts/build.ts",
"build:bunchee": "bunchee",
"dev": "bunchee --watch",
"gend": "tsx scripts/tsdoc.ts",
"publish:ci": "esno scripts/publish.ts",
"release:prepare": "bump",
"release": "esno scripts/release.ts",
"test": "jest",
"test:coverage": "jest --coverage"
},
"peerDependencies": {
"qrcode": "^1.5",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
},
"peerDependenciesMeta": {
"qrcode": {
"optional": true
}
},
"dependencies": {
"@microsoft/fetch-event-source": "^2.0.1",
"js-cookie": "^3.0.5",
"lodash-es": "^4.17.21",
"screenfull": "^5.0.0",
"use-sync-external-store": "^1.2.0"
},
"devDependencies": {
"@jsdevtools/version-bump-prompt": "^6.1.0",
"@reactuses/ts-document": "workspace:*",
"@testing-library/dom": "^10.4.0",
"@testing-library/react": "^16.1.0",
"@types/jest": "^27.5.2",
"@types/js-cookie": "^3.0.3",
"@types/lodash": "^4.14.184",
"@types/lodash-es": "^4.17.7",
"@types/qrcode": "^1.5.5",
"@types/use-sync-external-store": "^0.0.6",
"babel-jest": "^29.0.2",
"consola": "^2.15.3",
"esbuild": "^0.19.11",
"esbuild-register": "^3.4.1",
"jest": "^29.0.2",
"jest-environment-jsdom": "^29.0.2",
"jest-environment-node": "^29.7.0",
"lodash": "^4.17.21",
"qrcode": "^1.5.3",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"typescript": "^5.3.3"
}
}