open-index/open-npm huggingface dataset:
npm package: @quanxi/ui
Description: 全悉组件库
Author: gq
Latest version: 1.0.1

# 全悉前端公共组件库 quanxi-ui

https://git.in.chaitin.net/answer/quanxi-ui

- npm run dev 本地启动 demo
- npm run build 打包组件库
- npm run build:html 打包组件库 demo
  访问链接：https://answer.chaitin.page/quanxi-ui/#/docs/index

## 目录结构

<details>
<summary>点击显示目录结构详情</summary>
<pre>
├── README.md     // readme
├── build         // build:html 执行
│   └── build.ts
├── index.html
├── package-lock.json
├── package.json
├── packages      // 公共组件源码
│   ├── Button
│   │   ├── button.tsx
│   │   ├── index.ts
│   │   └── style.scss
│   ├── Card
│   │   ├── card.tsx
│   │   ├── index.ts
│   │   └── style.scss
│   ├── Confirm
│   │   ├── Confirm.tsx
│   │   ├── index.tsx
│   │   └── style.scss
│   └── index.ts
├── public
│   └── vite.svg
├── react-app-env.d.ts
├── src                     // 展示页面目录
│   ├── assets
│   │   └── react.svg
│   ├── components          // 公用组件
│   │   ├── codeView.tsx
│   │   ├── instanceView.tsx
│   │   ├── menu.tsx
│   │   ├── subtitle.tsx
│   │   └── title.tsx
│   ├── demo                // 展示demo页面 及 展示demo
│   │   ├── button.tsx      // 展示页面
│   │   └── dedicate        // demo
│   │       └── index.tsx
│   ├── index.css
│   ├── main.tsx
│   ├── pages               // 公共页面
│   │   ├── 404.tsx
│   │   ├── dedicate.tsx    // 贡献指南
│   │   ├── homePage        // 访问gitlab展示首页
│   │   │   ├── images
│   │   │   │   ├── adorn.svg
│   │   │   │   ├── css.svg
│   │   │   │   ├── ct-logo.svg
│   │   │   │   ├── ctin.svg
│   │   │   │   ├── gear.svg
│   │   │   │   ├── github-blue.svg
│   │   │   │   ├── github.svg
│   │   │   │   ├── html.svg
│   │   │   │   ├── img.svg
│   │   │   │   ├── logo.svg
│   │   │   │   └── mascot.svg
│   │   │   └── index.tsx
│   │   ├── index.tsx       // 顶部menu，左侧menu，二级路由页面
│   │   └── layout.tsx
│   ├── router              // 路由
│   │   ├── index.tsx       // 一级路由
│   │   ├── packages.tsx
│   │   └── page.tsx        // 路由配置
│   ├── styles
│   │   ├── app.scss
│   │   ├── custom.scss
│   │   ├── global.scss
│   │   ├── iconfont.scss
│   │   ├── iconfont.ttf
│   │   ├── reset.scss
│   │   └── theme.scss
│   ├── utils.tsx
│   └── vite-env.d.ts
├── tsconfig.json
├── tsconfig.node.json
├── vite.config.ts
└── yarn.lock

</pre></details>

## 本地调试组件库 npm 包

1. 全局安装 yalc
   `npm install -g yalc`

2. 修改组件库文件后，执行
   `npm run build:push`

3. 添加本地包，quanxi-platform-frontend 项目中执行
   `yalc add @quanxi/ui`
   此时，重启 quanxi-platform-frontend 项目之后，项目中的引用的就是本地组件库。

4. 更新本地包时，先执行 2，然后在 quanxi-platform-frontend 项目中执行
   `yalc update`

5. 删除本地包，quanxi-platform-frontend 项目中执行
   `yalc remove --all`
npm package: @quanxiaoxiao/dns
Description: ```shell $ npm install @quanxiaoxiao/dns ```
Latest version: 0.5.0

### Install

```shell
$ npm install @quanxiaoxiao/dns
```

```javascript
import tls from 'node:tls';
import assert from 'node:assert';
import {
  enpack,
  depack,
} from '@quanxiaoxiao/bytes';
import encodeV4 from '../src/encodeV4.mjs';
import decodeAnswer from '../src/decodeAnswer.mjs';
import { RECORD_TYPE_A } from '../src/recordTypes.mjs';

const socket = tls.connect({
  host: '223.5.5.5',
  noDelay: true,
  port: 853,
  secureContext: tls.createSecureContext({
    secureProtocol: 'TLSv1_2_method',
  }),
});

const id = 33;

socket.on('connect', () => {
  console.log('connect');
  socket.write(enpack(encodeV4({
    identification: id,
    hostname: 'www.zhihu.com',
  }), 2));
});

const executeDepack = depack();

socket.on('data', (chunk) => {
  const ret = executeDepack(chunk);
  if (ret) {
    const { payload } = decodeAnswer(ret.payload);
    assert(payload.identification === id);
    const addressList = payload.answers.filter((d) => d.recordType === RECORD_TYPE_A);
    console.log(addressList);
  }
});
```
npm package: @quanxiaoxiao/httttp
Description: This is a library for processing HTTP 1.1 packets. During the parsing process, it provides various hook functions such as `onHttpRequest`, `onHttpRequestStartLine`, etc., to facilitate more granular control over packets, output log tracing, and traffic st
Latest version: 0.132.0

This is a library for processing HTTP 1.1 packets. During the parsing process, it provides various hook functions such as `onHttpRequest`, `onHttpRequestStartLine`, etc., to facilitate more granular control over packets, output log tracing, and traffic statistics. It also supports the forwarding function of HTTP 1.1 packets. Through reverse proxy, more fine-grained traffic control can be achieved.

## Install

```shell
npm install @quanxiaoxiao/httttp
```

## Quick Start

```javascript
import net from 'node:net';
import { handleSocketHttp } from '@quanxiaoxiao/httttp';

const hooks = {
  onHttpRequest: () => {...},
  onHttpRequestEnd: (ctx) => {
    ctx.response = {
      headers: {
        server: 'quan',
        'content-length': 'text/plain',
      },
      body: 'ok',
    };
  },
};

const server = net.createServer(handleSocketHttp(hooks));

server.listen(3000);
```

## Hooks

- onHttpRequest
- onHttpRequestStartLine
- onHttpRequestHeader
- onHttpRequestConnection
- onHttpRequestEnd
- onForwardConnecting
- onForwardConnect
- onHttpResponseEnd
- onHttpError
- onChunkIncoming
- onChunkOutgoing
- onFinish
npm package: @quanxiaoxiao/react
Description: ```javascript const { pending, action } = useAction({   pre: () => {},   fn: () => {},   resolve: () => {},   reject: () => {}, }); ```
Latest version: 0.0.7

### useAction

```javascript
const { pending, action } = useAction({
  pre: () => {},
  fn: () => {},
  resolve: () => {},
  reject: () => {},
});
```
npm package: @quanxiaoxiao/resource-curd
Description: ## Overview This module provides a collection of utility functions for file and directory operations in Node.js, focusing on file metadata, resource reading, and image handling.
Latest version: 0.9.0

# Node.js File Utilities Documentation

## Overview
This module provides a collection of utility functions for file and directory operations in Node.js, focusing on file metadata, resource reading, and image handling.

## Install

```shell
npm install @quanxiaoxiao/resource-curd
```

## Exported Functions

### 1. `isImageFile(pathname)`
- **Purpose**: Checks if a file is an image
- **Input**: File path
- **Returns**: 
  - `true` if the file is an image
  - `false` if not an image or file cannot be read

### 2. `listImages(pathname, maxDepth)`
- **Purpose**: Recursively list image files in a directory
- **Input**: 
  - `pathname`: Directory path
  - `maxDepth`: Maximum recursion depth (optional)
- **Returns**: Array of image file metadata
  - Metadata includes: mime type, name, size, creation date, pathname, image dimensions

### 3. `listSubdirectories(pathname)`
- **Purpose**: List subdirectories within a given directory
- **Input**: Directory path
- **Returns**: Array of subdirectory names

### 4. `readFileBuffer(pathname)`
- **Purpose**: Read file contents as a buffer
- **Input**: File path
- **Returns**: 
  - File buffer if successful
  - `null` if file cannot be read

### 5. `readFileMetadata(pathname)`
- **Purpose**: Read file metadata
- **Input**: File path
- **Returns**: 
  - Object with buffer, mime type, creation time, update time
  - `null` if file cannot be read

### 6. `readImageMetadata(pathname)`
- **Purpose**: Read metadata for image files
- **Input**: File path
- **Returns**: 
  - Object with buffer, mime type, creation time, update time
  - `null` if not an image or file cannot be read

### 7. `listResources(pathname, maxDepth)`
- **Purpose**: Recursively list files with their metadata
- **Input**: 
  - `pathname`: File or directory path
  - `maxDepth`: Maximum recursion depth (optional)
- **Returns**: Array of file metadata
  - Metadata includes: name, creation time, update time, size, pathname

## Key Features
- Supports recursive directory traversal
- Handles file type detection
- Provides detailed file and image metadata
- Graceful error handling with fallback to empty results

## Dependencies
- `node:fs/promises`
- `file-type`
- `image-size`
- `mime-types`

## Usage Example
```javascript
import { listResources, listImages } from '@quanxiaoxiao/resource-curd';

// List all resources in a directory
const resources = await listResources('./src');

// Find all images in a directory
const images = await listImages('./images', 2);
```

## Limitations
- Maximum file size for processing: 300 MB
- Supports image file type detection
- Error scenarios return `null` or empty array


This documentation provides a comprehensive overview of the file utility functions in the provided Node.js module. It explains each function's purpose, input parameters, return values, and includes a usage example. Would you like me to elaborate on any specific part of the documentation?
npm package: @quanxiaoxiao/store
Description: ## Overview This library provides a flexible and type-safe state management solution for JavaScript/Node.js applications, with built-in schema validation and nested state handling.
Latest version: 0.10.0

# State Management Library Documentation

## Overview
This library provides a flexible and type-safe state management solution for JavaScript/Node.js applications, with built-in schema validation and nested state handling.

## Key Components

### `createStateDispatch`
A core function for creating a state management dispatcher with optional schema validation.

#### Features:
- Supports nested state updates
- Validates state changes using JSON schemas
- Handles both direct and functional state updates
- Preserves immutability

#### Example:
```javascript
const dispatch = createStateDispatch({
  name: 'John',
  age: 30
}, {
  age: {
    type: 'integer',
    minimum: 18,
    maximum: 100
  }
});

// Update state directly
let newState = dispatch('name', 'Jane');

// Update state with a function
newState = dispatch('age', (prev) => prev + 1);
```

### `getReducer`
Creates a Redux-compatible reducer function.

#### Features:
- Converts `createStateDispatch` into a Redux reducer
- Supports standard Redux action patterns

#### Example:
```javascript
const [reducer, initialState] = getReducer({
  user: { name: 'John' }
});

const store = createStore(reducer, initialState);
```

### `createStore`
A simplified store creation utility with built-in middleware support.

#### Features:
- Creates a Redux store with initial state
- Optional schema validation
- Middleware integration
- Simplified dispatch method

#### Example:
```javascript
const store = createStore({
  initialState: { user: { name: 'John' } },
  schemas: {
    'user.age': { type: 'integer', minimum: 18 }
  },
  middlewares: [thunk, logger]
});
```

## Schema Validation
The library uses [Ajv](https://ajv.js.org/) for JSON schema validation, allowing type checking and value constraints.

### Validation Examples:
```javascript
{
  // Ensure age is an integer between 18 and 55
  age: {
    type: 'integer',
    minimum: 18,
    maximum: 55
  },
  
  // Validate nested object properties
  'user.email': {
    type: 'string',
    format: 'email'
  }
}
```

## Key Utilities

### `convertActionName`
Escapes dot notation for nested state paths.

### `setValue`
Immutably updates nested state structures.

### `generateActionHandlerList`
Recursively generates action handlers for nested state.

## Installation
```bash
npm install @quanxiaoxiao/store
```

## Dependencies
- Ajv: JSON schema validation
- Lodash: Object manipulation utilities
- Redux (optional): State management

## Error Handling
- Throws descriptive errors for invalid state updates
- Prevents updates that don't pass schema validation

## Performance Considerations
- Immutable state updates
- Efficient nested state traversal
- Minimal performance overhead from validation

## License
[Your License Here]

## Contributing
[Contribution Guidelines]