# vercel-skew-protection

> [![npm version][npm-version-src]][npm-version-href] [![Codecov][codecov-src]][codecov-href]

Latest version **0.0.1** (published 2023-09-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install vercel-skew-protection
pnpm add vercel-skew-protection
yarn add vercel-skew-protection
bun add vercel-skew-protection
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2023-09-22 |
| First published | 2023-09-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 44.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | ryoid |
| Keywords | vercel, skew, protection, vite, unplugin, webpack, rollup, transform, deployment |

## Links

- npm: https://www.npmjs.com/package/vercel-skew-protection
- Repository: https://github.com/ryoid/vercel-skew-protection
- Homepage: https://github.com/ryoid/vercel-skew-protection#readme
- Issues: https://github.com/ryoid/vercel-skew-protection/issues
- npm.io page: https://npm.io/package/vercel-skew-protection

## Dependencies (5)

- [magicast](https://npm.io/package/magicast.md) ^0.3.0
- [unplugin](https://npm.io/package/unplugin.md) ^1.4.0
- [@babel/types](https://npm.io/package/@babel/types.md) ^7.22.19
- [magic-string](https://npm.io/package/magic-string.md) ^0.30.3
- [es-module-lexer](https://npm.io/package/es-module-lexer.md) ^1.3.1

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2023-09-22

## README

# Vercel Skew Protection

[![npm version][npm-version-src]][npm-version-href]
[![Codecov][codecov-src]][codecov-href]

Bringing [Vercel's Skew Protection](https://vercel.com/blog/version-skew-protection) beyond Nextjs with a Vite plugin.

🚧 Currently only tested with Solidjs (SolidStart) on Vite.

Based on [original experimentation](https://github.com/ryoid/solid-vercel-skew-protection), also check out the accompanying [initial blog post](https://ryoid.dev/blog/solid-vercel-skew-protection) to learn how this works.

## Install

```bash
npm i vercel-skew-protection
```

<details>
<summary>Vite</summary><br>

```ts
// vite.config.ts
import SkewProtection from "vercel-skew-protection/vite";

export default defineConfig({
  plugins: [SkewProtection()],
});
```

Example: [`playground/`](./playground/)

<br></details>

<details>
<summary>Rollup</summary><br>

```ts
// rollup.config.js
import SkewProtection from "vercel-skew-protection/rollup";

export default {
  plugins: [SkewProtection()],
};
```

<br></details>

<details>
<summary>Webpack</summary><br>

```ts
// webpack.config.js
module.exports = {
  /* ... */
  plugins: [require("vercel-skew-protection/webpack")()],
};
```

<br></details>

<details>
<summary>Nuxt</summary><br>

```ts
// nuxt.config.js
export default defineNuxtConfig({
  modules: [
    [
      "vercel-skew-protection/nuxt",
      {
        /* options */
      },
    ],
  ],
});
```

> This module works for both Nuxt 2 and [Nuxt Vite](https://github.com/nuxt/vite)

<br></details>

<details>
<summary>Vue CLI</summary><br>

```ts
// vue.config.js
module.exports = {
  configureWebpack: {
    plugins: [
      require("vercel-skew-protection/webpack")({
        /* options */
      }),
    ],
  },
};
```

<br></details>

<details>
<summary>esbuild</summary><br>

```ts
// esbuild.config.js
import { build } from "esbuild";
import SkewProtection from "vercel-skew-protection/esbuild";

build({
  plugins: [SkewProtection()],
});
```

<br></details>

## Development

- Clone this repository
- Install dependencies using `pnpm install`
- Run interactive tests using `pnpm play`

## License

Published under [MIT License](./LICENSE).

<!-- Badges -->

[npm-version-src]: https://img.shields.io/npm/v/vercel-skew-protection?style=flat&colorA=18181B&colorB=F0DB4F
[npm-version-href]: https://npmjs.com/package/vercel-skew-protection
[codecov-src]: https://img.shields.io/codecov/c/gh/ryoid/vercel-skew-protection/main?style=flat&colorA=18181B&colorB=F0DB4F
[codecov-href]: https://codecov.io/gh/ryoid/vercel-skew-protection

---
_Source: https://npm.io/package/vercel-skew-protection · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
