open-index/open-npm huggingface dataset:
npm package: @p-chan/prettier-config
Description: Shareable Prettier config for @p-chan
Author: P-Chan
Latest version: 2.1.0

# prettier-config

> Shareable Prettier config for [@p-chan](https://github.com/p-chan)

## Install

```bash
$ npm install @p-chan/prettier-config --save-dev
```

## Usage

Edit `.prettierrc`.

```json
"@p-chan/prettier-config"
```

## Override

Edit `.prettierrc.js`.

```js
module.exports = {
  ...require('@p-chan/prettier-config'),
  printWidth: 80,
  semi: true,
  singleQuote: false,
}
```

## Author

[@p-chan](https://github.com/p-chan)

## License

MIT

---

Inspired by [azz/prettier-config](https://github.com/azz/prettier-config)
npm package: @p-chan/tsconfig
Description: Shareable TypeScript config for @p-chan
Author: P-Chan
Latest version: 1.2.0

# tsconfig

> Shareable TypeScript config for [@p-chan](https://github.com/p-chan)

## Install

```bash
$ npm install @p-chan/tsconfig --save-dev
```

## Usage

Edit `tsconfig.json`.

```jsonc
{
  // Default (use Recommended)
  "extends": "@p-chan/tsconfig",

  // Recommended
  "extends": "@p-chan/tsconfig/recommended.json",

  // for Node.js v12
  "extends": "@p-chan/tsconfig/node12.json",

  // for Node.js v14
  "extends": "@p-chan/tsconfig/node14.json",

  // for Next.js
  "extends": "@p-chan/tsconfig/next.json"
}
```

### Override

```jsonc
{
  "extends": "@p-chan/tsconfig",
  "compilerOptions": {
    "outDir": "./dist",
    "baseUrl": "./"
  }
}
```

## Author

[@p-chan](https://github.com/p-chan)

## License

MIT

---

Inspired by [sindresorhus/tsconfig](https://github.com/sindresorhus/tsconfig)
npm package: @p-der/clone
Description: 实现 js 引用类型数据的深拷贝功能
Latest version: 1.0.0

# 现代javascript库开发练习
# clone
实现 js 引用类型数据的深拷贝功能

## 使用者指南
通过npm下载安装代码

```bash
$ npm install --save clone
```

如果你是node环境

```js
var { clone } = require('clone');

clone({a: 1})
```

如果你是webpack等环境

```js
import { clone } from 'clone';

clone({a: 1})
```

如果你是浏览器环境

```html
<script src="node_modules/clone/dist/index.aio.js"></script>
<script>
    clone({a: 1})
</script>
```

## 贡献者指南
首次运行需要先安装依赖

```bash
$ npm install
```

一键打包生成生产代码

```bash
$ npm run build
```

运行单元测试:

```bash
$ npm test
npm package: @p-der/utils
Description: 实现 JavaScript 引用对象的深拷贝功能
Author: P-der
Latest version: 1.1.0

### @p-der/utils ![example workflow](https://github.com/P-der/utils/actions/workflows/ci.yml/badge.svg)

实现 JavaScript 引用对象的深拷贝功能

### 使用者指南

通过 npm 下载安装代码

```bash
$ npm install --save @p-der/utils
```

如果你是 node 环境

```js
var { clone } = require('@p-der/utils');

clone({ a: 1 });
```

如果你是 webpack 等环境

```js
import { clone } from '@p-der/utils';

clone({ a: 1 });
```

如果你是浏览器环境

```html
<script src="node_modules/@p-der/utils/dist/index.aio.js"></script>
<script>
  clone({ a: 1 });
</script>
```

### 贡献者指南

首次运行需要先安装依赖

```bash
$ npm install
```

一键打包生成生产代码

```bash
$ npm run build
```

运行单元测试:

```bash
$ npm test
```
npm package: @p-j/eapi-middleware-cache
Description: A cache middleware to work within an EAPI app. Check worker-eapi-template for context.
Author: Jérémie Parker
Latest version: 1.1.0

# `@p-j/eapi-middleware-cache`

> A middleware to configure cache behavior on a per route or request basis

## Installation

- From the NPM registry

```sh
npm install @p-j/eapi-middleware-cache
# or
yarn add @p-j/eapi-middleware-cache
```

## API

[`withCache`](./src/withCache.ts) is a [Middleware Factory](../eapi-types/index.d.ts); it takes the following options:

```ts
export interface WithCacheOptions {
  cacheControl?: string
  cdnTtl?: number
  cacheError?: boolean
  varyHeaders?: string[]
  serverTimings?: boolean
}
```

As noted above, none of the options are required.

- `cacheControl` the value to be assigned to the _Cache-Control_ header (control the _Browser Cache TTL_)
- `cdnTtl` this control the _Edge Cache TTL_, by default it also sets a _Cache-Control_ of the same value, unless `cacheControl` is also set
- `cacheCacheError` wheter or not to cache errors. **Defaults to false.**
- `varyHeaders` an array of Header names to be add to the _Vary_ header (eg: 'Accept', 'Origin' ... ).
- `serverTimings=true` add _Server-Timing_ header with cache interaction information. **Defaults to true.**

For a better understanding of how cache works in the context of Cloudflare Workers, these links may help:

- [Workers Doc: Using Cache](https://developers.cloudflare.com/workers/about/using-cache/)
- [Workers Ref: Cache](https://developers.cloudflare.com/workers/reference/apis/cache/)
- [Worker Doc: Cache API Limits](https://developers.cloudflare.com/workers/about/limits/#cache-api)

And for the underlying API

- [MDN: Web API / Cache](https://developer.mozilla.org/en-US/docs/Web/API/Cache)
npm package: @p-j/eapi-middleware-cors
Description: A CORS middleware to work within an EAPI app. Check worker-eapi-template for context.
Author: Alban Vitale
Latest version: 1.2.0

# `@p-j/eapi-middleware-cors`

> A middleware to configure CORS behavior on a per route or request basis

## Installation

- From the NPM registry

```sh
npm install @p-j/eapi-middleware-cors
# or
yarn add @p-j/eapi-middleware-cors
```

## API

- [`withCors`](./src/withCors.ts) is a [Middleware Factory](../eapi-types/index.d.ts); it takes in the following options:

  ```ts
  export interface WithCorsOptions {
    isOriginAllowed?: Function
    accessControlAllowHeaders?: string[]
    accessControlAllowMethods?: string[]
    accessControlMaxAge?: number
    accessControlAllowCredentials?: boolean
    accessControlExposeHeaders?: string[]
  }
  ```

  As noted above, none of the options are required.

  - `isOriginAllowed` a function to validate the `Origin` header of the request
  - `accessControlAllowHeaders` control the [`Access-Control-Allow-Headers`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers) header. **Defaults to `['origin', 'content-type', 'accept', 'authorization']`**
  - `accessControlAllowMethods` control the [`Access-Control-Allow-Methods`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods) header. **Defaults to `['GET', 'OPTIONS', 'HEAD']`**
  - `accessControlMaxAge` control the [`Access-Control-Max-Age`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age) header. **Defaults to `3600` seconds.**
  - `accessControlAllowCredentials` control the [`Access-Control-Allow-Credentials`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials) header. **Defaults to `false`.**
  - `accessControlExposeHeaders` control the [`Access-Control-Expose-Headers`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers) header. **Defaults to `[]`.**

- [`cors`](./src/withCors.ts) is a utility function that adds CORS headers to a `Response`; it takes in the following options:

  ```ts
  export interface CorsOptions extends WithCorsOptions {
    response: Response
    accessControlAllowOrigin?: string
  }
  ```

  **Note:** it extends the `WithCorsOptions`

  This function is used by `withCors` where the `accessControlAllowOrigin` is set to the `Origin` header of the request.

## Additional resources:

- [MDN: CORS](https://developer.mozilla.org/en-US/docs/Glossary/CORS)

## Note:

If the `requestHandler` given to `withCors` or the `response` given to `cors` already contains Access-Control-\* Headers, they will be overriden with whatever config is given.
npm package: @p-j/eapi-middleware-errorhandler
Description: An Error Handler middleware to work within an EAPI app. Check worker-eapi-template for context.
Author: Jérémie Parker
Latest version: 1.1.1

# `@p-j/eapi-middleware-errorhandler`

> A middleware to handle exceptions within your handler & middleware stack.
> It can be configured to log the error to an external service or to render the Error to the response.

## Installation

- From the NPM registry

```sh
npm install @p-j/eapi-middleware-errorhandler
# or
yarn add @p-j/eapi-middleware-errorhandler
```

## API

[`withErrorHandler`](./src/withErrorHandler.ts) is a [Middleware Factory](../eapi-types/index.d.ts); it takes the following options:

```ts
export interface WithErrorHandlerOptions {
  enableDebug?: boolean
  forwardError?: ErrorForwarder
}
```

As noted above, none of the options are required.

- `enableDebug` enable the usage of `?debug=true` to get the stack trace to appear in the response instead of an empty HTTP 500 response.
- `forwardError` you may want to log exceptions with an external service, you can do so by providing a function here.
npm package: @p-j/eapi-util-applymiddlewares
Description: EAPI utility function that make the whole middleware stack work.
Author: Jérémie Parker
Latest version: 1.1.0

# `@p-j/eapi-util-applymiddlewares`

> Apply a list of middlwares to a given request handler, returning an enhanced request handler

## Installation

- From the NPM registry

```sh
npm install @p-j/eapi-util-applymiddlewares
# or
yarn add @p-j/eapi-util-applymiddlewares
```

## Usage

```ts
import { applyMiddlewares } from '@p-j/eapi-util-applymiddlewares'
import { withCache } from '@p-j/eapi-middleware-cache'
import { withErrorHandler } from '@p-j/eapi-middleware-errorhandler'

const requestHandler: RequestHandler = (context) => new Response('Hello World')

const finaleHandler = applyMiddlewares(
  requestHandler, // first argument is the original request handler
  withErrorHandler({ enableDebug: true }), // following arguments are as many middleware as you'd like
  withCache({
    cacheControl: `public, max-age=${TTL_30MINUTES}`,
    cdnTtl: TTL_30MINUTES,
  }),
)
```

**Note on the order of application for the middlewares:**

```ts
applyMiddlewares(handler, a, b, c)
// is the same as
a(b(c(handler)))
```

So for instance, if you want to catch all exceptions within the middleware stack, you want to put the Error middleware first in the list of middlewares, as shown above.

Generally speaking, you want to start with "generic middleware" first and end with the "specific ones".
npm package: @p-j/eapi-util-fetcheventhandler
Description: EAPI utility function that make the whole middleware stack work.
Author: Jérémie Parker
Latest version: 1.1.0

# `@p-j/eapi-util-fetcheventhandler`

> This package provide a Fetch Event Handler factory that can be used in a multi-router setup.
>
> It's especially useful if you combine originless routes with traditional routes on the same project
>
> It also facilitate the application of "global" middlwares to all your routes.

## Installation

- From the NPM registry

```sh
npm install @p-j/eapi-util-fetcheventhandler
# or
yarn add @p-j/eapi-util-fetcheventhandler
```

## Usage

```ts
import { fetchEventHandler } from '@p-j/eapi-util-fetcheventhandler'
import { withErrorHandler } from '@p-j/eapi-middleware-errorhandler'

const requestHandler: RequestHandler = (context) => new Response('Hello World')
const matcher: RouteMatcher = (event) => { handler: requestHandler, param: {} }

const eventHandler = fetchEventHandler({
  matcher,
  originless: true,
  middlewares: [withErrorHandler()]
})

addEventListener('fetch', (event) => event.respondWith(fetchEventHandler(event)))
```

## Example with `tiny-request-router`

```ts
import { fetchEventHandler } from '@p-j/eapi-util-fetcheventhandler'
import { withErrorHandler } from '@p-j/eapi-middleware-errorhandler'

const requestHandler: RequestHandler = (context: RequestContext) => new Response('Hello World')

export const router = new Router()
router.all('/', requestHandler)

const matcher: RouteMatcher = (event: FetchEvent) => {
  const { pathname } = new URL(event.request.url)
  return router.match(event.request.method as Method, pathname)
}

export const fetchEventHandler = eventHandlerFactory({
  matcher,
  originless: true,
  middlewares: [withErrorHandler()],
})

addEventListener('fetch', (event) => event.respondWith(fetchEventHandler(event)))
```
npm package: @p-mcgowan/minimist
Description: parse argument options
Author: Pat McGowan
Latest version: 2.1.0

# minimist revived

Rebuild of [substack/minimist](https://github.com/substack/minimist) in typescript

parse argument options

This module is the guts of optimist's argument parser without all the
fanciful decoration.

# example

``` js
const argv = require('@p-mcgowan/minimist').minimist(process.argv.slice(2));
console.log(argv);
```

```typescript
import { minimist } from '@p-mcgowan/minimist';
const argv = minimist(process.argv.slice(2));
console.log(argv);
```

```
$ node example/parse.js -a beep -b boop
{ _: [], a: 'beep', b: 'boop' }
```

```
$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz
{ _: [ 'foo', 'bar', 'baz' ],
  x: 3,
  y: 4,
  n: 5,
  a: true,
  b: true,
  c: true,
  beep: 'boop' }
```

# security

Previous versions had a prototype pollution bug that could cause privilege
escalation in some circumstances when handling untrusted user input.

Please use version 1.2.3 or later: https://snyk.io/vuln/SNYK-JS-MINIMIST-559764

*note* the nested argument feature was removed - previously:
```typescript
const argv = minimist('-foo.bar.baz=10'.split(' '));
// would result in argv = { foo: { bar: { baz: 10 } } }
// now returns { 'foo.bar.baz': 10 }
```

# methods

``` js
var parseArgs = require('minimist')
```

## var argv = parseArgs(args, opts={})

Return an argument object `argv` populated with the array arguments from `args`.

`argv._` contains all the arguments that didn't have an option associated with
them.

Numeric-looking arguments will be returned as numbers unless `opts.string` or
`opts.boolean` is set for that argument name.

Any arguments after `'--'` will not be parsed and will end up in `argv._`.

options can be:

* `opts.string` - a string or array of strings argument names to always treat as
strings
* `opts.boolean` - a boolean, string or array of strings to always treat as
booleans. if `true` will treat all double hyphenated arguments without equal signs
as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`)
* `opts.alias` - an object mapping string names to strings or arrays of string
argument names to use as aliases
* `opts.default` - an object mapping string argument names to default values
* `opts.stopEarly` - when true, populate `argv._` with everything after the
first non-option
* `opts['--']` - when true, populate `argv._` with everything before the `--`
and `argv['--']` with everything after the `--`. Here's an example:

  ```
  > require('./')('one two three -- four five --six'.split(' '), { '--': true })
  { _: [ 'one', 'two', 'three' ],
    '--': [ 'four', 'five', '--six' ] }
  ```

  Note that with `opts['--']` set, parsing for arguments still stops after the
  `--`.

* `opts.unknown` - a function which is invoked with a command line parameter not
defined in the `opts` configuration object. If the function returns `false`, the
unknown option is not added to `argv`.

# install

With [npm](https://npmjs.org) do:

```
npm install minimist
```

# license

MIT
npm package: @p-sebastian/react-native-snap-kit
Description: TODO
Author: Sebastian Penafiel
Latest version: 1.0.3

# react-native-snap-kit

## Getting started

`$ npm install @p-sebastian/react-native-snap-kit --save`

### Or

`$ yarn add @p-sebastian/react-native-snap-kit`

### Mostly automatic installation

`$ react-native link @p-sebastian/react-native-snap-kit`

## Usage
```javascript
import SnapKit from 'react-native-snap-kit';

// TODO: What to do with the module?
SnapKit;
```
npm package: @p-t-a-p-1/me
Description: p-t-a-p-1's CLI Site
Author: p-t-a-p-1
Latest version: 0.1.3

# @p-t-a-p-1/me

npxで実行できるReact Ink製のCLIポートフォリオです。

- 実行: `npx @p-t-a-p-1/me`
- 要件: Node.js 24+

## GitHub Packages（右サイドバーの表示）

このリポジトリに紐づく npm パッケージを GitHub Packages に公開すると、リポジトリの右サイドバーに「Packages」が表示されます。公開は GitHub Actions から `GITHUB_TOKEN` で認証して行います。

- 公開ワークフロー: `.github/workflows/publish-gpr.yml`
- トリガー: `v*.*.*` タグの push または `workflow_dispatch`
- 認証: `NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}`（Actions での公開に推奨）

### 公開手順（タグで自動公開）

1. バージョンタグを作成して push（例）
   - `git tag v0.1.2 && git push origin v0.1.2`
2. Actions のジョブが走り、`npm publish` が GitHub Packages に対して実行されます。
3. リポジトリ右サイドバーに「Packages」が表示され、公開パッケージへリンクされます。

### ローカルからのインストール（任意）

ローカルで GitHub Packages を利用する場合は、Personal Access Token (classic) を `.npmrc` に設定します。

```
//npm.pkg.github.com/:_authToken=YOUR_TOKEN
```

その上で以下のようにインストールできます：

```
npm install @p-t-a-p-1/me --registry=https://npm.pkg.github.com
```

詳細は GitHub Docs を参照してください（npm レジストリの利用）: https://docs.github.com/ja/packages/working-with-a-github-packages-registry/working-with-the-npm-registry

## CI（Prepack 自動実行）

- GitHub Actions で `prepack` を自動実行します（`npm pack` 経由）。
- ワークフロー: `.github/workflows/prepack.yml`
- トリガー: `push` / `pull_request`（`main`）/ `workflow_dispatch`
- ステップ:
  - Node `18.x` をセットアップし `npm ci` を実行
  - `npm pack` を実行（`prepack` によりビルド）
  - 生成された `*.tgz` をアーティファクト `prepack-tarball` としてアップロード

### 手動実行（workflow_dispatch）

1. GitHub Actions タブで `Prepack CI` を選択
2. `Run workflow` をクリック
3. 成功後、`Artifacts` から `prepack-tarball` をダウンロードして検証