open-index/open-npm huggingface dataset:
npm package: @maolipeng/proxy-dev-server
Description: A proxy server to handle cors
Latest version: 0.0.5

# @maolipeng/proxy-dev-server

## 背景

有这样一些场景（主要是处理Chrome开发环境报跨域问题）：

1. 前端开发环境的服务器，需要代理测试环境接口，但测试环境部署的后端接口并没有配置cors,但项目中有些接口是重定向的，重定向的location会被浏览器默认返回服务器的真实地址，导致跨域问题，浏览器请求不同
2. 前端请求直接不同域的接口，chrome浏览器也会报跨域问题
   
解决方式：
一般需要后端去配置cors一些配置，但为了保证安全性，同时再不改变后端的前提下，前端通过一个中转服务器去代理客户端接口，然后请求目标服务器，同时将这个服务器的cors配置好，相当于对此代理服务器进行了绝对的放行，但并不影响真实的服务器的配置。这个服务器就是这个原理

## Install

```bash
pnpm i -D @maolipeng/proxy-dev-server
```

## Usage

可以在命令行中使用my-proxy-server命令来启动这个服务器。需要提供一些选项，如目标服务器的URL、监听的端口和主机名等。以下是一个示例：

```bash
proxy-server --target http://example.com --port 8000 --hostname localhost

```

这将会启动一个监听localhost的8000端口的HTTP代理服务器，所有的请求都会被代理到<http://example.com。>

### https

如果你需要HTTPS，你可以提供--https、--key和--cert选项，如下所示：

```bash
my-proxy-server --target http://example.com --port 8000 --hostname localhost --https ./key.pem --cert ./cert.pem

```

这将会启动一个监听localhost的8000端口的HTTPS代理服务器，所有的请求都会被代理到<http://example.com。请注意，你需要将./key.pem和./cert.pem替换为你的HTTPS证书的实际路径。>

### 配置文件

你也可以使用一个.proxyrc.js文件来配置你的服务器。这个文件应该导出一个对象，这个对象包含了你的配置选项。例如：

```js
module.exports = {
    target: 'http://example.com',
    port: 8000,
    hostname: 'localhost',
    https: false,
};

```

然后，你可以使用以下命令来启动你的服务器：

```bash
proxy-server
```

这将会使用.proxyrc.js文件中的配置选项来启动你的服务器。如果你想覆盖配置文件中的某些选项，你可以提供命令行参数。

## 项目中使用

例如proxy-sever启动的接口是<http://127.0.0.1:3000>

### 重定向的问题

针对于重定向的跨域，可以配置proxy的时候将proxy-server作为target,因为它代理了目标服务器的接口

```js
module.exports = {
    '/api': {
        target: 'http://127.0.0.1:3000',
        changeOrigin: true,
    }
}
```

### 直接访问跨域服务器的问题

设置特定的环境变量，将开发环境下的接口全部代理到proxy-server

```js
let API_PREFIX = ''
switch (process.env.NODE_ENV) {
 case 'dev':
  API_PREFIX = 'http://127.0.0.1:3000'
  break;
}
```

## LICENSE

MIT
npm package: @maomrs/tiny
Description: Removes all spaces from a string
Latest version: 1.0.2

@maomrs/tiny
[![npm (scoped)]
(https://img.shields.io/npm/v/@maomrs/tiny.svg)]
(https://github.com/maomrs/tiny)
[![npm bundle size (minified)]
(https://img.shields.io/maomrs/min/@maomrs/tiny.svg)]
(https://github.com/maomrs/tiny)

It's the tiniest!
npm package: @maons/lint
Description: <a name="readme-top"></a>
Latest version: 0.6.4

<a name="readme-top"></a>

# Lint rules and static code analysis

ESLint and Prettier configuration ready to use in any project.

It includes support for `React.js`, `Tailwindcss` and `Prettier`.

## Getting Started

### Install

```bash
npm install @maons/lint --save-dev
```

## Configuration

### ESLint

Add the following to your `package.json`:

```json
{
  "eslintConfig": {
    "extends": "@maons/lint/.eslintrc.js"
  }
}
```

or create a `.eslintrc.js` file with the following content:

```js
module.exports = {
  root: true,
  extends: '@maons/lint/.eslintrc.js',
};
```

### Prettier

Add the following to your `package.json`:

```json
{
  "prettier": "@maons/lint/.prettierrc.js"
}
```

### Visual Studio Code Integration

Steps to integrate `@maons/lint` with Visual Studio Code:

1. Install ESLint and Prettier plugins:

- [esbenp.prettier-vscode](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
- [vscode-eslint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)

2. Add the following to your VSCode `settings.json`:

```json
{
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[typescript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
  },
  "[json]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "editor.codeActionsOnSave": {
    "source.fixAll.tslint": true,
    "source.fixAll.eslint": true
  },
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact"
  ]
}
```

## License

Licensed under the [MIT license](https://github.com/rmoralp/maons/blob/main/packages/lint/LICENSE.md).

<p align="right">(<a href="#readme-top">back to top</a>)</p>
npm package: @maons/react-components
Description: <a name="readme-top"></a>
Latest version: 1.5.0

<a name="readme-top"></a>

# React + Tailwind components

Maons React Components is a simple, modular and accessible component library that gives you the building blocks you need to build your React+Tailwind applications.

You can have a look to storybook playground [here 📝](https://main--63cea501d66c7f57c939718b.chromatic.com/).

## Install

To use Maons React Components, all you need to do is install the `@maons/react-components` package:

```sh
$ npm install @maons/react-components

# or 

$ yarn add @maons/react-components
```

## Usage

### Prepare Tailwind configuration

For a Tailwind configuration to work with the components, you should:

- Update your `tailwind.config.js` file to include the `@maons/react-components` package in the `content` array. This will allow Tailwind to extract the classes from the components.
- Extend the `theme` object to include `primary` and `secondary` colors. These colors will be used by the components.

```js
// tailwind.config.js 
{
  content: [
    // ...
    './node_modules/@maons/react-components/**/*.{js,jsx}'
  ],
  // ...
  theme: {
    extend: {
      // Add primary and secondary colors
      colors: ({colors}) => ({
        primary: colors.blue,
        secondary: colors.violet
      })
    }
  },
  // ...
}
```

### Import the component

Now, you can start using a component like so!

```js
import {Button} from '@maons/react-components'


const Example = () => (
  <Button>Click me</Button>
)
```

## License

Licensed under the [MIT license](https://github.com/rmoralp/maons/blob/main/react/components/LICENSE.md).

<p align="right">(<a href="#readme-top">back to top</a>)</p>
npm package: @maons/react-hooks
Description: <a name="readme-top"></a>
Latest version: 0.1.2

<a name="readme-top"></a>

# React hooks

## Install

To use Maons React Hooks, all you need to do is install the `@maons/react-hooks` package:

```sh
$ npm install @maons/react-hooks

# or 

$ yarn add @maons/react-hooks
```
npm package: @maons/tsconfig
Description: <a name="readme-top"></a>
Latest version: 0.3.3

<a name="readme-top"></a>

# Typescript configurations

`tsconfig.json` files for `Node.js`, `Next.js` and `React.js` projects.

## Getting Started

### Install

```bash
npm install @maons/tsconfig --save-dev
```

## Configuration

These are base shared `tsconfig.json`s from which all other `tsconfig.json`'s inherit from.

### Node.js

Create a `tsconfig.json` file with the following content:

```json
{
  "extends": "@maons/tsconfig/base.json",
  "compilerOptions": {
    "outDir": "dist"
  },
  "include": ["src/**/*"]
}
```

### Next.js

Create a `tsconfig.json` file with the following content:

```json
{
  "extends": "@maons/tsconfig/nextjs.json",
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
  "exclude": ["node_modules"]
}
```

### React.js

Create a `tsconfig.json` file with the following content:

```json
{
  "extends": "@maons/tsconfig/react-library.json",
  "include": ["."],
  "exclude": ["dist", "build", "node_modules"]
}
```

## License

Licensed under the [MIT license](https://github.com/rmoralp/maons/blob/main/packages/tsconfig/LICENSE.md).

<p align="right">(<a href="#readme-top">back to top</a>)</p>
npm package: @maooricio/react-native-expo-crypto
Description: implementation of crypto for React Native in expo
Author: Richard Silver
Latest version: 2.1.5

# react-native-expo-crypto

THIS REPOSITORY HAS MOVED. IT'S NEW LOCATION IS HERE: [https://github.com/themotu/react-native-expocrypto](https://github.com/tradle/react-native-expo-crypto)

Note: this module is a clone of [crypto-browserify](https://github.com/crypto-browserify/crypto-browserify), with randombytes replaced. 

A port of node's `crypto` module to React Native.

## install

A typical workflow:

1. Install
  ```sh
  expo add expo-random && yarn add react-native-expo-crypto react-native-expo-bitcoinjs-lib
  ```

## the crypto in this box

What follows is unedited text from crypto-browserify

The goal of this module is to use expo-random for randombytes.

Here is the subset that is currently implemented:

* createHash (sha1, sha224, sha256, sha384, sha512, md5, rmd160)
* createHmac (sha1, sha224, sha256, sha384, sha512, md5, rmd160)
* pbkdf2
* pbkdf2Sync
* randomBytes
* pseudoRandomBytes
* createCipher (aes)
* createDecipher (aes)
* createDiffieHellman
* createSign (rsa, ecdsa)
* createVerify (rsa, ecdsa)
* createECDH (secp256k1)
* publicEncrypt/privateDecrypt (rsa)

## todo

these features from node's `crypto` are still unimplemented.

* createCredentials

these features would benefit from native implementations

* pbkdf2
* createSign
* createVerify
* createECDH
* publicEncrypto/privateDecrypt (rsa)

## contributions

If you are interested in writing a feature, please implement as a new module,
which will be incorporated into crypto-browserify as a dependency.

All deps must be compatible with node's crypto
(generate example inputs and outputs with node,
and save base64 strings inside JSON, so that tests can run in the browser.
see [sha.js](https://github.com/dominictarr/sha.js)

Crypto is _extra serious_ so please do not hesitate to review the code,
and post comments if you do.

## License

MIT