open-index/open-npm huggingface dataset:
npm package: @lokat/core
Description: Ultra-lightweight agnostic i18n core designed for maximum runtime performance, minimal latency, and tiny size
Author: KazViz
Latest version: 0.1.2

# @lokat/core

Ultra-lightweight i18n core designed for maximum runtime performance, minimal latency, and tiny size — without framework assumptions.

- Framework-agnostic core (no React/Svelte/Solid knowledge)
- No global mutable state, SSR/Edge safe by default
- Single fetch per locale (instance cache)
- O(1) translation lookup, zero allocation per call
- Flat dictionary only: `{ "a.b": "..." }`

## Install

```sh
# using npm
npm install @lokat/core
# or pnpm
pnpm add @lokat/core
# or bun
bun add @lokat/core
```

## Quick Start

```ts
import { createLokat } from "@lokat/core";

const i18n = createLokat({
  resolveLocaleUrl: (locale) => `/locales/${locale}.json`,
  // fetcher?: customFetch // optional, defaults to global fetch when available
});

const dict = await i18n.load("en");
const t = i18n.createT(dict);

console.log(t("home.title")); // => "Welcome" (or key if missing)
```

Dictionary format (flat keys):

```json
{
  "home.title": "Welcome",
  "home.subtitle": "Fast. Small. Predictable."
}
```

## API

- `createLokat(options): LokatInstance`
  - `resolveLocaleUrl(locale: string): string` — required URL resolver
  - `fetcher?(input: string): Promise<{ json(): unknown }>` — optional fetch function
- `LokatInstance.load(locale: string): Promise<Record<string, string>>` — loads and caches dictionary per locale
- `LokatInstance.createT(dict): (key: string) => string` — returns a translator: `dict[key] ?? key`

## Design Principles

- Pure function hot-path; no class/proxy/reflection
- No nested key resolution, no ICU/plural/gender in core
- All advanced features belong in adapters or build-time tools

## Adapters (Optional)

Adapters for Solid/Svelte/React can wrap this core with minimal reactive glue. They do not alter hot-path costs.

## License

MIT
npm package: @lokat/solid
Description: Ultra-lightweight and ultra-fast i18n for SolidJS. Reactive by design, zero overhead on the hot-path, and safe across SSR/CSR/edge.
Author: KazViz
Latest version: 0.1.2

# @lokat/solid

SolidJS adapter for the ultra-lightweight `@lokat/core`. Reactive by design, zero overhead on the hot-path, and safe across SSR/CSR/edge.

- Reactive: `createSignal` + `createMemo`, instant locale switch
- Hot-path: `t(key)` stays `dict[key] ?? key`
- SSR/CSR/hybrid safe: instance-scoped, no globals
- Locale is opaque: any type you need
- Dev-only DX: hooks removed from production builds

## Install

```sh
bun add @lokat/solid
# peer dep (expected in your app)
bun add solid-js
```

## API

```ts
import { createSolidLokat } from "@lokat/solid"

interface SolidLokatOptions<L = unknown> {
  initialLocale: L
  initialDict?: Record<string, string>
  loadLocale: (locale: L) => Promise<Record<string, string>>
  dev?: {
    disableCache?: boolean
    onLocaleChange?: (locale: L) => void
    onError?: (error: unknown, locale: L) => void
  }
}

interface SolidLokatInstance<L = unknown> {
  t: (key: string) => string
  locale: () => L
  setLocale: (l: L) => Promise<Record<string, string>>
  preload: (l: L) => Promise<Record<string, string>>
}
```

## Usage (CSR)

```ts
import { createSolidLokat } from "@lokat/solid"

const i18n = createSolidLokat({
  initialLocale: "en",
  loadLocale: async (l) => (await fetch(`/locales/${l}.json`)).json()
})

// translate in components
const title = i18n.t("home.title")

// switch locale
await i18n.setLocale("id")
```

## Usage (SSR hydration)

```ts
const dict = getSSRDictForLocale("en") // injected at render time
const i18n = createSolidLokat({
  initialLocale: "en",
  initialDict: dict,
  loadLocale: async (l) => (await fetch(`/locales/${l}.json`)).json()
})
```

## Preload before navigation

```ts
await i18n.preload("id")
```

## Performance Guarantees

- Translation: O(1), zero allocation per call
- Locale change: instant re-render of `t` consumers
- Cache: one load per locale (unless `disableCache`)

## License

MIT
npm package: @loke/config
Description: LOKE application configuration management
Latest version: 3.0.0

# LOKE Config

Convention based configuration module using YAML for Node apps.

## Paths

The configuration exposed will be created from the following paths (settings in paths higher on the list will override those lower on the list):

- {app_path}/config.yml
- {app_path}/config/config.yml
- /private/etc/{app_name}/config.yml
- /etc/{app_name}/config.yml
- {app_path}/config/defaults.yml

However, if the process has a `--config [filename]` argument, then that file will be used instead.

The `defaults.yml` file is required, and all configuration keys must have a value listed in the `defaults.yml`.

## YAML

Config files are defined using YAML. See http://yaml.org/

## How to Use

Example defaults.yml:
```yaml
server:
  hostname: www.myapp.com
  port: 80
```

```js
var config = require('loke-config').create('myapp');

var hostname = config.get('server.hostname');
var port = config.get('server.port');

console.log(hostname); // www.myapp.com
console.log(port); // 80
```

### Environment Variables

You can also override variables using environment variables.
Specify them in upper case, and replace `.` with `__` (double underscore).

eg:
```
SERVER__HOSTNAME=www.mynewapp.com npm start
```
npm package: @loke/db-kit
Description: Wrapper around knex to provide some sugar such as metrics and slow query logging
Author: Dominic Smith
Latest version: 2.1.3

# LOKE DB Kit

A lib for use with database libraries

```js
const dbKit = require("@loke/db-kit");
```

## Knex

### `createConfig(options)`

```js
const knex = require("knex");
const dbUri = "postgres://localhost/test-db";

const dbClient = knex(dbKit.knex.createConfig({ connection: dbUri }));
```

or if you're using a knexfile.js

```js
module.exports = dbKit.knex.createConfig({
  connection: process.env.DATABASE_URL || { database: "test-link" }
});
```

The options are as follows

#### `connection`

Gets passed directly to knex

#### `client`

The sql client to use, defaults to `"pg"`.

#### `migrationsDirectory`

Where to place the db migrations, defaults to `"./lib/postgres/migrations"`.

### `async setup(dbClient, logger, options)`

```js
const knex = require("knex");

const dbClient = knex(/* ... */);

dbKit.knex.setup(dbClient, console);
```

Options are:

#### `slowQueryThreshold`

Threshold for logging slow queries in ms, defaults to `200`

#### `migrateUp`

weather or not `setup` should migrate the db to the latest schema. Defaults to `true`.

### `registerMetrics(registry)`

Regester metrics with `prom-client`

```js
const { register } = require("prom-client");

dbKit.knex.registerMetrics(register);
```

### `formatConnection(connection)`

Formats a connection object/string that is valid in `knex()`, redacts the password.

```js
console.log("Using database", dbKit.knex.formatConnection(uri));
```

### Best Practice

Bringing this all together you should probably have something like...

knexfile.js

```js
const { knex } = require("@loke/db-kit");

module.exports = knex.createConfig({
  connection: process.env.DATABASE_URL || { database: "service-name" }
});
```

server.js

```js
const dbKit = require("@loke/db-kit");
const lokeLogger = require("@loke/logger");
const promClient = require("prom-client");

const dbConfig = require("./knexfile");


dbKit.knex.registerMetrics(promClient.register);


function main() {
  const logger = lokeLogger.create({ metricsRegistry: promClient.register });
  
  logger.info("Using database", dbKit.knex.formatConnection(dbConfig.connection));
  const dbClient = knex(dbConfig, logger.withPrefix("db"));
  
  await dbKit.knex.setup(dbClient, dbLogger);
  
  // ...
}
```