open-index/open-npm huggingface dataset:
npm package: @intrinsic-finance/redux-multicall
Description: A React + Redux lib for fetching and caching chain state via the MultiCall contract
Latest version: 1.0.0

# MultiCall

A React + Redux library for fetching, batching, and caching chain state via the MultiCall contract.

## Setup

`yarn add @intrinsic-finance/multicall` or `npm install @intrinsic-finance/multicall`

## Usage

The usage of this library is similar to [RTK Query](https://redux-toolkit.js.org/rtk-query/overview#create-an-api-slice).

```js
// Somewhere in your app
export const multicall = createMulticall({ reducerPath: 'multicall' })

// In your store's root reducer
export const rootReducer = combineReducers({
  // Other reducers
  [multicall.reducerPath]: multicall.reducer
})
```

To use the updater, you'll need an instance of the Intrinsic Multicall2 contract:

```js
import { abi as MulticallABI } from '@intrinsic-finance/periphery/artifacts/contracts/lens/IntrinsicInterfaceMulticall.sol/IntrinsicInterfaceMulticall.json'
import { Contract } from 'ethers'
import { IntrinsicInterfaceMulticall } from './abi/types'

const multicall2Contract = new Contract(address, MulticallABI, provider) as IntrinsicInterfaceMulticall
```

## Alpha software

The latest version of the SDK is used in production in the Intrinsic Interface,
but it is considered Alpha software and may contain bugs or change significantly between patch versions.
If you have questions about how to use the SDK, please reach out in the `#dev-chat` channel of the Discord.
Pull requests welcome!
npm package: @intrinsic-network/router-sdk
Description: An sdk for routing swaps using Intrinsic.
Latest version: 1.3.1

# Alpha software

The latest version of the SDK is used in production in the Uniswap Interface,
but it is considered Alpha software and may contain bugs or change significantly between patch versions.
If you have questions about how to use the SDK, please reach out in the `#dev-chat` channel of the Discord.
Pull requests welcome!

# Uniswap Swap Router SDK

This SDK is meant to facilitate interactions with the contracts in [swap-router-contracts](https://github.com/Uniswap/swap-router-contracts).
npm package: @intrinsic-network/sdk-core
Description: ⚒️ An SDK for building applications on top of Intrinsic
Latest version: 1.0.0

# Uniswap SDK Core

[![Unit Tests](https://github.com/Uniswap/uniswap-sdk-core/workflows/Unit%20Tests/badge.svg)](https://github.com/Uniswap/uniswap-sdk-core/actions?query=workflow%3A%22Unit+Tests%22)
[![Lint](https://github.com/Uniswap/uniswap-sdk-core/workflows/Lint/badge.svg)](https://github.com/Uniswap/uniswap-sdk-core/actions?query=workflow%3ALint)
[![npm version](https://img.shields.io/npm/v/@uniswap/sdk-core/latest.svg)](https://www.npmjs.com/package/@uniswap/sdk-core/v/latest)
[![npm bundle size (scoped version)](https://img.shields.io/bundlephobia/minzip/@uniswap/sdk-core/latest.svg)](https://bundlephobia.com/result?p=@uniswap/sdk-core@latest)

This code is shared across Uniswap TypeScript SDKs.
npm package: @intrnl/babel-plugin-transform-jsx-to-string
Description: Babel plugin for transforming JSX to HTML string equivalent
Author: intrnl
Latest version: 0.2.5
Deprecated: use @intrnl/jsx-to-html or @intrnl/jsx-to-string

# babel-plugin-transform-jsx-to-string

Transforms JSX into HTML string equivalent

```jsx
function App () {
  return (
    <>
      <div>Hello world!</div>
      <Counter count={0} />
    </>
  );
}

function Counter ({ count }) {
  return (
    <x-counter>
      <div>count: <span x-target='x-counter.display'>{count}</span></div>
      <button x-action='click:x-counter#increment'>+</button>
      <button x-action='click:x-counter#decrement'>-</button>
    </x-counter>
  );
}
```

```js
import { html as $html, text as $text } from '@intrnl/babel-plugin-transform-jsx-to-string/runtime';

function App() {
  return $html('<div>Hello world!</div>' + $text(Counter({ count: 0 })) + '');
}

function Counter({ count }) {
  return $html('<x-counter><div>count: <span x-target="x-counter.display">' + $text(count) + '</span></div><button x-action="click:x-counter#increment">+</button><button x-action="click:x-counter#decrement">-</button></x-counter>');
}
```
npm package: @intrnl/bundl
Description: Effortless, no-config library bundler
Author: intrnl
Latest version: 0.2.0

# `bundl`

Effortless, no-config library bundler.

- Bundles your source code into a single ESM and CommonJS file
- Transpiles TypeScript, with the help of [esbuild][1]
- Does not bundle dependencies

*If you're looking for something more, you can try [microbundle][2]
or [tsdx][3] instead.*

## Install

```sh
npm install --save-dev @intrnl/bundl
# pnpm install --save-dev @intrnl/bundl
# yarn add --dev @intrnl/bundl
```

Add `source` field into your `package.json` that leads to the entry file for
your library, and either a `main` or `module` field for the output, then all
you need to do is...

```sh
# This is all you have to do!
bundl
```

## Configuration

There is really not much configuring to do aside from above, but you might be
interested in messing around with the output that it generates. All you need
is to add `bundl` field, which provides the following

- `target`  
  Environment target, defaults to `esnext`
- `minify`
  Whether the output should be minified, disabled by default
- `jsxFactory`  
  JSX factory to use, defaults to `React.createElement`
- `jsxFragment`
  JSX fragment factory to use, defaults to `React.Fragment`


[1]: https://github.com/evanw/esbuild
[2]: https://github.com/developit/microbundle
[3]: https://github.com/formium/tsdx
npm package: @intrnl/chunked-uint8-iterator
Description: Create chunked iterator from Uint8Array iterables
Author: intrnl
Latest version: 0.2.0
Deprecated: I don't maintain this anymore

# chunked-uint8-iterator

Create chunked iterator from Uint8Array iterables

```js
import { createReadStream } from 'node:fs';
import chunked from '@intrnl/chunked-uint8-iterator';

let stream = createReadStream('./archive.zip');

for (let values of chunked(stream)) {
  // ...
}
```

This will default to yielding 512 bytes of chunks at a time, you can configure
this by passing a number as the second argument.

```js
for (let values of chunked(stream, 1024)) {
  // ...
}
```

If the iterable ends with less than the given chunk size, it will yield the
remaining bytes as is without padding.

## Using web streams

Your web browser might not support using ReadableStream directly as an async
iterable, if that's the case, this library provides `createStreamIterator`
which you can pass directly into `chunked`.


```js
import chunked, { createStreamIterator } from '@intrnl/chunked-uint8-iterator';

let stream = file.stream();

for (let chunks of chunked(createStreamIterator(stream))) {
  // ...
}
```
npm package: @intrnl/deno-glob-to-regexp
Description: Glob to regular expressions, taken from Deno's standard library
Author: intrnl
Latest version: 0.1.2

# `deno-glob-to-regexp`

Converts glob to regular expressions, taken straight from Deno standard library.

## Installation

- npm: `npm install @intrnl/deno-glob-to-regexp`
- pnpm: `pnpm install @intrnl/deno-glob-to-regexp`
- yarn: `yarn add @intrnl/deno-glob-to-regexp`
npm package: @intrnl/dom-sanitize
Description: Lightweight DOM sanitization library
Author: intrnl
Latest version: 0.1.0

# dom-sanitize

Lightweight DOM sanitization library

```js
import { DEFAULT_OPTIONS, sanitize } from '@intrnl/dom-sanitize';

const result = sanitize(`<img src=x onerror=alert(1)//>`, DEFAULT_OPTIONS);

// `result` returns a DocumentFragment, you can convert this by creating a template element
const template = document.createElement('template');

// Append document fragment to another, this empties out `result`
template.content.appendChild(result);

// `<img src="x">`
template.innerHTML;
```
npm package: @intrnl/dotprop
Description: Safely access or modify object properties with dot-notated path
Author: intrnl
Latest version: 0.1.1

# `dotprop`

Safely access or modify object properties with dot-notated path

## Installation

- Install it with your package manager of choice
  - npm: `npm i @intrnl/dotprop`
  - pnpm: `pnpm i @intrnl/dotprop`
  - yarn `yarn add @intrnl/dotprop`

## Usage

```js
import { get, set, del, has } from '@intrnl/dotprop';

let obj = {
  foo: {
    bar: 'baz',
    'baz.baz': 'foo foo',
  },
};

// Get property
get(obj, 'foo.bar') // -> 'baz'
get(obj, 'foo.foo.bar') // -> undefined
get(obj, 'foo.foo.bar', 'default value') // -> 'default value'
get(obj, 'foo.baz\\.baz') // 'foo foo'

// Set property
set(obj, 'baz', 'foo') // -> 'foo'
obj // -> { ..., baz: 'foo' }

set(obj, 'bar.bar.foo', 'horse') // -> 'horse'
obj // -> { ..., bar: { bar: { foo: 'horse' } } }

// Delete property
del(obj, 'bar') // -> true
obj // -> { foo: { ... }, baz: 'foo' }

// Has property
has(obj, 'bar') // -> false
has(obj, 'foo.baz\\.baz') // -> true
```
npm package: @intrnl/esbuild-plugin-svelte
Description: Compile Svelte components with esbuild
Author: intrnl
Latest version: 0.2.1

# esbuild-plugin-svelte

Compile Svelte components with esbuild

## Usage

```sh
npm install --save-dev @intrnl/esbuild-plugin-svelte
# pnpm install --save-dev @intrnl/esbuild-plugin-svelte
# yarn add --dev @intrnl/esbuild-plugin-svelte
```

```js
import esbuild from 'esbuild';
import { svelte } from '@intrnl/esbuild-plugin-svelte';

esbuild.build({
  bundle: true,
  // ...
  plugins: [
    svelte({
      // Enable built-in TypeScript preprocessing, defaults to true
      typescript: true,
      // Svelte preprocessors, make sure it is an array
      preprocess: [],
      // Svelte compiler options
      compilerOptions: {},
    }),
  ],
});
```
npm package: @intrnl/esbuild-plugin-vanilla-extract
Description: Fork of the official vanilla-extract esbuild plugin
Author: intrnl
Latest version: 0.3.1

Fork of the official esbuild plugin, with a few changes:

- Changes how generated CSS files are imported internally, this removes the
  noise in the sourcemap.
- Adds a basic filesystem cache.

| Upstream | Fork |
| --- | --- |
| ![image](https://user-images.githubusercontent.com/20620901/144454099-8ee62c2d-813a-4c02-aadd-c9f99a5a0cf7.png) | ![image](https://user-images.githubusercontent.com/20620901/144454140-02096baf-0435-4565-8811-bbab3aa46fba.png) |
npm package: @intrnl/estranspile
Description: Quickly transform source code with esbuild
Author: intrnl
Latest version: 0.1.0

# estranspile

Quickly transform source code with esbuild

- No bundling, only quick and dirty transpilation
- No import/export rewrite, append `.js` on your own!
- No JSX transformation

## Usage

```sh
npm install --save-dev @intrnl/estranspile
# pnpm install --save-dev @intrnl/estranspile
# yarn add --dev @intrnl/estranspile
```

```
estranspile [source] [output]
```

By default, it acts on `lib/` folder and outputs to `dist/` folder.
npm package: @intrnl/freak
Description: Lightweight React-like alternative
Author: intrnl
Latest version: 0.1.7
Deprecated: no

# freak

Lightweight React-like alternative

- Functional components only, no class component support
- No concurrent mode support

## Test

```
esbuild test/counter.jsx --bundle --outfile=test/_app.js --servedir=test --sourcemap
```
npm package: @intrnl/iterable-reader
Description: Convert Uint8Array iterables to Go-like Reader interface
Author: intrnl
Latest version: 0.2.0
Deprecated: I don't maintain this anymore

# iterable-reader

Convert Uint8Array iterables to Go-like Reader interface.

```js
import { createReadStream } from 'node:fs';
import { createIterableReader } from '@intrnl/iterable-reader';

let stream = createReadStream('./file.txt');
let reader = createIterableReader(stream);

let chunk = new Uint8Array(512);
await reader.read(chunk);
```
npm package: @intrnl/jsx-to-html
Description: Serialize JSX to HTML directly and nothing more
Author: intrnl
Latest version: 0.1.0

# jsx-to-html

Serialize JSX to HTML directly and nothing more, with fully typed JSX allowing for a nice experience.

## Usage

Configure `tsconfig.json` as follows:

```json
{
	"compilerOptions": {
		"jsx": "react-jsx",
		"jsxImportSource": "@intrnl/jsx-to-html"
	}
}
```

You can then use it to render JSX!

```tsx
import { type JSXNode, render } from '@intrnl/jsx-to-html';

const Card = (props: { children?: JSXNode; title?: string }) => {
	return (
		<div class="card">
			<div class="card__title">{props.title}</div>
			<div class="card__body">{props.children}</div>
		</div>
	);
};

const App = () => {
	return (
		<>
			<h1>Hello!</h1>
			<Card title="Card title">
				<p>We're inside a card!</p>
			</Card>
		</>
	);
};

const result = render(<App />);
// -> '<h1>Hello!</h1><div class="card"><div class="card__title"> ...'
```
npm package: @intrnl/jsx-to-string
Description: Babel plugin for transforming JSX to HTML string equivalent
Author: intrnl
Latest version: 0.1.6

# jsx-to-string

This is a VDOM-less variant of [`jsx-to-html`](https://codeberg.org/intrnl/jsx-to-html), using a Babel transform to directly transform JSX into a string.

It means that this following code:

```jsx
const Card = ({ title, children }) => {
	return (
		<div class="card">
			<div class="card__title">{title}</div>
			<div class="card__body">{children}</div>
		</div>
	);
};

const App = () => {
	return (
		<>
			<h1>Hello!</h1>
			<Card title="Card title">
				<p>We're inside a card!</p>
			</Card>
		</>
	);
};

const result = <App />;

result.value;
```

Will be transformed into something like this:

```js
import * as _ from '@intrnl/jsx-to-string/runtime';

const Card = ({ title, children }) => {
	return _.html(
		'<div class=card><div class=card__title>' +
			_.render(title) +
			'</div><div class=card__body>' +
			_.render(children) +
			'</div></div>',
	);
};

const App = () => {
	return _.html(
		'<h1>Hello!</h1>' +
			_.render(
				Card({
					title: 'Card title',
					children: _.html("<p>We're inside a card!</p>"),
				}),
			),
	);
};
const result = _.html(_.render(App({})));

result.value;
// '<h1>Hello!</h1><div class=card><div class=card__title>Card title</div> ...'
```

With most of the JSX being turned into string concatenations, it's super fast. Components are turned into eager function calls, and the returned JSX values can be used as is without having to call `render` or `renderToString` on it.

## Inserting raw HTML

Raw HTML insertion can be done by using the `html` function, this returns a
`TrustedHTML` instance which prevents the string from being sanitized.

```jsx
import { html } from '@intrnl/jsx-to-string';

const raw = html('<span>world</span>');
const result = <div>Hello {raw}</div>;

result.value;
// '<div>Hello <span>world</span></div>'
```
npm package: @intrnl/netlifydd
Description: A tool for quickly deploying prebuilt assets to Netlify
Author: intrnl
Latest version: 0.1.6

# netlifydd

A tool for quickly deploying prebuilt assets to Netlify.

## Why?

The official Netlify CLI has a ton of dependencies, a lot of which are
are unnecessary if you're just planning to deploy prebuilt assets.

## Getting started

```sh
# install `netlifydd`, preferably as a dev dependency of your project
$ npm install --save-dev @intrnl/netlifydd

# login to your Netlify account
$ npm exec netlifydd login

# link project folder to a Netlify site
$ npm exec netlifydd link

# create a deployment!
$ npm exec netlifydd deploy dist
```

### Single-Page Application setup

Add a file named `_redirects` on your asset directory with the following:

```
/*   /index.html   200
```

### Serverless and Edge Functions?

There's currently no plans to support deploying either serverless or edge
functions. You might be better off with the official Netlify CLI as it offers
you a development environment for working with them locally.

### Informative deployment info

Here's a shell script you can use to provide the Git commit and branch name used
for deployment.

```sh
#!/usr/bin/env bash

if [[ -n $(git status --porcelain) ]]; then
	echo 'Working directory is not clean'
	git status --short
	exit 1
fi

GIT_BRANCH=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD)
GIT_COMMIT=$(git rev-parse HEAD)
npm exec netlifydd deploy -m "${GIT_BRANCH} ${GIT_COMMIT}" dist/
```
npm package: @intrnl/node-worker-pool
Description: Offload heavy tasks to a pool of worker threads
Author: intrnl
Latest version: 0.1.6
Deprecated: deprecated

# `node-worker-pool`

Offload heavy tasks to a pool of worker threads.

Requires Node.js 10.5.0 and up.

```sh
npm install @intrnl/node-worker-pool
# pnpm install @intrnl/node-worker-pool
# yarn add @intrnl/node-worker-pool
```

## Usage

```js
// ./app.js
let { WorkerPool } = require('@intrnl/node-worker-pool');

// Path to your worker script, `require.resolve` will resolve requires from
// where this script is located.
let workerScript = require.resolve('./worker.js');

let pool = new WorkerPool(workerScript, {
  // Max workers to run concurrently, default is number of CPU cores minus 1
  max: 2,
  // Resource limits to set on the worker thread, Node.js 12.16.0 and up only,
  // see <https://nodejs.org/api/worker_threads.html#worker_threads_worker_resourcelimits>
  limits: {},
});

pool.exec('fibonacci', [32])
  // This should output `2178309`
  .then((value) => console.log('result:', value))
  .catch((error) => console.error('error:', error))
  // Wait for all ongoing tasks to complete before terminating the worker
  .then(() => pool.close())
```

```js
// ./worker.js
function fibonacci (n) {
  if (n < 2) return n;
  return fibonacci(n - 1) + fibonacci(n - 2);
}

module.exports = { fibonacci };
```

## API Reference

This module exports two classes, the pool and the handler used to manage the
actual worker thread.

### `WorkerPool`

#### Constructor options

- `max?: number`  
  The maximum amount of workers that the pool should create, default is your
  CPU cores minus 1.
- `limits?: NodeJS.ResourceLimits`  
  The resource limits that the worker should be allowed to use, [see this page
  for details](https://nodejs.org/api/worker_threads.html#worker_threads_worker_resourcelimits)

#### `workerPool.exec(method: string, args: any[]): Promise<any>`

Executes a method exported by the worker, along with arguments to be passed to
the method.

#### `workerPool.close(opts?: WorkerPoolCloseOptions): Promise<void>`

Closes the pool while waiting for ongoing tasks to finish before terminating
the workers. Queued tasks are immediately thrown.

##### `WorkerPoolCloseOptions`

- `timeout?: false | number`  
  How long the pool should wait for ongoing tasks to complete before terminating
  the workers, default is `false` which disables timeout and waits for ongoing
  tasks to complete entirely.

#### `workerPool.terminate(): Promise<void>`

Closes the pool and forcefully terminates all the workers. Ongoing and queued
tasks are immediately thrown.
npm package: @intrnl/postcss-modules
Description: PostCSS plugin for transforming CSS modules
Author: intrnl
Latest version: 0.2.3

# postcss-modules

PostCSS plugin for transforming CSS modules.

```js
import postcss from 'postcss';
import modules from '@intrnl/postcss-modules';

const source = `
.foo {
  animation: rotate 1.4s linear infinite;
}

@keyframes rotate {}
`;

const processor = postcss([
  modules(),
]);

const result = processor.process(source);

result.messages;
// -> [{ type: 'export-locals', locals: { foo: { ... }, rotate: { ... } } }]
```

## Why?

Differences with the original [`postcss-modules`][postcss-modules] plugin:

- Does not do linking/resolving whatsoever when composing classes.
  - This proves to be problematic when integrating the original plugin with build tools, the
    resolver doesn't apply to nested dependencies and thus fails if you try to do a nested compose,
    and the linker would lead to duplicated CSS code.
- CSS modules is supported on a best-effort basis.
  - We only support what CSS modules is often used for: deconflicted names, and composing classes.
    Other syntax like [`@value` variables][module-values] are not supported.
  - We don't wrap over existing CSS modules transformation plugins, and with that we removed the
    overhead that is [ICSS][icss] and having to run a separate CSS processor.

[postcss-modules]: https://github.com/madyankin/postcss-modules
[module-values]: https://github.com/css-modules/css-modules/blob/master/docs/values-variables.md
[icss]: https://github.com/css-modules/icss
npm package: @intrnl/react-asset
Description: Resource-based data fetching library for React
Author: intrnl
Latest version: 0.1.1

# react-asset

Resource-based data fetching library for React.

**Requires React 18 and up**

## Usage

```jsx
import { createAsset } from '@intrnl/react-asset';


let posts = createAsset(async (id) => {
  let response = await fetch(`https://jsonplaceholder.typicode.com/posts/${id}`);
  return response.json();
});

function App () {
  let [id, setId] = React.useState(1);

  let resource = posts.use(id);

  return (
    <React.Fragment>
      <React.Suspense fallback={<PostFallback />}>
        <Post resource={resource} />
      </React.Suspense>
    </React.Fragment>
  );
}

function Post ({ resource }) {
  let { id, title, body } = resource.read();

  return (
    <div className='post'>
      <h1>{title}</h1>
      <p>{body}</p>
    </div>
  );
}
```
npm package: @intrnl/rollup-plugin-esbuild
Description: Transpile your source code with ESBuild
Author: intrnl
Latest version: 0.5.1

# `rollup-plugin-esbuild`

Transpile your source code with ESBuild, doing a two pass to prevent helper
duplicates in your code.

## Usage

```sh
npm install --save-dev @intrnl/rollup-plugin-esbuild
# pnpm install --save-dev @intrnl/rollup-plugin-esbuild
# yarn add --dev @intrnl/rollup-plugin-esbuild
```

```js
// rollup.config.js
import { esbuild as esbuildPlugin } from '@intrnl/rollup-plugin-esbuild';

export default {
  input: 'src/index.js',
  plugins: [
    esbuildPlugin(),
  ],
};
```

## Options

- `include?: string | RegExp | (string | RegExp)[] | null`  
  Files to include, defaults to matching all files
- `exclude?: string | RegExp | (string | RegExp)[] | null`  
  Files to exclude
- `loaders?: { [loader: Loader ]: string[] }`  
  Loaders to use, files with extension that does not match any loaders will be
  ignored
- `transformOptions?: TransformOptions`  
  ESBuild transform options
npm package: @intrnl/rollup-plugin-html
Description: Allows using HTML files as input for Rollup
Author: intrnl
Latest version: 0.1.2
Deprecated: deprecated

# `rollup-plugin-html`

Allows using HTML files as input for Rollup

## Usage

```sh
npm install --save-dev @intrnl/rollup-plugin-html
# pnpm install --save-dev @intrnl/rollup-plugin-html
# yarn add --dev @intrnl/rollup-plugin-html
```

```js
// rollup.config.js
import { html as htmlPlugin } from '@intrnl/rollup-plugin-html';

export default {
  input: 'src/index.html',
  plugins: [
    htmlPlugin(),
  ],
};
```

## Options

- `baseUrl?: string`  
  The base URL where static assets are hosted
npm package: @intrnl/rollup-plugin-include
Description: Include chunks or assets within your Rollup bundle
Author: intrnl
Latest version: 0.1.2

# `rollup-plugin-include`

Include chunks or assets within your Rollup bundle

## Usage

```sh
npm install --save-dev @intrnl/rollup-plugin-include
# pnpm install --save-dev @intrnl/rollup-plugin-include
# yarn add --dev @intrnl/rollup-plugin-include
```

```js
// rollup.config.js
import { include as includePlugin } from '@intrnl/rollup-plugin-include';

export default {
  input: 'src/index.js',
  plugins: [
    includePlugin(),
  ],
};
```

```js
// Reference any file and it will be included within your Rollup bundle
let image_src = new URL('./assets/image.png', import.meta.url);

// Any files ending with .js will be picked up as a chunk by default,
// making it usable as a module worker.
let worker_src = new URL('./worker.js', import.meta.url);
```
npm package: @intrnl/rollup-plugin-node-externals
Description: Marks package.json dependencies as external
Author: intrnl
Latest version: 0.1.3

# `rollup-plugin-node-externals`

Mark `package.json` dependencies as external

## Usage

Requires a resolver like [`@rollup/plugin-node-resolve`][1] to work.

```sh
npm install --save-dev @intrnl/rollup-plugin-node-externals
# pnpm install --save-dev @intrnl/rollup-plugin-node-externals
# yarn add --dev @intrnl/rollup-plugin-node-externals
```

```js
// rollup.config.js
import { externals as externalsPlugin } from '@intrnl/rollup-plugin-node-externals';
import resolvePlugin from '@rollup/plugin-node-resolve';

export default {
  input: 'src/index.js',
  plugins: [
    // Make sure you put it before the resolver plugin
    externalsPlugin(),
    resolvePlugin(),
  ],
};
```

## Options

- `external?: string[]`  
  What to mark as external, allowed values are `regular` `dev` `optional` and
  `peer`, defaults to marking all except `dev` dependencies
- `root?: string`  
  Where to start finding for `package.json`, defaults to current working
  directory


[1]: https://github.com/rollup/plugins/tree/master/packages/node-resolve
npm package: @intrnl/rollup-plugin-postcss
Description: Bundle CSS stylesheets with PostCSS
Author: intrnl
Latest version: 0.1.2

# `rollup-plugin-postcss`

Bundle CSS stylesheets with PostCSS

## Usage

```sh
npm install --save-dev @intrnl/rollup-plugin-postcss
# pnpm install --save-dev @intrnl/rollup-plugin-postcss
# yarn add --dev @intrnl/rollup-plugin-postcss
```

```js
// rollup.config.js
import { postcss as postcssPlugin } from '@intrnl/rollup-plugin-postcss';

export default {
  input: 'src/index.js',
  plugins: [
    postcssPlugin(),
  ],
};
```

## Options

- `include?: string | RegExp | (string | RegExp)[] | null`
  Files to include, defaults to matching CSS files only
- `exclude?: string | RegExp | (string | RegExp)[] | null`
  Files to exclude
- `plugins?: postcss.Plugin[]`  
  PostCSS plugins to use
- `modules?: boolean | 'auto' | ((fileName: string) => string)`  
  Enable CSS modules, defaults to `auto` where only `.module.xxx` gets matched
- `modulesOptions?: CSSModulesOptions`  
  Options for CSS modules
- `minify?: boolean`  
  Minify bundled CSS, disabled by default
- `minifyOptions?: CleanCSS.Options`
  Options for CleanCSS minifier
- `sourcemap?: boolean | 'inline'`
  Generate sourcemap, only emitted depending on your bundle output options,
  enabled by default
npm package: @intrnl/rollup-plugin-terser
Description: Minify generated bundles with Terser
Author: intrnl
Latest version: 0.1.3
Deprecated: deprecated

# `rollup-plugin-terser`

Minify generated bundles with Terser

## Usage

```sh
npm install --save-dev @intrnl/rollup-plugin-terser
# pnpm install --save-dev @intrnl/rollup-plugin-terser
# yarn add --dev @intrnl/rollup-plugin-terser
```

```js
// rollup.config.js
import { terser as terserPlugin } from '@intrnl/rollup-plugin-terser';

export default {
  input: 'src/index.html',
  plugins: [
    terserPlugin(),
  ],
};
```

## Options

- `numWorkers?: number`  
  The max number of workers to spawn, defaults to the number of CPU cores minus 1
- `minifyOptions?: terser.MinifyOptions`  
  Terser minification options
npm package: @intrnl/snowpack-bundle-rollup
Description: Snowpack plugin for bundling to production using Rollup
Author: intrnl
Latest version: 0.1.4
Deprecated: deprecated

# `snowpack-bundle-rollup`

Snowpack plugin for bundling to production using Rollup

## Usage

```sh
npm install --save-dev @intrnl/snowpack-bundle-rollup
# pnpm install --save-dev @intrnl/snowpack-bundle-rollup
# yarn add --dev @intrnl/snowpack-bundle-rollup
```

```js
// snowpack.config.js

export default {
  // ...  
  buildOptions: {
    // This is recommended.
    clean: true,
  },

  plugins: [
    ['@intrnl/snowpack-bundle-rollup', {
      // See below for options.
    }],
  ],
};
```

## Options

- `entrypoints?: string | string[]`  
  Glob pattern for matching HTML files that are used as entrypoints, defaults to
  matching all HTML files
- `assetsDir?: string`  
  Where assets like JS and CSS lives, defaults to `_assets`
- `modulesDir?: false | string`  
  Where your web modules lives, this is relative to the assets directory,
  defaults to `modules`, pass `false` to bundle the modules directly.
- `minify?: boolean`  
  Whether to minify the resulting bundle, defaults to `false`
- `keepBuildFiles?: boolean`  
  Whether to keep the source files that are used during bundling,
  defaults to `false`
- `modifyRollupOptions?: ({ input: InputOptions, output: OutputOptions }) => void`  
  An escape hatch allowing mutation of the Rollup options used by this plugin
npm package: @intrnl/sq
Description: Lightweight asynchronous state and data fetching solution for Solid.js
Author: intrnl
Latest version: 0.3.0

# sq

Lightweight asynchronous state management and data fetching solution for Solid.js

- Works similarly to Solid.js' createResource
- Fits right in between `createResource` and `@tanstack/solid-query`
- Allows directly handling previous query data within the query function (useful for infinite pagination)
- Does not mix up query data when switching between query keys
- Configurable throw on access

### Infinite query example

```tsx
import { type QueryFn, createQuery } from '@intrnl/sq';

// Utiltiies
interface Collection<Data, Param = unknown> {
	pages: Data[];
	params: Param[];
}

const pushCollection = <Data, Param>(
	collection: Collection<Data, Param>,
	page: Data,
	param: Param | undefined,
): Collection<Data, Param> => {
	if (collection && param !== undefined) {
		return {
			pages: collection.pages.concat(page),
			params: collection.params.concat(param),
		};
	}

	return {
		pages: [page],
		params: [param],
	};
};

const getCollectionCursor = <Data, Key extends keyof Data>(
	collection: Collection<Data, any> | undefined,
	key: Key,
): Data[Key] | undefined => {
	if (collection) {
		const pages = collection.pages;
		const last = pages[pages.length - 1];

		return last[key];
	}
};

// Query
interface User {
	id: number;
	name: string;
}

interface UsersListing {
	cursor: string | undefined;
	users: User[];
}

export const listUsersByQueryKey = (query: string) => {
	return ['listUsersByQuery', query];
};

export const listUsersByQuery: QueryFn<
	Collection<UsersListing>,
	ReturnType<typeof listUsersByQueryKey>,
	string
> = async (key, { data: collection, param }) => {
	const [, query] = key;

	const page = await request('...');

	return pushCollection(collection, page, param);
};

// Interface
const [users, { refetch }] = createQuery({
	key: () => listUsersByQueryKey(''),
	fetch: listUsersByQuery,
});

<Show when={getCollectionCursor(users(), 'cursor')}>
	{(cursor) => <button onClick={() => refetch(true, cursor())}>Show more</button>}
</Show>;
```
npm package: @intrnl/sqlite-system
Description: Painless Node.js wrapper for SQLite
Author: intrnl
Latest version: 0.2.0

# sqlite-system

Painless Node.js wrapper for SQLite, works by spawning a sqlite3 shell process
and communicating to it, removing the need for a native addon.

Requires at least SQLite v3.33.0, only tested with v3.35.4+ on Linux.

- `.print` command (v3.7.15)
- JSON output mode (v3.33.0)


## Usage

```js
import { Client } from '@intrnl/sqlite-system';

// File path relative to current working directory,
// default is in-memory database.
let db = new Client({ filename: './data.db' });

await db.open();

let result = await db.run('SELECT * FROM users');
// [
//   { id: 1, name: 'John' },
//   { id: 2, name: 'Bill' }
// ]

await db.close();
```

### SQL tagged templates and escaping

Due to the use of sqlite3, prepared statements are unavailable, but the library
provides built-in escaping utilities.

```js
import { sql } from '@intrnl/sqlite-system';

// Escape values
sql`INSERT INTO users (name) VALUES (${'foobar'})`;

// Interpolate raw SQL
let table = sql.raw('scores');
sql`INSERT INTO ${table} (name, score) VALUES (${'foobar'}, ${123})`;

// Join queries
sql`SELECT * FROM books ${hasId ? sql`WHERE ids IN (${sql.join(ids)})` : sql.empty}`;
```

## License

**sqlite-system** © [intrnl][license-author]  
Licensed under MIT


[license-author]: https://github.com/intrnl
npm package: @intrnl/srv
Description: A lightweight HTTP web framework.
Author: intrnl
Latest version: 0.2.2

# Srv

A lightweight HTTP web framework.

## Usage

Uses ES Modules, requires Node v14.13.0+

**For TypeScript users**: Be sure to install `@types/node` for Node.js typings

```sh
npm install @intrnl/srv
# pnpm install @intrnl/srv
# yarn add @intrnl/srv
```

```js
import * as http from 'http';
import { Application } from '@intrnl/srv';

let app = new Application();

app.use(({ request, response }) => {
  response.body = 'Hello, world!';
});

http.createServer(app.handler).listen(1234);
```

## Middlewares

An Srv application is essentially a chain of middlewares; like a middleman, they
are functions that runs in between receiving and responding to a request, and
they can run code before and after the next one

```js
// Logger
app.use(({ request }, next) => {
  console.log(`-> Received ${request.method} on ${request.url.path}`);
  return next();
});

// Response time
app.use(async ({ response }, next) => {
  let start = Date.now();
  await next();
  let end = Date.now();
  response.headers.set('x-response-time', end - start);
});

// Response
app.use(({ response }) => {
  response.body = 'Hello, world!';
});
```

**Middlewares must return or await when trying to call the next one**, or you
will stop the chain early before the next middleware is able to handle the
request, causing race conditions and unhandled promise rejections

```js
app.use((ctx, next) => {
  // you return it like so
  return next();
});

app.use(async (ctx, next) => {
  // or await, if you need to run something after the next middleware
  await next();
});
```
npm package: @intrnl/srv-body-parse
Description: Parsed request body middleware for Srv
Author: intrnl
Latest version: 0.1.1

# srv-body-parse

Srv middleware that provides parsed request body data via `request.body`

## Usage

Requires the `@intrnl/srv-body-raw` package to provide raw request body data

```sh
npm install @intrnl/srv-body-raw @intrnl/srv-body-parse
# pnpm install @intrnl/srv-body-raw @intrnl/srv-body-parse
# yarn add @intrnl/srv-body-raw @intrnl/srv-body-parse
```
npm package: @intrnl/srv-body-raw
Description: Raw request body middleware for Srv
Author: intrnl
Latest version: 0.1.0

# srv-body-raw

Srv middleware that provides raw request body data via `request.rawBody`

## Usage

```sh
npm install @intrnl/srv-body-raw
# pnpm install @intrnl/srv-body-raw
# yarn add @intrnl/srv-body-raw
```
npm package: @intrnl/srv-router
Description: Router middleware for Srv
Author: intrnl
Latest version: 0.2.1

# srv-router

Router middleware for Srv

## Usage

```sh
npm install @intrnl/srv-router
# pnpm install @intrnl/srv-router
# yarn add @intrnl/srv-router
```

```js
import { Application } from '@intrnl/srv';
import { Router } from '@intrnl/srv-router';

let app = new Application();
let router = new Router();

router.route('GET', '/', ({ response }) => {
  response.body = 'Hello!';
});

app.use(router.handler);
```

## Routing

Commonly used patterns for path matching is supported

```js
router.route('GET', '/users/:id', ({ request, response }) => {
  response.body = `Hello, ${request.params.id}!`;
});
```

## Mounting

You can have middlewares that runs on a specific endpoint prefix, it is
recommended that you add them first before adding any specific routes

Patterns are not supported, it will be ignored and be treated as regular path.

```js
router.mount('/user', (ctx, next) => {
  // this will run on on every request that starts with /user/
  return next();
});
```

Mounting another router is supported, allowing for subrouting

```js
let app = new Application();
let forum = new Router();
let main = new Router();

forum.route('GET', '/', ({ response }) => {
  response.body = 'Welcome to the forum!';
});

main.mount('/forum', forum.handler);

main.route('GET', '/', ({ response }) => {
  response.body = 'Welcome to the main page!';
});

app.use(main.handler);
```
npm package: @intrnl/stable-stringify
Description: Stable JSON stringify
Author: intrnl
Latest version: 0.1.2

Stable JSON stringify

```js
import { stableStringify } from '@intrnl/stable-stringify';

stableStringify({ c: 1, b: [7, { y: 2, z: 3, x: 1 }, 1], a: 3 });
// -> '{"a":3,"b":[7,{"x":1,"y":2,"z":3},1],"c":1}'

// -> formatted: { a: 3, b: [7, { x: 1, y: 2, z: 3 }, 1], c: 1 }
```
npm package: @intrnl/styl
Description: Lightweight CSS-in-JS runtime
Author: intrnl
Latest version: 0.4.3
Deprecated: no longer supported, you might be looking for @intrnl/stylx instead

# `styl`

Lightweight CSS-in-JS runtime

## Usage

```js
import { keyframes, style } from '@intrnl/styl';

let fadeIn = keyframes({
	'from': {
		opacity: 0,
	},
	'to': {
		opacity: 1,
	},
});

let button = style({
	backgroundColor: 'red',

	'&:hover': {
		backgroundColor: 'blue',
	},
	'@media (prefers-reduced-motion: no-preference)': {
		animation: `${fade_in} .2s ease`,
	},
});
```

### Theming

```js
import { createTheme, createThemeContract, style } from '@intrnl/styl';

let theme = createThemeContract({
	palette: {
		black: null,
		white: null,
		red: null,
	},
});

let themeClass = createTheme(theme, {
	palette: {
		black: '#000',
		white: '#fff',
		red: '#f00',
	},
});

let Button = style({
	backgroundColor: theme.palette.black,
});
```

### Recipes

```js
import { recipe } from '@intrnl/styl';

let Button = recipe({
	base: {
		borderRadius: 6,
	},

	variants: {
		color: {
			neutral: { background: 'whitesmoke' },
			brand: { background: 'blueviolet' },
			accent: { background: 'slateblue' },
		},
		size: {
			small: { padding: 12 },
			medium: { padding: 16 },
			large: { padding: 24 },
		},
		rounded: {
			true: { borderRadius: 999 },
		},
	},

	compoundVariants: [
		{
			variants: {
				color: 'neutral',
				size: 'large',
			},
			style: {
				background: 'ghostwhite',
			},
		},
	],

	defaultVariants: {
		color: 'accent',
		size: 'medium',
	},
});
```
npm package: @intrnl/styleprops
Description: CSS custom properties concatenation helper
Author: intrnl
Latest version: 0.2.0

# `styleprops`

Helper function that takes in an object of properties that should be treated
as a CSS custom property and concatenates them into a string.

## Installation

- Install it with your package manager of choice
  - npm: `npm i @intrnl/styleprops`
  - pnpm: `pnpm i @intrnl/styleprops`
  - yarn: `yarn add @intrnl/styleprops`

## Usage

Pass in an object of properties to the `styleprops` function, camelcase 
properties will be converted into kebabcase by default, and falsy values are
ignored.

```js
import { styleprops } from '@intrnl/styleprops';

let vars = {
  titleColor: 'red',
  titleBackground: 'blue',
};

styleprops(vars);
// -> '--title-color: red; --title-background: blue;'

styleprops(vars, { kebabcase: false });
// -> '--titleColor: red; --titleBackground: blue;'
```
npm package: @intrnl/stylx
Description: CSS-in-JS library with near-zero runtime
Author: intrnl
Latest version: 0.5.2

# stylx

CSS-in-JS library with near-zero runtime.

## Usage

```jsx
import { createStyles } from '@intrnl/stylx';

const styles = createStyles({
	red: {
		color: 'red',
	},
	redEmboldened: {
		composes: ['$red'],
		fontWeight: 700,
	},
	underlinedOnHover: {
		'&:hover': {
			textDecoration: 'underline',
		},
	},
});

const App = () => {
	return (
		<div>
			<p className={styles.red}>This is red</p>
			<p className={styles.redEmboldened}>This is emboldened red</p>
		</div>
	);
};
```

Using the Babel plugin, this will generate...

```jsx
const _red = 'm84tdn0 ',
	_redEmboldened = 'm84tdn1 m84tdn0 ',
	_underlinedOnHover = 'm84tdn2 ';

import * as _stylx from '@intrnl/stylx/runtime';

_stylx.inject(
	'm84tdn',
	'.m84tdn0{color:red;}.m84tdn1{font-weight:700;}.m84tdn2{&:hover{text-decoration:underline;}}',
);

const styles = {};

const App = () => {
	return (
		<div>
			<p className={_red}>This is red</p>
			<p className={_redEmboldened}>This is emboldened red</p>
		</div>
	);
};
```

By default, the `styles` object becomes empty to encourage writing code in a
way that can be easily analyzed by the plugin. This can be disabled by setting `loose: true` in the plugin options.

### Keyframes and CSS variables

Scoped keyframes and variables can be defined via `createKeyframes` and `createVariables` respectively.

```jsx
const variables = createVariables({
	background: {},
});

const keyframes = createKeyframes({
	spin: {
		to: {
			transform: 'rotate(360deg)',
		},
	},
});

const styles = create({
	root: {
		background: `var(${variables.background})`,
		animation: `${keyframes.spin} 1s linear infinite`,
	},
	isHighlighted: {
		[variables.background]: 'yellow',
	},
});
```

### Class name concatenation

stylx provides an optimized utility function for concatenation. Note that you can only reference variables that can be easily analyzed, as is the case with stylx' own styles.

```jsx
const styles = createStyles({
	isBordered: {},
	root: {},

	isStandalone: {},
	isMultiple: {},
	item: {},
});

log(join(styles.root, !borderless && styles.isBordered));
log(join(styles.item, standalone ? styles.isStandalone : styles.isMultiple));

log(join('foo', 'bar'));
```

... where it would be generate...

```js
log(_root + (!borderless ? _isBordered : ''));
log(_item + (standalone ? _isStandalone : _isMultiple));

log('foo' + ' ' + ('bar' + ' '));
```
npm package: @intrnl/substate
Description: Simple global state management
Author: intrnl
Latest version: 0.2.7

# `substate`

Small and simple global state management

## Installation

- Install it with your package manager of choice
  - npm: `npm i @intrnl/substate`
  - pnpm: `pnpm i @intrnl/substate`
  - yarn: `yarn add @intrnl/substate`

## Usage

```js
import { Store } from '@intrnl/substate';

// Initialize your store
let todosStore = new Store({
  initialState: {
    filter: 'SHOW_FINISHED',
    items: [
      { id: 1, text: 'Write documentation', done: false },
    ],
  },
});

// Subscribe with a specific selector, callback will be called if it changes
todosStore.watch((store) => store.items[0], (item) => {
  console.log(item); // { id: 1, text: 'Say hello!', ... }
});

// Subscribe to the entire store
todosStore.subscribe((store) => {
  console.log(store); // { filter: 'SHOW_ALL', items: [ ... ] }
});

// Update the store, it will do a shallow merge
todosStore.update((store) => ({ filter: 'SHOW_ALL' }));

// Replace the store value
todosStore.set({
  filter: 'SHOW_UNFINISHED',
  items: [
    { id: 1, text: 'Say hello!', done: false },
  ],
});

// Reset the store to initial value
todosStore.reset();
```
npm package: @intrnl/substate-preact
Description: Simple global state management for Preact
Author: intrnl
Latest version: 0.2.0

# substate-preact

```jsx
import { h } from 'preact';
import { Store } from '@intrnl/substate';
import { useStoreState } from '@intrnl/substate-preact';


let countStore = new Store({
  initialState: {
    count: 0,
  },
});

function increment () {
  countStore.update((store) => ({ count: store.count++ }));
}

function decrement () {
  countStore.update((store) => ({ count: store.count++ }));
}


function App () {
  // Omitting the second parameter returns the whole store value
  let count = useStoreState(countStore, (store) => store.count);

  return (
    <div>
      <span>{count}</span>
      <button onClick={increment}>+</button>
      <button onClick={decrement}>-</button>
    </div>
  );
}
```
npm package: @intrnl/svelte-query
Description: Svelte library for managing, caching and syncing asynchronous and remote data
Author: intrnl
Latest version: 0.3.1
Deprecated: use the official @sveltestack/svelte-query instead

# svelte-query

Svelte library for managing, caching and syncing asynchronous and remote data.

Uses `react-query` core, this is a Svelte adapter for it.

[Documentations](./docs/index.md) (incomplete!)

## To-do

- Implement mutation queries
- Documentations

## Installation

```sh
# npm
npm install @intrnl/svelte-query
# pnpm
pnpm install @intrnl/svelte-query
# yarn
yarn add @intrnl/svelte-query
```
npm package: @intrnl/transduce
Description: Efficient data processing
Author: intrnl
Latest version: 0.1.0

# `transduce`

Efficient data processing

## Installation

- Install it with your package manager of choice
  - npm: `npm i @intrnl/transduce`
  - pnpm: `pnpm i @intrnl/transduce`
  - yarn: `yarn add @intrnl/transduce`

## Usage

```js
import * as t from '@intrnl/transduce';

let process = t.pipe([
  // Takes the first 5 numbers
  t.first(5),
  // Logs every single value to console
  t.tap((x) => console.log('value: %d', x)),
  // Takes only odd numbers
  t.filter((x) => x % 2 === 0),
  // Multiply by two
  t.map((x) => x * 2),
  // Return as an array
  t.toArray,
]);

process(t.range(1, 10));
// -> [4, 8]

// log: value: 1
// log: value: 2
// log: value: 3
// log: value: 4
// log: value: 5
```
npm package: @intrnl/untar-stream
Description: Streamable implementation of untar
Author: intrnl
Latest version: 0.2.0
Deprecated: I don't maintain this anymore

# untar-stream

Streamable implementation of untar

This library expects a ReadSeeker interface, you can convert async iterables by
using [`@intrnl/iterable-reader`][iterable-reader].

```js
import { createReadStream } from 'node:fs';
import { createIterableReader } from '@intrnl/iterable-reader';
import { Untar } from '@intrnl/untar-stream';

let stream = createReadStream('./archive.tar');

let reader = createIterableReader(stream);
let untar = new Untar(reader);

for await (let entry of untar) {
	console.log(entry.name);

	if (entry.name === 'actor.json') {
		let bytes = new Uint8Array(entry.size);
		await entry.read(bytes);

		let decoder = new TextDecoder();
		let text = decoder.decode(bytes);

		console.log(JSON.parse(text));
	}
}
```

[iterable-reader]: https://codeberg.org/intrnl/iterable-reader

## Working with Web Streams

Unfortunately browsers hasn't implemented using ReadableStream directly as an
async iterator, in the meantime, you could use this to convert them into one.

```js
function createStreamIterator (stream) {
	// return if browser already supports async iterator in stream
	if (Symbol.asyncIterator in stream) {
		return stream[Symbol.asyncIterator]();
	}

	let reader = stream.getReader();

	return {
		[Symbol.asyncIterator] () {
			return this;
		},
		next () {
			return reader.read();
		},
		return () {
			reader.releaseLock();
		},
		throw () {
			reader.releaseLock();
		},
	};
}
```
npm package: @intrnl/velvet-transform-classname-minify
Description: Velvet transformer to minify CSS class names
Author: intrnl
Latest version: 0.1.2

Velvet transformer to minify CSS class names

```html
<div class='red'>Red color</div>
<div class='blue'>Blue color</div>

<style>
	.red {
		color: red;
	}

	.blue {
		color: blue;
	}
</style>
```

```html
<div class='a'>Red color</div>
<div class='b'>Blue color</div>

<style>
	.a {
		color: red;
	}

	.b {
		color: blue;
	}
</style>
```
npm package: @intrnl/vite-plugin-vanilla-extract-runtime
Description: Alternate Vite plugin for Vanilla Extract styles
Author: intrnl
Latest version: 0.1.4

# vite-plugin-vanilla-extract-runtime

Alternate Vite plugin for Vanilla Extract styles.

Does not emit the resulting styles as a CSS asset, injects it at runtime instead.
Use this as a workaround if you have issues with code splitting on production builds.
npm package: @intrnl/xxhash64
Description: xxHash64 implementation in JavaScript
Author: intrnl
Latest version: 0.1.2

xxHash64 implementation in JS.

## Examples

### Hashing in one step

```js
import { hash } from '@intrnl/xxhash64';

hash('foobar', 0); // 11721187498075204345n
```

### Hashing in multiple steps

```js
import { XXH64 } from '@intrnl/xxhash64';

const hash = new XXH64();

hash.update('foo');

hash.update('bar');

hash.digest(); // 11721187498075204345n
```