open-index/open-npm huggingface dataset:
npm package: @luncheon/esbuild-plugin-gzip
Description: Gzip and Brotli compression for esbuild
Latest version: 0.2.0

# esbuild-plugin-gzip

Gzip and Brotli compression for [esbuild](https://esbuild.github.io/).

## Installation

```sh
$ npm i -D esbuild @luncheon/esbuild-plugin-gzip
```

## Usage Example

```js
const esbuild = require('esbuild')
const gzipPlugin = require('@luncheon/esbuild-plugin-gzip')

esbuild.build({
  entryPoints: ['src/app.ts'],
  outdir: 'dist',
  bundle: true,
  minify: true,
  write: false, // write must be false
  plugins: [gzipPlugin()],
})
```

## Options

```js
gzipPlugin({
  uncompressed: true, // raw output file emission
  gzip: true,         // gzip compressed output file emission
  brotli: true,       // brotli compressed output file emission
  onEnd: ({ outputFiles }) => {
    // outputFiles.forEach(({ path, contents }) => {})
  },
})
```

Each file emission option can be an object with:

- `filter: RegExp | { test: (outputFilePath: string, outputFile: OutputFile) => boolean }`

```js
gzipPlugin({
  gzip: {
    filter: /\.(js|css)$/i,
  },
  brotli: {
    filter: {
      test: (_outputFilePath, outputFile) => outputFile.contents.byteLength > 1_000_000,
    },
  },
})
```

## License

[WTFPL](http://www.wtfpl.net/)
npm package: @luncheon/esbuild-plugin-linaria
Description: An unofficial and experimental esbuild plugin for Linaria.
Latest version: 0.4.0

# esbuild-plugin-linaria

An unofficial and experimental [esbuild](https://esbuild.github.io/) plugin for [Linaria](https://linaria.dev/).

> Linaria officially supports esbuild now.  
> https://github.com/callstack/linaria/blob/master/docs/BUNDLERS_INTEGRATION.md#esbuild

## Installation

```sh
$ npm i -D esbuild @luncheon/esbuild-plugin-linaria
```

## Usage Example

- build.js

```js
const esbuild = require('esbuild')
const linariaPlugin = require('@luncheon/esbuild-plugin-linaria')

// set stylis options as needed
const stylis = require('stylis')
stylis.set({ prefix: false })

esbuild.build({
  entryPoints: ['src/app.ts'],
  outdir: 'dist',
  bundle: true,
  minify: true,
  plugins: [linariaPlugin()],
})
```

- src/app.ts

```tsx
import { css } from '@linaria/core'

document.body.className = css`
  display: grid;

  ::before {
    content: '';
  }
`
```

Run build.js

```sh
$ node build.js
```

Then two files will be output

- dist/app.js

```js
(()=>{document.body.className="a16lghq5";})();
```

- dist/app.css

```css
.a16lghq5{display:grid}.a16lghq5::before{content:"";}
```

## Options

The followings are the options for this plugin and their default values.

```js
linariaPlugin({
  filter: /\.[cm]?[jt]sx?$/,
  preprocess: (code, args) => code,
  linariaOptions: {
    pluginOptions: {
      babelOptions: {
        plugins: [
          presets: ['@babel/preset-react', '@babel/preset-typescript'],
        ],
      },
    },
  },
})
```

- `filter` is an option for esbuild to narrow down the files to which this plugin should be applied.  
  https://esbuild.github.io/plugins/#filters
- `preprocess` callback is called before the source code is transformed by Linaria.
  - The first argument `code` is the source code content.
  - The second argument `args` is the argument passed by esbuild. `args.path` is the file path.
  - It must return source code content string.
- `linariaOptions` is the option for Linaria.
  - `preprocessor`  
    https://github.com/callstack/linaria/blob/master/docs/BUNDLERS_INTEGRATION.md#options
  - `pluginOptions`  
    https://github.com/callstack/linaria/blob/master/docs/CONFIGURATION.md#options

## With `esbuild-plugin-pipe`

If you use this plugin with [`esbuild-plugin-pipe`](https://github.com/nativew/esbuild-plugin-pipe), pass the same plugin instance to both `esbuild-plugin-pipe` and `esbuild`.

```js
import esbuild from 'esbuild'
import pipe from 'esbuild-plugin-pipe'
import linariaPlugin from '@luncheon/esbuild-plugin-linaria'

const linaria = linariaPlugin({ filter: /^$/ })

esbuild.build({
  entryPoints: ['src/app.ts'],
  outdir: 'dist',
  bundle: true,
  minify: true,
  plugins: [
    pipe({
      filter: /\.[jt]sx?$/,
      plugins: [linaria],
    }),
    linaria,
  ],
})
```

## License

[WTFPL](http://www.wtfpl.net/)
npm package: @luncheon/exponential-golomb-code
Description: An exponential-Golomb-k coding implementation.
Latest version: 1.1.0

# @luncheon/exponential-golomb-code

An [exponential-Golomb coding](https://en.wikipedia.org/wiki/Exponential-Golomb_coding) implementation.

- Order-*k* Generalized
- Optional Zigzag Encoding
- Lightweight, Zero Dependencies

```ts
import assert from "node:assert/strict";
import { decodeExponentialGolomb, encodeExponentialGolomb } from "@luncheon/exponential-golomb-code";

{
  const k = 1;
  const zigzag = false;

  assert.deepEqual(encodeExponentialGolomb(0, k, zigzag), [1, 0]);
  assert.deepEqual(encodeExponentialGolomb(1, k, zigzag), [1, 1]);
  assert.deepEqual(encodeExponentialGolomb(2, k, zigzag), [0, 1, 0, 0]);
  assert.deepEqual(encodeExponentialGolomb(3, k, zigzag), [0, 1, 0, 1]);
  assert.deepEqual(encodeExponentialGolomb(4, k, zigzag), [0, 1, 1, 0]);
  assert.deepEqual(encodeExponentialGolomb(5, k, zigzag), [0, 1, 1, 1]);
  assert.deepEqual(encodeExponentialGolomb(6, k, zigzag), [0, 0, 1, 0, 0, 0]);
  assert.deepEqual(encodeExponentialGolomb(7, k, zigzag), [0, 0, 1, 0, 0, 1]);
  assert.deepEqual(encodeExponentialGolomb(8, k, zigzag), [0, 0, 1, 0, 1, 0]);
}

for (let k = 0; k < 100; k++) {
  for (let i = 0; i < 100; i++) {
    const n = Math.round(Math.random() * Number.MAX_SAFE_INTEGER);
    assert.equal(decodeExponentialGolomb(encodeExponentialGolomb(n, k), k), n);
    assert.equal(decodeExponentialGolomb(encodeExponentialGolomb(n, k, true), k, true), n);
    assert.equal(decodeExponentialGolomb(encodeExponentialGolomb(-n, k, true), k, true), -n);
  }
}
```

## CLI

```bash
npx @luncheon/exponential-golomb-code --k=2 --zigzag -- 3 -20--10 0x80
   3 01010
 -20 000101011
 -19 000101001
 -18 000100111
 -17 000100101
 -16 000100011
 -15 000100001
 -14 0011111
 -13 0011101
 -12 0011011
 -11 0011001
 -10 0010111
 128 000000100000100
```

## License

[WTFPL](http://www.wtfpl.net)

## See also

- [@luncheon/**golomb-code**](https://www.npmjs.com/package/@luncheon/golomb-code): A [Golomb coding](https://en.wikipedia.org/wiki/Golomb_coding) implementation.
- [@luncheon/**fibonacci-code**](https://www.npmjs.com/package/@luncheon/fibonacci-code): A [Fibonacci coding](https://en.wikipedia.org/wiki/Fibonacci_coding) implementation.
- [@luncheon/**varint**](https://www.npmjs.com/package/@luncheon/varint): A `BigInt`-native [varint](https://en.wikipedia.org/wiki/Variable-length_quantity) codec supporting arbitrary chunk sizes and zigzag encoding.
npm package: @luncheon/fibonacci-code
Description: A Fibonacci coding implementation.
Latest version: 1.1.0

# @luncheon/fibonacci-code

A [Fibonacci coding](https://en.wikipedia.org/wiki/Fibonacci_coding) implementation.

```ts
import assert from "node:assert/strict";
import { encodeFibonacci, decodeFibonacci } from "@luncheon/fibonacci-code";

assert.deepEqual(encodeFibonacci(1), [1, 1]);
assert.deepEqual(encodeFibonacci(2), [0, 1, 1]);
assert.deepEqual(encodeFibonacci(3), [0, 0, 1, 1]);
assert.deepEqual(encodeFibonacci(4), [1, 0, 1, 1]);
assert.deepEqual(encodeFibonacci(5), [0, 0, 0, 1, 1]);
assert.deepEqual(encodeFibonacci(6), [1, 0, 0, 1, 1]);
assert.deepEqual(encodeFibonacci(7), [0, 1, 0, 1, 1]);
assert.deepEqual(encodeFibonacci(8), [0, 0, 0, 0, 1, 1]);

for (let n = 1; n < 1_000_000; n++) {
  assert.equal(decodeFibonacci(encodeFibonacci(n)), n);
}
```

## CLI

```bash
$ npx @luncheon/fibonacci-code 3 10-20 0x80
   3 0011
  10 010011
  11 001011
  12 101011
  13 0000011
  14 1000011
  15 0100011
  16 0010011
  17 1010011
  18 0001011
  19 1001011
  20 0101011
 128 00010001011
```

## Reference

- [Aviezri S. Fraenkel, Shmuel T. Kleinb. (1996). "Robust universal complete codes for transmission and compression"](https://www.sciencedirect.com/science/article/pii/0166218X9300116H)

## License

[WTFPL](http://www.wtfpl.net)

## See also

- [@luncheon/**golomb-code**](https://www.npmjs.com/package/@luncheon/golomb-code): A [Golomb coding](https://en.wikipedia.org/wiki/Golomb_coding) implementation.
- [@luncheon/**exponential-golomb-code**](https://www.npmjs.com/package/@luncheon/exponential-golomb-code): An [exponential-Golomb coding](https://en.wikipedia.org/wiki/Exponential-Golomb_coding) implementation.
- [@luncheon/**varint**](https://www.npmjs.com/package/@luncheon/varint): A `BigInt`-native varint codec supporting arbitrary chunk sizes and zigzag encoding.
npm package: @luncheon/rollup-plugin-purgecss-keep-string-literals
Description: An experimental rollup plugin that removes the rest of the CSS, leaving only the selectors used in the string literals in the JavaScript source code.
Latest version: 0.0.2

# @luncheon/rollup-plugin-purgecss-keep-string-literals

An experimental rollup plugin that removes the rest of the CSS, leaving only the selectors used in the string literals in the JavaScript source code.


## Installation

```bash
$ npm i -D rollup @luncheon/rollup-plugin-purgecss-keep-string-literals
```


## Usage

```js
// rollup.config.js
import purgecssKeepStringLiterals from '@luncheon/rollup-plugin-purgecss-keep-string-literals'

export default {
  plugins: [
    purgecssKeepStringLiterals({
      css: ["node_modules/tailwindcss/dist/utilities.min.css"],
      output: "dist/utilities.css",
      include: ["src/**/*.ts"],
    })
  ]
}
```


## Options

### `css`

Type: `(string | { raw: string })[]`

Array of the CSS file name or the CSS content.

### `output`

Type: `string`

Output file name.

### `include`

Type: `string | string[]`
Default: `null`

Minimatch pattern(s) for which the plugin should collect the string literals. By default all bundled files are targeted.

### `exclude`

Type: `string | string[]`
Default: `null`

Minimatch pattern(s) for which the plugin should ignore. By default no files are ignored.


## License

[WTFPL](http://www.wtfpl.net)