open-index/open-npm huggingface dataset:
npm package: @hazae41/request-idle-callback-polyfill
Description: Polyfill for requestIdleCallback
Author: hazae41
Latest version: 1.0.0

# requestIdleCallback polyfill

Polyfill for `requestIdleCallback`

```bash
npm install @hazae41/request-idle-callback-polyfill
```

[**📦 NPM**](https://www.npmjs.com/package/@hazae41/request-idle-callback-polyfill)

## Features
- ESModules and CommonJS
- No external dependency
- Unit-tested
- `requestIdleCallback` is polyfilled as `setTimeout` if not available

## Usage

### How?

ESModules 

```tsx
import "@hazae41/request-idle-callback-polyfill"
```

CommonJS

```tsx
require("@hazae41/request-idle-callback-polyfill")
```

### Where? 

You can import the polyfill **in your project entry file** or **in a specific file**, you just need to import it before anything that requires `requestIdleCallback`

(e.g. For a Next.js app, it can be in `_app.js`)

```tsx
/**
 * This polyfill at the top
 **/
import "@hazae41/request-idle-callback-polyfill"

/**
 * Your imports that requires requestIdleCallback to work
 **/
import { a } from "a"
import { b } from "./b.js"

/**
 * Your code that requires requestIdleCallback to work
 **/
using x = a
```
npm package: @hazae41/rewind
Description: Just-in-time Tailwind compiler but supply-chain hardened
Author: hazae41
Latest version: 2.3.12

# Rewind

Just-in-time Tailwind compiler but supply-chain hardened

```bash
npm install @hazae41/rewind
```

```bash
deno install jsr:@hazae41/rewind
```

[**📦 NPM**](https://www.npmjs.com/package/@hazae41/rewind) • [**📦 JSR**](https://jsr.io/@hazae41/rewind)

## Features

### Current features
- 100% TypeScript and ESM
- No external dependencies
- Works with any framework
- Just-in-time rendering
- Prerender and hydrate

## Why

Look at the dependencies graph of the average Tailwind library

## Usage

Client-side any framework (just-in-time rendering)

```tsx
await new Rewind(document).render()

// document now has a <style> with all your classes

// it will automatically update when your classes are modified
```

Client-side any React framework (just-in-time rendering)

```tsx
import { Rewind } from "@hazae41/rewind"
import { useEffect } from "react"

export default function App() {

  useEffect(() => {
    await new Rewind(document).render()

    // document now has a <style> with all your classes

    // it will automatically update when your classes are modified
  }, [])

  return <div className="text-2xl">
    Hello world
  </div>
}
```

Client-side pure React (just-in-time rendering)

```tsx
import { Rewind } from "@hazae41/rewind"
import { createRoot } from "react-dom/client"

function App() {
  return <div className="text-2xl">Hello world</div>
}

await new Rewind(document).render()

createRoot(document.body).render(<App />)
```

Client-side pure React with SSG (prerendering and hydration)

```tsx
import { Rewind } from "@hazae41/rewind"
import { hydrateRoot } from "react-dom/static"

function App() {
  return <div className="text-2xl">Hello world</div>
}

if (client) {
  await new Rewind(document).hydrate()
  hydrateRoot(document.body, <App />)
}

if (server) {
  await new Rewind(document).prerender()
  document.body = prerenderToString(<App />)
}
```

Server-side pure React to HTML (prerendering)

```tsx
import { Rewind } from "@hazae41/rewind"
import { DOMParser, XMLSerializer } from "..."
import { renderToString } from "react-dom/static"

function App() {
  return <div className="text-2xl">Hello world</div>
}

const html = renderToString(<App />)

const document = new DOMParser().parseFromString(html, "text/html")

await new Rewind(document).prerender()

const html2 = new XMLSerializer().serializeToString(document)
```