open-index/open-npm huggingface dataset:
npm package: @shisama/napi-sample-darwin-x64
Description: This is the **x86_64-apple-darwin** binary for `@shisama/napi-sample`
Latest version: 0.1.0

# `@shisama/napi-sample-darwin-x64`

This is the **x86_64-apple-darwin** binary for `@shisama/napi-sample`
npm package: @shisama/napi-sample-linux-x64-gnu
Description: This is the **x86_64-unknown-linux-gnu** binary for `@shisama/napi-sample`
Latest version: 0.1.0

# `@shisama/napi-sample-linux-x64-gnu`

This is the **x86_64-unknown-linux-gnu** binary for `@shisama/napi-sample`
npm package: @shisama/napi-sample-win32-x64-msvc
Description: This is the **x86_64-pc-windows-msvc** binary for `@shisama/napi-sample`
Latest version: 0.1.0

# `@shisama/napi-sample-win32-x64-msvc`

This is the **x86_64-pc-windows-msvc** binary for `@shisama/napi-sample`
npm package: @shise/assets
Description: Serve static files with shise
Author: Aizawa-san
Latest version: 0.0.3

# @shise/assets

> Serve static files with Shise

### Installation

```bash
npm i @shise/assets
```

### Quick start

Install dependencies

```bash
npm install shise @shise/assets
```

Create a Shise application

```js
const { Controller, Router, App } = require('shise')

const controller = new Controller()

const app = new App(new Router({}))
app.listen(3000)
```

Use assets controller

```js
const assets = require('@shise/assets')
const path = require('path')

const app = new App(
	new Router({
		assets: assets({ dir: path.join(__dirname, '../public') }),
	})
)
```

### Assets Options

```js
/**
 * assets(options, controller)
 *
 * @param {Object} [options]
 *  - {String} dir `Absolute location of file directory`
 * @return {Function} assets controller
 *
 */
```

### License

[MIT](https://github.com/aiza-san/shise/blob/main/LICENSE.md)
npm package: @shise/body-parser
Description: Body Parser for Shise
Author: Aizawa-san
Latest version: 0.0.2

# Body Parser Middleware

> A middleware for parsing request bodies in various formats, including JSON, raw data, urlencoded, and XML.

## Installation

```bash
npm install @shise/body-parser
```

## Usage

```js
const bodyParser, { BodyParserOptions } = require('@shise/body-parser')

const jsonParser = bodyParser.json()
const rawParser = bodyParser.raw()
const urlencodedParser = bodyParser.urlencoded()
const xmlParser = bodyParser.xml()

// Use the middleware in your application

controller.use(jsonParser)
controller.use(rawParser)
controller.use(urlencodedParser)
controller.use(xmlParser)
```

## Options

- limit (optional): Set a limit on the request body size. Default is unlimited. Example: { limit: '1mb' }
- requiredHeaders (optional): Array of headers that must be present in the request. Example: { requiredHeaders: ['Content-Type'] }
- disallowedHeaders (optional): Array of headers that must not be present in the request. Example: { disallowedHeaders: ['Authorization'] }
- strictMode (optional): Enable strict mode to enforce all specified options. Default is false. Example: { strictMode: true }

## Size Units

Size limits can be specified using units such as 'kb', 'mb', 'gb', or 'tb'. Example: '1mb', '100kb'.

## Middleware Methods

`json(opts?: BodyParserOptions)`

Parses the request body as JSON.

`raw(opts?: BodyParserOptions)`

Retrieves the raw request body.

`urlencoded(opts?: BodyParserOptions)`

Parses the request body as urlencoded data.

`xml(opts?: BodyParserOptions)`

Parses the request body as XML.

## License

[MIT](https://github.com/aiza-san/shise/blob/main/LICENSE.md)
npm package: @shise/cors
Description: Shise CORS
Author: Aizawa-san
Latest version: 0.0.3

# CORS Middleware

A middleware for handling Cross-Origin Resource Sharing (CORS) in your web server.

## Installation

```bash
npm install @shise/cors
```

## Usage

```js
const cors, { CorsOptions } = require('@shise/cors')
const { Controller } = require('shise')

const controller = new Controller()
controller.use(cors(/* optional CorsOptions */))
```

## Options

`allowedOrigins (optional)`: Array of allowed origins. Default is an empty array.
`allowedMethods (optional)`: Array of allowed HTTP methods. Default is ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'].
`allowedHeaders (optional)`: Array of allowed headers. Default is an empty array.
`exposedHeaders (optional)`: Array of headers exposed to the client. Default is an empty array.
`maxAge (optional)`: The maximum time (in seconds) that a preflight request may be cached. Default is 600.
`credentials (optional)`: Boolean indicating whether credentials (e.g., cookies) should be included. Default is false.

## License

[MIT](https://github.com/aiza-san/shise/blob/main/LICENSE.md)
npm package: @shise/multer
Description: Shise multer
Author: Aizawa-san
Latest version: 0.0.2

# Multer Middleware

A middleware for handling file uploads in your web server.

## Installation

```bash
npm install @shise/multer
```

## Usage

```js

const multer, { Options, File, Storage } = require('@shise/multer')
const { Controller } = require('shise')

// Define storage options
const storageOptions = {
  destination: './uploads',
  filename: (ctx, file) => `${Date.now()}-${file.originalname}`
};

// Initialize storage
const storage = new Storage(storageOptions);

// Define multer options
const multerOptions: Options = {
  fields: ['image', 'document'],
  extnames: ['.jpg', '.png', '.pdf'],
  storage: storage
};

// Create the multer middleware
const multerMiddleware = multer(multerOptions);

const controller = new Controller()
controller.use(multerMiddleware)
```

## Options

`fields`: Array of field names or objects with name and maxCount properties.
`extnames`: Array of allowed file extensions.
`storage`: Instance of the Storage class.

## Storage Class

The Storage class provides methods for creating filenames, destinations, and paths based on user-defined functions or strings.

```js
const storage = new Storage({
	destination: (ctx, file) => './uploads',
	filename: (ctx, file) => `${Date.now()}-${file.originalname}`,
})
```

## License

[MIT](https://github.com/aiza-san/shise/blob/main/LICENSE.md)
npm package: @shise/validation
Description: Body validation middleware for Shise
Author: Aizawa-san
Latest version: 0.0.2

# Validation Middleware

A middleware for request body validation using schema validation libraries such as Zod or Yup.

## Installation

```bash
npm install @your-namespace/validation-middleware
```

## Usage

```js
const { Controller } = require('shise');
const { Schema as ZodSchema, ZodError } = require('zod');
const { Schema as YupSchema, ValidationError } = require('yup');
const validation = require('@shise/validation');

// Define your Zod or Yup schema
const zodSchema = ZodSchema.object({
  name: ZodSchema.string(),
  age: ZodSchema.number(),
});

// Define middleware options
const validationOptions = {
  onError: error => {
    if (error instanceof ValidationError) {
      return JSON.stringify(error.errors);
    } else if (error instanceof ZodError) {
      return JSON.stringify(error.errors);
    } else {
      return error.message;
    }
  },
  statusCode: 400,
};

// Create the validation middleware
const validationMiddleware = validation(zodSchema, validationOptions);

const controller = new Controller()
controller.use(validationMiddleware)
```

## Options

`onError`: Custom error handling function. Default is a function that formats errors into JSON strings.
`statusCode`: HTTP status code to set on validation failure. Default is 400.

## License

[MIT](https://github.com/aiza-san/shise/blob/main/LICENSE.md)
npm package: @shish2k/browserslist-logs
Description: turn web server access logs into a browserslist file
Author: Shish
Latest version: 0.0.1

browserslist-logs
=================
Turn webserver access logs into a browserslist file

Usage
-----
Run the package directly:
```
npx @shish2k/browserslist-logs -i my_website.log -o browserslist-stats.json
```

Local build and run:
```
npm install
npm run build
node dist/index.js -i my_website.log -o browserslist-stats.json
```

Motivation
----------
I want to be able to build my site taking advantage of features that my
users have access to, but it seems browserslist and caniuse both expect
me to send my user's browsing histories to Google and then export the
stats from there -- I can't see any way to use either of those in a
privacy-respecting way, so I am building my own...
npm package: @shish2k/hyperapp-chromecast
Description: Some minimal glue to use chromecast APIs from inside the HyperApp framework.
Author: Shish
Latest version: 0.0.4

HyperApp ChromeCast Glue
========================

Some minimal glue to use chromecast APIs from inside the HyperApp framework.

See [sender.html](sender.html) and [receiver.html](receiver.html) for a pair
of self-contained, well-commented examples.
npm package: @shish2k/hyperapp-hash-state
Description: Automatically manage a subset of app state in the URL hash
Author: Shish
Latest version: 2.0.11

HyperApp Hash-State Manager
===========================

tl;dr: Keeps some fields in your `state` object in-sync with the browser's
URL bar. Changing the state changes the URL, changing the URL changes the
state. You can copy-paste the URL to somebody, so that not only do they see
the same page, but they also see the same data inside the page :D

See [demo.html](demo.html) for a self-contained, well-commented example

WARNING: the code inside here is an abomination and I'm pretty sure I'm
Doing It Wrong(tm) - pull requests from hyperapp experts who can help me
to do the same basic thing in a non-awful way would be appreciated :)

If the page is loaded with no hash, populate it with default settings. If
the page is loaded with a hash, load our initial settings from there.

For apps who only care about "what page is the user viewing", it's probably
nicer to use a router plugin which looks at the whole url, so that the user
sees `mysite.com/cats` where this plugin would give `mysite.com/#{"page":"cats"}`.
But if you want to have multiple state variables in the URL, this can work :)
npm package: @shish2k/hyperapp-localstorage
Description: Functions to keep app state in sync with localstorage
Author: Shish
Latest version: 1.0.2

HyperApp LocalStorage
=====================

A hyperapp `Subscriber` and `Effect` to save values to and load values
from the LocalStorage space.

Very much stolen from @zaceno's
[Hyperapp Code-Along](https://www.youtube.com/watch?v=QqUr_NM6P_Y),
I'm just putting it in a package because I don't want to copy-paste across
all my projects.

See [demo.html](demo.html) for a self-contained, well-commented example.
npm package: @shish2k/hyperapp-mqtt
Description: MQTT sub / fx for hyperapp
Author: Shish
Latest version: 2.0.0

HyperApp MQTT
=============

A hyperapp `Subscriber` to connect to a MQTT-over-websockets server
(eg Mosquitto) and react to received messages; and an `Effect` to
send messages.

See [demo.html](demo.html) for a self-contained, well-commented example
npm package: @shish2k/hyperapp-navigation
Description: A polished version of the abandoned @hyperapp/navigation
Author: Shish
Latest version: 1.0.1

HyperApp Navigation
===================

A hyperapp `Subscriber` and `Effect` to push URL changes to the URL bar
when links are clicked, and react to the back / forward button being
pressed, so that navigation events are all handled in-app with no page
reloads.

See [demo.html](demo.html) for a self-contained, well-commented example.
npm package: @shish2k/hyperapp-survive-hmr
Description: Save state before hot module reload, load state after it
Author: Shish
Latest version: 2.0.1

HyperApp Survive HMR
====================

A handy function to save app state before a reload and load state after it

Given a basic app like:

```
app({
    init: [
        state,
        FetchInitData(),
    ],
    ...
});
```

We can add HMR support like:

```
import { SurviveHMR } from "@shish2k/hyperapp-survive-hmr";

app({
    init: [
        state,
        SurviveHMR(module, [
            FetchInitData(),
        ]),
    ],
    ...
});
```

Notably instead of running a bunch of effects as part of `init`, we only
run `SuriveHMR`, and we allow it to run extra effects as-needed
npm package: @shish2k/hyperapp-synced-interval
Description: Call a function on the second, every second, synced across clients
Author: Shish
Latest version: 0.0.4

HyperApp Synced Interval
========================

"I want this function to be called once per second, exactly at the start of
the second, with multiple hosts agreeing on when the second is"

Example in demo.html - you can open this on mutliple computers, even with
skewed clocks - each instance will sync its own time with the server, and
then change the page colour based on what it thinks the current time is. If
everything is working, all the devices should change to the same colour at
the same moment.

Usage:

```
SyncedInterval({
    server: "https://shish.io/time.json",  // should return current time in seconds
    interval: 1000, // call onInterval once per second, on the second
    sync: 60*1000,  // try to sync clocks every minute, call onSync when we are synced
    samples: 5,     // take an average of the past 5 samples
    onInterval(state, now) {
        console.log("According to the server, the time is", now);
        return state;
    },
    onSync(state, offset) {
        console.log("We are", offset, "milliseconds away from server time");
        return state;
    },
});
```

Notes for implementing the server side: the server returns time in seconds, as
a floating point, because that's what nearly all languages use. Javascript does
everything in milliseconds.
npm package: @shish2k/react-faicon
Description: A tiny (<1kb) fontawesome icon renderer
Author: Shish
Latest version: 0.1.0

# Tiny FontAwesome Icon Component for React

Because `@fortawesome/react-fontawesome` bloats my final bundle by 80KB, to render <1KB of SVG tags.

This package has fewer features (no animation, no invert-opacity mode, etc). But if all you want is to render an icon, it does that. It uses the same icon data from `@fortawesome/free-solid-svg-icons`, so it should be a drop-in replacement for basic use cases.

Example usage:

```tsx
import { FAIcon } from '@shish2k/react-faicon';
import { faPlay } from '@fortawesome/free-solid-svg-icons';

export function App() {
  return <FAIcon icon={faPlay} />;
}
```

## Dev Setup

```bash
npm install
npm run build
```

Build the library in watch mode:

```bash
npm run dev
```
npm package: @shish2k/react-mqtt
Description: Connect to an MQTT server
Author: Shish
Latest version: 0.1.0

# React MQTT Tools

A provider and hook for subscribing to an MQTT topic

```tsx
function MyStream(props) {
  const [msg, setMsg] = useState("");
  useSubscription(props.topic, (packet) => setMsg(packet.text()));

  return (
    <div>
      The most recent message on {props.topic} is {msg}
    </div>
  );
}

function App() {
  return (
    <MqttProvider url={"wss://test.mosquitto.org:8081/mqtt"}>
      <MyStream topic={"test"} />
    </MqttProvider>
  );
}
```

See [demo.html](demo.html) for a self-contained, well-commented example.
npm package: @shish2k/react-use-servertime
Description: Keep multiple clocks in sync with a server
Author: Shish
Latest version: 0.1.0

React useServerTime
===================

A hook which allows multiple clients to keep their clocks in-sync
with reasonable precision, eg

```ts
import { useServerTime } from "@shish2k/react-use-servertime";

function MyClock() {
	const { now } = useServerTime({url: "https://karakara.uk/time.json"});

	return <div>The time is {now}</div>;
}
```

The given URL should return the current time in floating-point seconds

This hook will update the `now` value once per second, on the second

If you have multiple places which want to use the time, you can use a
context provider so that multiple components share a single clock:

```ts
import { ServerTimeContext, ServerTimeProvider } from "@shish2k/react-use-servertime";

function MyClock() {
	const { now } = useContext(ServerTimeContext);

	return <div>The time is {now}</div>;
}

function App() {
	return <ServerTimeProvider url="https://karakara.uk/time.json">
		<MyClock />
	</ServerTimeProvider>
}
```

See [demo.html](demo.html) for a self-contained, well-commented example.
npm package: @shishirsubedi/mini-cache
Description: A lightweight, zero-dependency in-memory cache with TTL support.
Author: Shishir Subedi
Latest version: 1.0.4

# @shishirsubedi/mini-cache

> A minimal in-memory singleton cache with TTL, expiration cleanup, and no dependencies.

## 📦 Install

```bash
npm install @shishirsubedi/mini-cache
```

--- 

## Usage

```ts

import * as cache from '@shishirsubedi/mini-cache'; 
// or const cache = require('@shishirsubedi/mini-cache')

// 1. Configure the cache (optional)
cache.configure({
  defaultTTL: 3000,    // Default TTL of 3 seconds for every .set() (if not overridden)
  checkPeriod: 5000    // Automatically removes expired keys every 5 seconds
});

// 2. Store data in the cache
cache.set('user:1', { name: 'Alice' }, 5000); // Expires in 5 seconds
cache.set('user:2', { name: 'Bob' });         // Uses defaultTTL (3 seconds)

// 3. Retrieve data
const user1 = cache.get<{ name: string }>('user:1');
console.log('User1:', user1?.name); // → Alice

// 4. Check existence
if (cache.has('user:2')) {
  console.log('User2 is cached.');
}

// 5. See when a key will expire
const expiry = cache.expiresAt('user:1');
if (expiry) {
  console.log('User1 expires at:', new Date(expiry).toLocaleString()); //normally it returns the expiration timestamp (in ms) for a key.
}

// 6. Manually remove expired items
setTimeout(() => {
  cache.removeExpired();
  console.log('Expired keys cleaned up.');
}, 6000);

// 7. Delete a specific key
cache.del('user:2');

// 8. Flush the entire cache
cache.flush();

// 9. Stop the internal cleanup timer (optional cleanup)
process.on('SIGINT', () => {
  cache.stop();
  console.log('Cache cleanup stopped. Exiting...');
  process.exit();
});

// 10. Print cache size
console.log(`Cache size: ${cache.size()}`);

```

---

This library is conceptually inspired by node-cache, but with a lighter footprint, singleton access, and full TypeScript typings.

---