open-index/open-npm huggingface dataset:
npm package: @nimpl/ab-tests
Description: A package for conducting A/B tests on a website using middleware
Author: Savelyev Alexander
Latest version: 0.2.1

# @nimpl/ab-tests

A package for conducting A/B tests on a website using middleware. The package's API is inspired by the familiar APIs from next.js.

Visit https://nimpl.dev/docs/ab-tests to view the full documentation.

## Installation

**Using npm:**

```bash
npm i @nimpl/ab-tests
```

**Using yarn:**

```bash
yarn add @nimpl/ab-tests
```

## Additional

Please consider giving a star if you like it, it shows that the package is useful and helps continue work on this and other packages.

Create issues for identified issues, desired getters, or various improvements.

## License

[MIT](https://github.com/vordgi/nimpl-ab-tests/blob/main/LICENSE)
npm package: @nimpl/config
Description: The package allows for convenient management of application configuration in Next.js environments
Author: Savelyev Alexander
Latest version: 0.7.1

# @nimpl/config

The package adding support for configuration for each possible next.js environment (*build, server, client, and edge*)

Visit https://nimpl.dev/docs/config to view the full documentation.

## Installation

**Using npm:**
```bash
npm i @nimpl/config
```

**Using yarn:**
```bash
yarn add @nimpl/config
```

## License

[MIT](https://github.com/vordgi/nimpl-config/blob/main/LICENSE)
npm package: @nimpl/context
Description: Implementation of server contexts in React Server Components without switching to SSR
Author: Alex Savelyev
Latest version: 1.2.2

# @nimpl/context

Implementation of server contexts in React Server Components without switching to SSR

Before using the library, read the [Possible Issues](https://nimpl.dev/docs/context#possible-issues)

Visit https://nimpl.dev/docs/context to view the full documentation.

## Installation

**Using npm:**

```bash
npm i @nimpl/context
```

**Using yarn:**

```bash
yarn add @nimpl/context
```

## Usage

```tsx
// stores/app-store/contexts.server.tsx
import createServerContext from "@nimpl/context/create-server-context";
export const AppServerContext = createServerContext<{ data: string | null }>({
  data: null,
});

// components/parent-component
import { AppServerContext } from "@/stores/app-store/contexts.server";
import { ChildComponent } from "./child-component";

export const ParentComponent = () => (
  {/* Same as <AppServerContext.Provider /> */}
  <AppServerContext value={{ data: "test" }}>
    <ChildComponent />
  </AppServerContext>
);

// components/child-component
import getServerContext from "@nimpl/context/get-server-context";
import { AppServerContext } from "@/stores/app-store/contexts.server";

export const ChildComponent = () => {
  const context = getServerContext(AppServerContext);

  return <div>{context.data}</div>;
};
```

## Stability

All context are covered with tests. Tests are run on every release and every 6 hours on the latest **Canary** version of `Next.js`.

In this way, you can be sure not only of the stability of the code, but also that if there is a breaking change in `Next.js`, this will immediately become known. _Even before the release of a stable version of `Next.js`._

## Examples

You can see examples in the [directory](https://github.com/alexdln/nimpl-context/tree/main/examples) of the repository.

## Additional

Please consider giving a star if you like it, it shows that the package is useful and helps continue work on this and other packages.

Create issues for identified issues, desired getters, or various improvements.

## License

[MIT](https://github.com/alexdln/nimpl-context/blob/main/LICENSE)
npm package: @nimpl/inio
Description: Utility for editing a group of JSON files
Author: Savelyev Alexander
Latest version: 1.1.0

# @nimpl/inio

Utility for editing a group of JSON files

## Features

Creation - create a key that will be added to all files that match the pattern

Editing - correct the values of nested keys in each file

Deletion - delete the key from all files

## Installation

```bash
npm install @nimpl/inio -g
```

## Usage

```bash
inio
```

## Configuration

To configure **inio**, create an `inio.config.js` file in the `.json` files directory

**Options**

`pattern` - the pattern by which to search for files. The pattern should contain a dynamic part `<key>`, f.e. "`./terms/<key>.json`" (by default "`./<key>.json`")

Now simply call `inio` in the terminal:
```bash
inio
```

You can also specify the path to the config by setting the `CONFIG_PATH` environment variable:
```bash
CONFIG_PATH="../../inio.config.js" inio
```

You can also pass package options through environment variables, converting options to **UPPER_SNAKE_CASE** format:
```bash
PATTERN="./terms/<key>.json" inio
```

Where `./terms/<key>.json` - is the pattern of files that you want to edit, with the following file structure:

```
root
--langs
----en.json
----de.json
----fr.json
```

The pattern should contain `<key>` - this is a dynamic parameter, equivalent to `*` in glob rules.

The utility will start a local server, through which all your file changes will subsequently occur.

Then open [inio.nimpl.tech](https://inio.nimpl.tech/) and edit the files through a comfortable interface.

![application screenshot](docs/app.png)

## Additional

Please consider giving a star if you like it, it shows that the package is useful and helps continue work on this and other packages.

Create tasks with wishes, ideas, difficulties, etc. All of them will definitely be considered and thought over.

## License

[MIT](https://github.com/vordgi/nimpl-inio/blob/main/LICENSE)
npm package: @nimpl/middleware-chain
Description: The package allows you to create a chain of native next.js middlewares without any modifications
Author: Savelyev Alexander
Latest version: 0.5.2

# @nimpl/middleware-chain

The package allows you to create a chain of native next.js middlewares without any modifications (_i.e., you can add any ready-made middleware to the chain_)

```ts
// middleware.ts
import { chain } from "@nimpl/middleware-chain";

export default chain([
  [intlMiddleware, { exclude: /^\/private(\/.*)?$/ }],
  authMiddleware,
  (req, event) => {
    event.waitUntil(
      fetch("https://my-analytics-platform.com", {
        method: "POST",
        body: JSON.stringify({ pathname: req.nextUrl.pathname }),
      })
    );
    return NextResponse.next();
  },
  customMiddleware,
]);
```

Visit https://nimpl.dev/docs/middleware-chain to view the full documentation.

## Installation

**Using npm:**

```bash
npm i @nimpl/middleware-chain
```

**Using yarn:**

```bash
yarn add @nimpl/middleware-chain
```

## Motivation

All existing solutions work through their own APIs - made under the style of express or in their own vision. They are useful, well implemented, and convenient. But only in cases where you can update every used middleware.

However, there are many situations where you need to add already prepared solutions. Usually, in the issues of these solutions, you can find “support to add a chain package A, working with chain package B”.

This package follows a plug and play format. In the best traditions of the previous next.js.

This is not Koa and not Express, this is a package for next.js, in its unique style, in the format of its API.

## Examples

- [Base example](https://github.com/vordgi/nimpl-middleware-chain/tree/main/examples/base).
- [next-auth + next-intl example](https://github.com/vordgi/nimpl-middleware-chain/tree/main/examples/auth-intl).

## Development

Read about working on the package and making changes on the contribution page

## Additional

Please consider giving a star if you like it, it shows that the package is useful and helps me continue work on this and other packages.

Create issues with wishes, ideas, difficulties, etc. All of them will definitely be considered and thought over.

## License

[MIT](https://github.com/vordgi/nimpl-middleware-chain/blob/main/LICENSE)
npm package: @nimpl/path-parser
Description: Helper for next.js-styled pathname parsing (f.e. /(site)/docs/[key]) to get dynamic params
Author: Savelyev Alexander
Latest version: 1.0.1

# @nimpl/path-parser

Helper for next.js-styled pathname parsing (f.e. /(site)/docs/[key]) to get dynamic params

Visit https://nimpl.dev/docs/path-parser to view the full documentation.

## Installation

**Using npm:**

```bash
npm i @nimpl/path-parser
```

**Using yarn:**

```bash
yarn add @nimpl/path-parser
```

## Usage

```ts
import { parse } from "@nimpl/path-parser";

// ...

const params = parse("/docs/path-parser", "/(site)/docs/[key]"); // { key: 'path-parser' }
const { segments } = parse("/docs/path-parser", "/(site)/[[...segments]]"); // { segments: ['docs', 'path-parser'] }
```

## Additional

Please consider giving a star if you like it, it will help promote the implementation in the eyes of the Next.js team. This also motivates the author to continue working on this and other solutions ❤️

Create issues with wishes, ideas, difficulties, etc. All of them will definitely be considered and thought over.
npm package: @nimpl/proxy-chain
Description: Create a chain of native Next.js proxies seamlessly, without changing any existing proxy code
Author: Alex Savelyev
Latest version: 1.0.1

# @nimpl/proxy-chain

The package allows you to create a chain of native next.js proxies without any modifications (_i.e., you can add any ready-made proxy to the chain_)

```ts filename="proxy.ts"
// proxy.ts
import { chain } from "@nimpl/proxy-chain";

export default chain([
  [intlProxy, { exclude: /^\/private(\/.*)?$/ }],
  authProxy,
  (req, event) => {
    event.waitUntil(
      fetch("https://my-analytics-platform.com", {
        method: "POST",
        body: JSON.stringify({ pathname: req.nextUrl.pathname }),
      })
    );
    return NextResponse.next();
  },
  customProxy,
]);
```

Visit https://nimpl.dev/docs/proxy-chain to view the full documentation.

## Compatibility

The utility is fully compatible with **all versions of Next.js** that support middleware/proxy.

If you're using a version **below 16.0.0**, create a `middleware.ts` instead of `proxy.ts` file:

```ts filename="middleware.ts"
import { chain } from "@nimpl/proxy-chain";
import { NextRequest, NextResponse, NextFetchEvent } from "next/types";

export const middleware = chain<NextRequest, NextResponse, NextFetchEvent>([
  // ...
]);
```

> [!TIP]
> Explicitly pass the types NextRequest, NextResponse, and NextFetchEvent as generics to the chain function to ensure proper type safety and autocompletion.

## Installation

**Using npm:**

```bash
npm i @nimpl/proxy-chain
```

**Using yarn:**

```bash
yarn add @nimpl/proxy-chain
```

## Motivation

All existing solutions work through their own APIs - made under the style of express or in their own vision. They are useful, well implemented, and convenient. But only in cases where you can update every used proxy.

However, there are many situations where you need to add already prepared solutions. Usually, in the issues of these solutions, you can find “support to add a chain package A, working with chain package B”.

This package follows a plug and play format. In the best traditions of the previous next.js.

This is not Koa and not Express, this is a package for next.js, in its unique style, in the format of its API.

## Examples

- [Base example](https://github.com/alexdln/nimpl-proxy-chain/tree/main/examples/base).
- [next-auth + next-intl example](https://github.com/alexdln/nimpl-proxy-chain/tree/main/examples/auth-intl).
- [next-auth5 + next-intl example](https://github.com/alexdln/nimpl-proxy-chain/tree/main/examples/auth5-intl).

## Development

Read about working on the package and making changes on the [contribution page](https://nimpl.dev/contribution)

## Additional

Please consider giving a star if you like it, it shows that the package is useful and helps me continue work on this and other packages.

Create issues with wishes, ideas, difficulties, etc. All of them will definitely be considered and thought over.

## License

[MIT](https://github.com/alexdln/nimpl-proxy-chain/blob/main/LICENSE)
npm package: @nimpl/router
Description: Edge router for next.js apps (i18n, basePath, rewrites, redirects)
Author: Alex Savelyev
Latest version: 1.0.2

# @nimpl/router

Edge router for next.js apps. Allows you to configure rewrites, redirects, i18n and basePath at the middleware level instead of `next.config.js`

Visit https://nimpl.dev/docs/router to view the full documentation.

```js
import { createMiddleware } from "@nimpl/router";

export const middleware = createMiddleware({
  redirects: [
    {
      source: "/old",
      destination: "/",
      permanent: false,
    },
  ],
  rewrites: [
    {
      source: "/home",
      destination: "/",
      locale: false,
    },
  ],
  basePath: "/doc",
  i18n: {
    defaultLocale: "en",
    locales: ["en", "de"],
  },
});
```

## Installation

**Using npm:**

```bash
npm i @nimpl/router
```

**Using yarn:**

```bash
yarn add @nimpl/router
```

## Additional

Please consider giving a star if you like it, it shows that the package is useful and helps continue work on this and other packages.

Create issues with wishes, ideas, difficulties, etc. All of them will definitely be considered and thought over.

## License

[MIT](https://github.com/alexdln/nimpl-router/blob/main/LICENSE)
npm package: @nimpl/versioner
Description: A package for versioning your next.js application
Author: Savelyev Alexander
Latest version: 0.0.1

# @nimpl/versioner

A package for versioning your next.js application.

What it will do:

1. Clones the entire contents of the `src` directory (*except pages*) for your specified versions to the `src/versions/<VERSION>/*` directory;
1. Clones all pages for your specified versions from the `src/pages` path to the `src/pages/versions/<VERSION>/*` directory;
1. Clones all pages for your specified versions from the `src/app` path to the `src/app/versions/<VERSION>/*` directory;
1. Updates the import paths from src to versioned for pages.

## Notes

At the moment, the package does not cover all needs.

For example: it does not update the link hrefs to versioned pages, works with files inside src and does not know how to update dynamic imports to versioned.

Overall, this is more of an experiment to see how versioning can be done in a next.js application. If you think this approach is viable - please star it and write about your ideas or wishes in the package's issues or discussions.

In general, I would prefer the build in different branches and subsequent deployment to subdomains. If in your case there is a need for all versions as a single application - please also tell about your case. All your ideas will definitely be processed and thought over!

## Usage

**Install package globally:**
```bash
npm i @nimpl/versioner -g
```

**Run package:**
```bash
versioner
```

## Configuration

Before launching the package, you need to set up the configuration. For this, create a `versioner.config.js` file at the root of your next.js application.

Example of a file:
```js
module.exports = {
    git: {
        token: "example-git-token",
        userName: "vordgi",
        projectName: "nimpl-docs",
    },
    versionsDir: "versions",
    versions: [
        {
            ref: "ea9ec25870071d1cfa0ea83121a3a5979fa34baa",
            version: "0.1.3",
        },
    ],
    aliases: {
        "@/*": ["./src/*"],
    },
};
```

`git.token` - [personal access token](https://docs.github.com/en/rest/authentication/authenticating-to-the-rest-api#authenticating-with-a-personal-access-token) for the github project;
`git.userName` and `git.project` - user name and project key in github;
`versionsDir` - the subpath into which versions will be recorded;
`versions` - the list of versions for which files need to be cloned;
`versions[number].ref` - the commit hash or branch of the required version;
`versions[number].version` - version key, by which files will be saved;
`aliases` - object of aliases for automatic import replacement.

## License

[MIT](https://github.com/vordgi/nimpl-versioner/blob/main/LICENSE)