@astropub/assert

0.1.2 • Public • Published

Astro Import Assertions

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

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

Open in StackBlitz

Configuration

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

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!.

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

Code from Squoosh! is licensed under the Apache-2.0 License, Copyright Google Inc.

Dependents (0)

Package Sidebar

Install

npm i @astropub/assert

Weekly Downloads

1

Version

0.1.2

License

CC0-1.0

Unpacked Size

15.9 kB

Total Files

10

Last publish

Collaborators

  • jonathantneal