# @astropub/assert

> ```sh npm install @astropub/assert ```

Latest version **0.1.2** (published 2022-01-12) · CC0-1.0 license · 0 weekly downloads

## Install

```sh
npm install @astropub/assert
pnpm add @astropub/assert
yarn add @astropub/assert
bun add @astropub/assert
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2022-01-12 |
| First published | 2022-01-10 |
| Weekly downloads | 0 |
| License | CC0-1.0 |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 0 |
| Unpacked size | 15.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jonathan Neal |
| Maintainers | jonathantneal |
| Keywords | assert, assertion, assertions, asserts, astro, import, imports, rollup, vite |

## Links

- npm: https://www.npmjs.com/package/@astropub/assert
- Repository: https://github.com/astro-community/assert
- Homepage: https://github.com/astro-community/assert#readme
- Issues: https://github.com/astro-community/assert/issues
- npm.io page: https://npm.io/package/@astropub/assert

## 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.1.2 (latest) — 2022-01-12
- 0.1.1 — 2022-01-11
- 0.1.0 — 2022-01-10

## README

# Astro Import Assertions

```sh
npm install @astropub/assert
```

```js
// astro.config.js
import { assertPlugin } from '@astropub/assert'

export default {
  vite: {
    plugins: [
      assertPlugin()
    ]
  }
}
```

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/astro-community/assert)



## Configuration

You can pass in special handlers for `load` and `transform` when imports with assertions are encountered.

```js
import { assertions } from '@astropub/assert'

// astro.config.js
export default {
  vite: {
    plugins: [
      load(id, assert) {
        console.log(assert)
        // e.g. { type: "json" }
        // e.g. { type: "react-component", client: "load" }
      }
    ]
  }
}
```

### `load(id, assertions, )



## License

**Codecs** is a remix of [Squoosh!](https://github.com/GoogleChromeLabs/squoosh). 

Code original to this project is licensed under the CC0-1.0 License.

Code from [Squoosh!](https://github.com/GoogleChromeLabs/squoosh) is licensed under the Apache-2.0 License, Copyright Google Inc.

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