Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: ci

on:
push:
branches: [main]
pull_request:
workflow_dispatch:

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
test:
name: test
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version-file: package.json
- run: bun install --frozen-lockfile
- run: bun run fmt:check
- run: bun run lint
- run: bun run typecheck
- run: bun run test
- run: bun run build
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
dist/
coverage/
.tmp/
4 changes: 4 additions & 0 deletions .oxfmtrc.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"printWidth": 120,
"ignorePatterns": ["dist/**", "coverage/**", "*.lock", "**/*.md"],
}
26 changes: 26 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"plugins": ["eslint", "typescript", "unicorn", "oxc", "import", "vitest"],
"categories": {
"correctness": "error",
"suspicious": "error"
},
"ignorePatterns": ["dist/**", "coverage/**"],
"rules": {
"eslint/max-lines": ["error", { "max": 200, "skipBlankLines": true, "skipComments": true }],
"eslint/no-console": "error",
"import/no-cycle": "error",
"import/no-default-export": "error",
"typescript/no-explicit-any": "error",
"typescript/no-non-null-assertion": "error"
},
"overrides": [
{
"files": ["**/*.config.ts"],
"rules": { "import/no-default-export": "off" }
},
{
"files": ["**/*.test.ts"],
"rules": { "eslint/max-lines": "off", "unicorn/consistent-function-scoping": "off" }
}
]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Lovro Žagar

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
# ui

Fast, SSR-ready UI library built on Solid, TanStack Form and Tailwind.

Every utility is its own subpath export: import the one you need, the rest is never loaded and is tree-shaken from your bundle.

```sh
bun add @workerstack/ui
```

| Import | What it is |
| --- | --- |
| `@workerstack/ui/lru-cache` | Bounded LRU cache with soft and hard TTLs for stale-while-revalidate |
| `@workerstack/ui/tiered-cache` | Isolate LRU → Workers KV → source cache on a TTL preset, with request bypass and tracing |

```ts
import { LruCache } from "@workerstack/ui/lru-cache";

const cache = new LruCache<string, number>({ maxSize: 100, ttlMs: 30_000, hardTtlMs: 60_000 });
cache.set("a", 1);
cache.getWithMeta("a"); // { value: 1, stale: false }
```

```ts
import { TieredCache } from "@workerstack/ui/tiered-cache";

const users = new TieredCache<User>({ name: "users", preset: "STANDARD", maxSize: 500, kv: { prefix: "user:" } });

const user = await users.get(id, { background: ctx.waitUntil.bind(ctx) }, { kv: env.CACHE, fetch: () => db.user(id) });
```

## Development

```sh
bun install
bun run fmt:check && bun run lint && bun run typecheck && bun run test && bun run build
```

## License

MIT
292 changes: 292 additions & 0 deletions bun.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions bunfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[install]
linker = "hoisted"
exact = true
61 changes: 61 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"name": "@workerstack/ui",
"version": "0.0.0",
"description": "Fast, SSR-ready UI library built on Solid, TanStack Form and Tailwind",
"keywords": [
"solid",
"ui",
"workerstack"
],
"homepage": "https://github.com/workerstack/ui#readme",
"bugs": {
"url": "https://github.com/workerstack/ui/issues"
},
"license": "MIT",
"author": "Lovro Žagar",
"repository": {
"type": "git",
"url": "git+https://github.com/workerstack/ui.git"
},
"files": [
"dist",
"!dist/**/*.map",
"README.md",
"LICENSE"
],
"type": "module",
"sideEffects": false,
"exports": {
"./lru-cache": {
"types": "./dist/lru-cache/index.d.ts",
"default": "./dist/lru-cache/index.js"
},
"./tiered-cache": {
"types": "./dist/tiered-cache/index.d.ts",
"default": "./dist/tiered-cache/index.js"
},
"./package.json": "./package.json"
},
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "rm -rf dist && tsc -p tsconfig.build.json",
"fmt": "oxfmt",
"fmt:check": "oxfmt --check",
"lint": "oxlint --deny-warnings",
"prepublishOnly": "bun run build",
"test": "vitest run",
"typecheck": "tsc -p tsconfig.json"
},
"devDependencies": {
"oxfmt": "0.78.0",
"oxlint": "1.93.0",
"typescript": "7.0.2",
"vitest": "4.1.10"
},
"engines": {
"node": ">=22.12.0"
},
"packageManager": "bun@1.4.4"
}
2 changes: 2 additions & 0 deletions src/lru-cache/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { LruCache } from "./lru-cache.ts";
export type { LruCacheOptions, LruMeta } from "./lru-cache.types.ts";
Loading
Loading