divhunt 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/src/classes/error/class.js +2 -2
- package/package.json +3 -3
- package/.claude/settings.local.json +0 -13
- package/CLAUDE.md +0 -132
- package/architecture.md +0 -138
- package/brief.md +0 -62
- package/decisions.md +0 -58
- package/lib/README.md +0 -132
- package/progress.md +0 -35
- package/tasks.md +0 -23
- /package/lib/{load.js → load.back.js} +0 -0
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "divhunt",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "Full-stack isomorphic JavaScript framework built from scratch. One addon abstraction powers databases, servers, commands, pages, directives, queues, and more.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "lib/load.js",
|
|
6
|
+
"main": "lib/load.back.js",
|
|
7
7
|
"browser": "lib/browser.js",
|
|
8
8
|
"exports": {
|
|
9
|
-
".": "./lib/load.js",
|
|
9
|
+
".": "./lib/load.back.js",
|
|
10
10
|
"./browser": "./lib/browser.js",
|
|
11
11
|
"./database": "./addons/core/database/back/load.js",
|
|
12
12
|
"./servers/grpc": "./addons/core/servers/back/grpc/load.js",
|
package/CLAUDE.md
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
# CLAUDE.md — Divhunt Framework
|
|
2
|
-
|
|
3
|
-
## PURPOSE
|
|
4
|
-
|
|
5
|
-
AI project guardian. Maintains full context, protects scope, tracks every decision, and keeps all project files synchronized. This file is the operating system of this project.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## STATUS
|
|
10
|
-
|
|
11
|
-
Phase: 3 — Maintenance
|
|
12
|
-
Focus: Stability, bugfixes, optimization
|
|
13
|
-
Blocker: None
|
|
14
|
-
Last session: 2026-02-19 — Added DivhuntError (divhunt.Error(code, message, context)), emit on error, removed copyright headers
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## PHASES
|
|
19
|
-
|
|
20
|
-
### Phase 1: V2 Build (completed)
|
|
21
|
-
- Core rebuilt from scratch — Proxy reactivity, mixin composition, addon abstraction
|
|
22
|
-
- PostgreSQL ORM, HTTP/gRPC servers, command system, render engine
|
|
23
|
-
- 40+ UI components, SPA router, directive system, asset bundler
|
|
24
|
-
- **Gate:** Framework powers a real application end-to-end.
|
|
25
|
-
|
|
26
|
-
### Phase 2: Open Source Launch (completed)
|
|
27
|
-
- Published on npm as `divhunt`
|
|
28
|
-
- MIT license
|
|
29
|
-
- Full documentation (6 docs covering all subsystems)
|
|
30
|
-
- Working example (basic-api)
|
|
31
|
-
- Public GitHub repo
|
|
32
|
-
- **Gate:** Published, documented, usable by external developers.
|
|
33
|
-
|
|
34
|
-
### Phase 3: Maintenance (current)
|
|
35
|
-
- Bugfixes, stability improvements, performance optimization
|
|
36
|
-
- No new major features without explicit approval
|
|
37
|
-
- Documentation kept up to date
|
|
38
|
-
- **Gate:** Stable, battle-tested, zero critical bugs.
|
|
39
|
-
|
|
40
|
-
### Phase 4: Growth
|
|
41
|
-
- Community adoption, contributions
|
|
42
|
-
- New addons, integrations
|
|
43
|
-
- Plugin system, ecosystem
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
## MODES
|
|
48
|
-
|
|
49
|
-
### Work Mode (default)
|
|
50
|
-
Normal development. Follow tasks, fix bugs, optimize code.
|
|
51
|
-
|
|
52
|
-
### Vision Mode
|
|
53
|
-
**Trigger:** "let's talk about the vision", "let's change the vision", "let's discuss strategy", "let's talk about the framework direction"
|
|
54
|
-
|
|
55
|
-
Behavior:
|
|
56
|
-
1. Read brief.md and current STATUS
|
|
57
|
-
2. Discuss with user — ask questions, challenge assumptions, propose alternatives
|
|
58
|
-
3. After alignment, update ALL affected files:
|
|
59
|
-
- brief.md — product definition changes
|
|
60
|
-
- architecture.md — if technical direction changes
|
|
61
|
-
- decisions.md — log what changed and why
|
|
62
|
-
- tasks.md — add/remove/reprioritize
|
|
63
|
-
- progress.md — adjust milestones if needed
|
|
64
|
-
4. Update STATUS in CLAUDE.md
|
|
65
|
-
5. Print a summary of all changes made
|
|
66
|
-
|
|
67
|
-
### Review Mode
|
|
68
|
-
**Trigger:** "where are we?", "status?", "overview", "what's done?"
|
|
69
|
-
|
|
70
|
-
Behavior:
|
|
71
|
-
1. Read all files
|
|
72
|
-
2. Give a concise report: phase, focus, blockers, recent progress, next steps
|
|
73
|
-
|
|
74
|
-
### Decision Mode
|
|
75
|
-
**Trigger:** "I need to decide", "what do you think I should choose", "I have a dilemma"
|
|
76
|
-
|
|
77
|
-
Behavior:
|
|
78
|
-
1. Listen to the options
|
|
79
|
-
2. Analyze pros and cons of each
|
|
80
|
-
3. Give a recommendation with reasoning
|
|
81
|
-
4. After the decision — log in decisions.md with full context
|
|
82
|
-
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-
## RULES
|
|
86
|
-
|
|
87
|
-
### Scope Protection
|
|
88
|
-
- Phase 3 = maintenance. No new features without explicit approval.
|
|
89
|
-
- If user proposes a new feature → "Is this maintenance or Phase 4? Logging in tasks.md as future."
|
|
90
|
-
- Bugfix and optimization PRs are always welcome
|
|
91
|
-
- Breaking changes require a decision logged in decisions.md
|
|
92
|
-
|
|
93
|
-
### Decision Tracking
|
|
94
|
-
- Every non-trivial decision MUST be logged in decisions.md BEFORE implementation
|
|
95
|
-
- Format: decision + reason + rejected alternatives + context
|
|
96
|
-
|
|
97
|
-
### Session Management
|
|
98
|
-
- Start of session: read STATUS and tasks.md to know where you are
|
|
99
|
-
- End of session: update STATUS (phase, focus, blocker, last session summary)
|
|
100
|
-
- If session was a vision/strategy discussion — update all affected files
|
|
101
|
-
|
|
102
|
-
### Auto-Update Rules
|
|
103
|
-
- **brief.md** — Changes ONLY in Vision Mode with explicit approval.
|
|
104
|
-
- **architecture.md** — Updated when code or technical direction changes.
|
|
105
|
-
- **decisions.md** — Every decision, immediately, no exceptions.
|
|
106
|
-
- **tasks.md** — Updated when a task is completed, added, or reprioritized.
|
|
107
|
-
- **progress.md** — Updated when a milestone is reached.
|
|
108
|
-
|
|
109
|
-
### Git
|
|
110
|
-
- Never add Co-Authored-By or any co-author lines to commit messages
|
|
111
|
-
- All commits are authored solely by Dejan Tomic
|
|
112
|
-
- Use SSH remote: git@github-iamdejan:tomic-d/framework.git
|
|
113
|
-
- Commit style: short, lowercase, imperative, no period
|
|
114
|
-
|
|
115
|
-
### Communication
|
|
116
|
-
- Serbian or English, match the user
|
|
117
|
-
- Direct, no fluff
|
|
118
|
-
- When user is wrong — say it
|
|
119
|
-
- When user is right — confirm it
|
|
120
|
-
- Code style: follow existing conventions with maximum precision
|
|
121
|
-
|
|
122
|
-
---
|
|
123
|
-
|
|
124
|
-
## FILES
|
|
125
|
-
|
|
126
|
-
| File | Purpose | When it changes |
|
|
127
|
-
|---|---|---|
|
|
128
|
-
| brief.md | What, for whom, why, vision, competition | Vision Mode, with approval |
|
|
129
|
-
| architecture.md | Living technical overview of the system | When code/tech stack changes |
|
|
130
|
-
| decisions.md | Decision + why + rejected alternatives | Every decision, immediately |
|
|
131
|
-
| tasks.md | Active tasks, granular | When task is added/completed/changed |
|
|
132
|
-
| progress.md | Milestones, what's done | When a milestone is reached |
|
package/architecture.md
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
# ARCHITECTURE — Divhunt Framework
|
|
2
|
-
|
|
3
|
-
*Living technical overview. Updated alongside the code.*
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Status: Stable — V2 complete, in maintenance
|
|
8
|
-
|
|
9
|
-
## Stack
|
|
10
|
-
|
|
11
|
-
- **Language:** JavaScript (ES Modules, `"type": "module"`)
|
|
12
|
-
- **Runtime:** Node.js >= 18 (backend), Browser (frontend bundle)
|
|
13
|
-
- **Database:** PostgreSQL via Knex
|
|
14
|
-
- **Transport:** HTTP + gRPC
|
|
15
|
-
- **Bundling:** Convention-based (terser for minification)
|
|
16
|
-
- **SSR:** linkedom for server-side DOM
|
|
17
|
-
- **No TypeScript, no test framework, no linter, no build step**
|
|
18
|
-
|
|
19
|
-
## Project Structure
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
lib/ Core Divhunt class + 17 mixins
|
|
23
|
-
load.js Node.js entry point (creates instance, handles signals)
|
|
24
|
-
browser.js Browser entry point (attaches to window, mounts body)
|
|
25
|
-
src/
|
|
26
|
-
divhunt.js Main class (mixin-composed)
|
|
27
|
-
mixins/ addons, emitter, middleware, data, dom, route,
|
|
28
|
-
function, generate, binaries, helper, validate,
|
|
29
|
-
string, request, logger, dependencies, overrides, error
|
|
30
|
-
classes/
|
|
31
|
-
addon/ DivhuntAddon + mixins (fields, items, functions, find, render, store)
|
|
32
|
-
classes/
|
|
33
|
-
item/ DivhuntAddonItem + mixins (get, set, crud, functions, store)
|
|
34
|
-
render/ DivhuntAddonRender + mixins (compile, dom, process, events)
|
|
35
|
-
error/ DivhuntError class (extends Error — code, message, context)
|
|
36
|
-
|
|
37
|
-
addons/ Built-in addon library
|
|
38
|
-
core/
|
|
39
|
-
database/ PostgreSQL ORM (Knex, fluent query builder, 17+ operators)
|
|
40
|
-
servers/ HTTP + gRPC servers
|
|
41
|
-
clients/ HTTP + gRPC clients
|
|
42
|
-
commands/ Typed API command system
|
|
43
|
-
queue/ Concurrency task queue
|
|
44
|
-
render/
|
|
45
|
-
directives/ dh-if, dh-for, dh-click, dh-fetch, dh-show, dh-html, dh-text
|
|
46
|
-
pages/ SPA page router with CSS Grid layouts + async data loading
|
|
47
|
-
elements/ 40+ pre-built UI components
|
|
48
|
-
assets/ Convention-based asset bundler (terser)
|
|
49
|
-
html/ HTML document builder
|
|
50
|
-
tags/ HTML tag system
|
|
51
|
-
transforms/ Data transforms
|
|
52
|
-
modules/
|
|
53
|
-
variables/ Named variable registry
|
|
54
|
-
actions/ Action triggers
|
|
55
|
-
events/ Event bindings
|
|
56
|
-
schedules/ Cron-like scheduling
|
|
57
|
-
shortcuts/ Keyboard shortcut bindings
|
|
58
|
-
sources/ Data source registry
|
|
59
|
-
float/
|
|
60
|
-
modals/ Modal dialogs
|
|
61
|
-
toasts/ Toast notifications
|
|
62
|
-
tooltips/ Tooltip system
|
|
63
|
-
popups/ Popup menus
|
|
64
|
-
overlays/ Overlay backdrops
|
|
65
|
-
|
|
66
|
-
docs/ Full documentation (6 files)
|
|
67
|
-
examples/basic-api/ Minimal working example
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## Key Classes
|
|
71
|
-
|
|
72
|
-
| Class | Mixins | Purpose |
|
|
73
|
-
|---|---|---|
|
|
74
|
-
| Divhunt | 17 | Core engine — addon registry, emitter, middleware, routing, DOM, error |
|
|
75
|
-
| DivhuntAddon | 9 | Addon abstraction — fields, items, functions, find, render, store |
|
|
76
|
-
| DivhuntAddonItem | 6 | Single record — get, set, CRUD, functions, store |
|
|
77
|
-
| DivhuntAddonRender | 7 | Frontend component — compile, DOM diffing, events, lifecycle |
|
|
78
|
-
| DivhuntError | — | Structured error (extends Error) — code, message, context |
|
|
79
|
-
|
|
80
|
-
## Import Aliases
|
|
81
|
-
|
|
82
|
-
Defined in `package.json` under `imports`:
|
|
83
|
-
|
|
84
|
-
| Alias | Maps to |
|
|
85
|
-
|---|---|
|
|
86
|
-
| `#framework/*` | `./lib/*` |
|
|
87
|
-
| `#database/*` | `./addons/core/database/back/*` |
|
|
88
|
-
| `#servers/*` | `./addons/core/servers/back/*` |
|
|
89
|
-
| `#clients/*` | `./addons/core/clients/back/*` |
|
|
90
|
-
| `#commands/*` | `./addons/core/commands/back/*` |
|
|
91
|
-
| `#queue/*` | `./addons/core/queue/back/*` |
|
|
92
|
-
| `#assets/*` | `./addons/render/assets/back/*` |
|
|
93
|
-
| `#html/*` | `./addons/render/html/*` |
|
|
94
|
-
| `#directives/*` | `./addons/render/directives/*` |
|
|
95
|
-
| `#elements/*` | `./addons/render/elements/*` |
|
|
96
|
-
| `#tags/*` | `./addons/render/tags/*` |
|
|
97
|
-
| `#sources/*` | `./addons/modules/sources/*` |
|
|
98
|
-
| `#variables/*` | `./addons/modules/variables/*` |
|
|
99
|
-
|
|
100
|
-
## Design Decisions
|
|
101
|
-
|
|
102
|
-
### Mixin composition over inheritance
|
|
103
|
-
`Object.assign(Class.prototype, mixin)`. No class hierarchies. Each mixin is a plain object of methods merged onto the prototype.
|
|
104
|
-
|
|
105
|
-
### Middleware as the extension point
|
|
106
|
-
CRUD operations are async middleware chains. Database addon intercepts for SQL. Without database — everything works in-memory. Storage is swappable.
|
|
107
|
-
|
|
108
|
-
### Self-registering imports
|
|
109
|
-
Importing `load.js` registers the addon. No manual wiring, no DI container. `AddonReady` handles async dependency resolution regardless of import order.
|
|
110
|
-
|
|
111
|
-
### Field transforms
|
|
112
|
-
Every field has `get[]` and `set[]` transform arrays plus a `define` schema. Type coercion, validation, and computed fields are declared at the field level.
|
|
113
|
-
|
|
114
|
-
### Proxy-driven reactivity (frontend)
|
|
115
|
-
Property assignment triggers Proxy trap → schedules 16ms debounced `Update()` → re-compile → DOM diff → patch. No virtual DOM.
|
|
116
|
-
|
|
117
|
-
### Binary transport over gRPC
|
|
118
|
-
Buffer instances extracted to separate `map<string, bytes>` before sending. Re-injected on receive. Transparent binary transport over JSON-based gRPC.
|
|
119
|
-
|
|
120
|
-
### Structured error handling
|
|
121
|
-
`divhunt.Error(code, message, context)` returns a `DivhuntError` (extends `Error`). HTTP-compatible codes (400, 404, 500). Emits `'error'` event on creation. HTTP server and command system read `error.code` instead of hardcoding 500. `LogError` includes code and context in meta.
|
|
122
|
-
|
|
123
|
-
### Convention-based bundling
|
|
124
|
-
No webpack. Scans directories, prioritizes `addon.js`, strips ES module syntax, concatenates by order, minifies via terser.
|
|
125
|
-
|
|
126
|
-
## Dependencies
|
|
127
|
-
|
|
128
|
-
| Package | Purpose |
|
|
129
|
-
|---|---|
|
|
130
|
-
| knex | SQL query builder |
|
|
131
|
-
| pg | PostgreSQL driver |
|
|
132
|
-
| @grpc/grpc-js | gRPC server/client |
|
|
133
|
-
| @grpc/proto-loader | gRPC proto loading |
|
|
134
|
-
| bcrypt | Password hashing |
|
|
135
|
-
| busboy | Multipart/file upload parsing |
|
|
136
|
-
| dotenv | Environment config |
|
|
137
|
-
| linkedom | Server-side DOM |
|
|
138
|
-
| terser | JS minification |
|
package/brief.md
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
# BRIEF — Divhunt Framework
|
|
2
|
-
|
|
3
|
-
*Product definition. What this is, for whom, and why.*
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## What is this?
|
|
8
|
-
|
|
9
|
-
Full-stack isomorphic JavaScript framework built from scratch. No React, no Express, no Vue — original architecture from zero. One universal abstraction — the **addon** — powers everything: databases, servers, commands, pages, directives, queues, and more.
|
|
10
|
-
|
|
11
|
-
Published on npm as `divhunt`. Version 2.0.0.
|
|
12
|
-
|
|
13
|
-
## Who is it for?
|
|
14
|
-
|
|
15
|
-
Primary: Dejan's own projects (Divhunt platform, Agents, freelance work).
|
|
16
|
-
Secondary: Open-source community — developers who want a different approach to full-stack JS.
|
|
17
|
-
|
|
18
|
-
## What problem does it solve?
|
|
19
|
-
|
|
20
|
-
Modern JS ecosystem is fragmented. You need React + Express + Prisma + Next + 50 packages just to build a CRUD app. This framework gives you one abstraction that handles backend, frontend, data, APIs, and reactivity — all from a single addon definition.
|
|
21
|
-
|
|
22
|
-
Define an addon with fields → you get: validation, events, middleware, PostgreSQL CRUD, API exposure, frontend reactivity, and DOM manipulation. No glue code.
|
|
23
|
-
|
|
24
|
-
## Technical identity
|
|
25
|
-
|
|
26
|
-
- **Zero external framework dependencies** — built from scratch
|
|
27
|
-
- **Addon as universal abstraction** — every entity is an addon
|
|
28
|
-
- **Mixin composition** — no inheritance hierarchies, Object.assign on prototypes
|
|
29
|
-
- **Middleware chains** — storage-agnostic CRUD (in-memory by default, PostgreSQL via addon)
|
|
30
|
-
- **Proxy-based reactivity** — 16ms debounced DOM diffing, no virtual DOM
|
|
31
|
-
- **gRPC + HTTP** — dual transport, binary-safe
|
|
32
|
-
- **Convention-based bundling** — no webpack, no config
|
|
33
|
-
- **Self-registering imports** — import order doesn't matter
|
|
34
|
-
|
|
35
|
-
## Production track record
|
|
36
|
-
|
|
37
|
-
- V1 powered Divhunt cloud SaaS for 4+ years (thousands of users)
|
|
38
|
-
- Travel agency site (27 addons, 50+ components)
|
|
39
|
-
- Distributed function execution gateway
|
|
40
|
-
- Multi-tenant CMS
|
|
41
|
-
- Divhunt Agents platform (current)
|
|
42
|
-
|
|
43
|
-
## Competition
|
|
44
|
-
|
|
45
|
-
| Framework | How we're different |
|
|
46
|
-
|---|---|
|
|
47
|
-
| Express | Backend only, no frontend, no ORM, no reactivity |
|
|
48
|
-
| Next.js | React-based, different paradigm, heavy |
|
|
49
|
-
| Nuxt | Vue-based, same issue |
|
|
50
|
-
| Fastify | Backend only, no addon abstraction |
|
|
51
|
-
| Hono | Lightweight but backend only |
|
|
52
|
-
|
|
53
|
-
Our edge: one abstraction for everything. No framework soup. One person can build a full production app.
|
|
54
|
-
|
|
55
|
-
## Vision
|
|
56
|
-
|
|
57
|
-
1. ~~V2 rebuild~~ (done)
|
|
58
|
-
2. ~~Open source~~ (done)
|
|
59
|
-
3. Stability and documentation (current)
|
|
60
|
-
4. Community adoption
|
|
61
|
-
5. Plugin ecosystem
|
|
62
|
-
6. Become a viable alternative for solo developers and small teams
|
package/decisions.md
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# DECISIONS — Divhunt Framework
|
|
2
|
-
|
|
3
|
-
*Every decision with reasoning. Never delete, only append.*
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## D001 — Mixin composition over class inheritance
|
|
8
|
-
**Date:** Pre-open-source
|
|
9
|
-
**Decision:** Use `Object.assign(Class.prototype, mixin)` instead of class inheritance.
|
|
10
|
-
**Reason:** No diamond problem, no deep hierarchies, easy to add/remove capabilities. Each mixin is a plain object — simple to read, test, and compose.
|
|
11
|
-
**Rejected alternatives:**
|
|
12
|
-
- Class inheritance — fragile hierarchies, hard to compose multiple behaviors
|
|
13
|
-
- Functional composition — loses `this` context, harder to debug
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## D002 — Addon as universal abstraction
|
|
18
|
-
**Date:** Pre-open-source
|
|
19
|
-
**Decision:** Every entity (users, pages, commands, servers) is an addon with the same interface: fields, items, functions, events, middleware.
|
|
20
|
-
**Reason:** One pattern to learn. Backend and frontend use the same abstraction. Reduces cognitive load.
|
|
21
|
-
**Rejected alternatives:**
|
|
22
|
-
- Separate abstractions for models, controllers, components — more code, more concepts, more glue
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
## D003 — Open source under MIT
|
|
27
|
-
**Date:** 2026-02-19
|
|
28
|
-
**Decision:** Publish framework as open source on GitHub under MIT license.
|
|
29
|
-
**Reason:** Portfolio value. Framework proves deep technical capability. Public code > private code for career and credibility.
|
|
30
|
-
**Rejected alternatives:**
|
|
31
|
-
- Keep private — no portfolio benefit, no community
|
|
32
|
-
- AGPL/proprietary — limits adoption
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## D004 — AI-managed project files
|
|
37
|
-
**Date:** 2026-02-19
|
|
38
|
-
**Decision:** Use CLAUDE.md + structured files (brief, architecture, decisions, tasks, progress) for project management.
|
|
39
|
-
**Reason:** Same system used for Agents repo and iamdejan.com. AI maintains context across sessions, tracks decisions, protects scope.
|
|
40
|
-
**Context:** Third project using this system. Pattern is proven.
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## D005 — divhunt.Error() instead of global DivhuntError class
|
|
45
|
-
**Date:** 2026-02-19
|
|
46
|
-
**Decision:** Structured errors via `divhunt.Error(code, message, context)` method on the instance, not a global class.
|
|
47
|
-
**Reason:** `divhunt` is already imported everywhere. No additional imports needed. Emits `'error'` event on creation so listeners can react. Returns a throwable `DivhuntError extends Error`.
|
|
48
|
-
**Rejected alternatives:**
|
|
49
|
-
- `globalThis.DivhuntError` — global pollution
|
|
50
|
-
- `throw new Error({})` — Error constructor expects string, object becomes `[object Object]`
|
|
51
|
-
- Separate import — extra boilerplate in every file
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
## D006 — Remove copyright headers from source files
|
|
56
|
-
**Date:** 2026-02-19
|
|
57
|
-
**Decision:** Remove `// © 2025 Divhunt GmbH` comment from all 92 source files.
|
|
58
|
-
**Reason:** MIT license in LICENSE file is sufficient. Copyright headers add noise to every file.
|
package/lib/README.md
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
## Built with the Divhunt Framework – non-commercial use only. For commercial use, contact dejan@divhunt.com.
|
|
2
|
-
|
|
3
|
-
# Divhunt Framework
|
|
4
|
-
|
|
5
|
-
A lightweight, extensible JavaScript framework built around an addon system with powerful data validation, event handling, and DOM manipulation capabilities.
|
|
6
|
-
|
|
7
|
-
## Core Architecture
|
|
8
|
-
|
|
9
|
-
The framework consists of a main `Divhunt` class with modular mixins and an extensible addon system:
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
Framework Core
|
|
13
|
-
├── Divhunt Class (main)
|
|
14
|
-
├── Mixins (functionality)
|
|
15
|
-
│ ├── Addons
|
|
16
|
-
│ ├── Data Validation
|
|
17
|
-
│ ├── Event System
|
|
18
|
-
│ ├── Middleware
|
|
19
|
-
│ ├── DOM Manipulation
|
|
20
|
-
│ └── Utilities
|
|
21
|
-
└── Addon System
|
|
22
|
-
├── DivhuntAddon
|
|
23
|
-
├── DivhuntAddonItem
|
|
24
|
-
└── DivhuntAddonRender
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Quick Start
|
|
28
|
-
|
|
29
|
-
### Server-side
|
|
30
|
-
```javascript
|
|
31
|
-
import Divhunt from './lib/load.js';
|
|
32
|
-
|
|
33
|
-
const divhunt = new Divhunt();
|
|
34
|
-
|
|
35
|
-
// Create an addon
|
|
36
|
-
const users = divhunt.Addon('users', (addon) => {
|
|
37
|
-
addon.Field('name', ['string']);
|
|
38
|
-
addon.Field('email', ['string']);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
// Add items
|
|
42
|
-
users.Item({
|
|
43
|
-
name: 'John Doe',
|
|
44
|
-
email: 'john@example.com'
|
|
45
|
-
});
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### Browser
|
|
49
|
-
```html
|
|
50
|
-
<script src="framework/browser.js"></script>
|
|
51
|
-
<script>
|
|
52
|
-
// window.divhunt is automatically available
|
|
53
|
-
const myAddon = window.divhunt.Addon('myAddon');
|
|
54
|
-
</script>
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
## Core Features
|
|
58
|
-
|
|
59
|
-
### 🔧 Addon System
|
|
60
|
-
Create modular, reusable components with built-in validation
|
|
61
|
-
|
|
62
|
-
### 📊 Data Validation
|
|
63
|
-
Powerful schema-based validation with nested objects and arrays
|
|
64
|
-
|
|
65
|
-
### 🎯 Event System
|
|
66
|
-
Publisher-subscriber pattern for decoupled communication
|
|
67
|
-
|
|
68
|
-
### ⚡ Middleware
|
|
69
|
-
Intercept and modify operations with middleware chains
|
|
70
|
-
|
|
71
|
-
### 🌐 DOM Manipulation
|
|
72
|
-
Efficient DOM operations with state preservation
|
|
73
|
-
|
|
74
|
-
### 🛠️ Utilities
|
|
75
|
-
Helper functions for common operations and data manipulation
|
|
76
|
-
|
|
77
|
-
## Documentation
|
|
78
|
-
|
|
79
|
-
- [Installation](./docs/installation.md)
|
|
80
|
-
- [Addons](./docs/addons.md)
|
|
81
|
-
- [Data Validation](./docs/data-validation.md)
|
|
82
|
-
- [Events & Middleware](./docs/events-middleware.md)
|
|
83
|
-
- [DOM Manipulation](./docs/dom.md)
|
|
84
|
-
- [Utilities](./docs/utilities.md)
|
|
85
|
-
- [API Reference](./docs/api-reference.md)
|
|
86
|
-
|
|
87
|
-
## Example Usage
|
|
88
|
-
|
|
89
|
-
```javascript
|
|
90
|
-
// Create a blog addon
|
|
91
|
-
const blog = divhunt.Addon('blog', (addon) => {
|
|
92
|
-
addon.Field('title', ['string', '', true]);
|
|
93
|
-
addon.Field('content', ['string', '', true]);
|
|
94
|
-
addon.Field('author', ['object', {}, true], null, null, false, {
|
|
95
|
-
name: ['string'],
|
|
96
|
-
email: ['string']
|
|
97
|
-
});
|
|
98
|
-
addon.Field('tags', ['array'], null, null, false, {
|
|
99
|
-
each: ['string']
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
// Add a post
|
|
104
|
-
const post = blog.Item({
|
|
105
|
-
title: 'Getting Started',
|
|
106
|
-
content: 'Welcome to our blog...',
|
|
107
|
-
author: {
|
|
108
|
-
name: 'Jane Smith',
|
|
109
|
-
email: 'jane@example.com'
|
|
110
|
-
},
|
|
111
|
-
tags: ['tutorial', 'getting-started']
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
// Listen for events
|
|
115
|
-
divhunt.EmitOn('addon.item.add', (addon, item) => {
|
|
116
|
-
console.log(`New item added to ${addon.GetName()}`);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
// Custom function
|
|
120
|
-
blog.Fn('getByTag', function(tag) {
|
|
121
|
-
return Object.values(this.Items()).filter(item =>
|
|
122
|
-
item.Get('tags').includes(tag)
|
|
123
|
-
);
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
// Use the function
|
|
127
|
-
const tutorials = blog.Fn('getByTag', 'tutorial');
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
## License
|
|
131
|
-
|
|
132
|
-
Licensed under the Divhunt Framework License. See LICENSE.txt for terms.
|
package/progress.md
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# PROGRESS — Divhunt Framework
|
|
2
|
-
|
|
3
|
-
*Milestones. What's done.*
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Phase 1: V2 Build
|
|
8
|
-
|
|
9
|
-
- [x] Core engine rebuilt (Divhunt class + 16 mixins)
|
|
10
|
-
- [x] Addon abstraction (DivhuntAddon + DivhuntAddonItem + DivhuntAddonRender)
|
|
11
|
-
- [x] PostgreSQL ORM via Knex (fluent query builder, 17+ operators, joins)
|
|
12
|
-
- [x] HTTP + gRPC servers and clients
|
|
13
|
-
- [x] Typed API command system
|
|
14
|
-
- [x] Proxy-based frontend reactivity (16ms debounced DOM diffing)
|
|
15
|
-
- [x] SPA page router with CSS Grid layouts
|
|
16
|
-
- [x] Directive system (dh-if, dh-for, dh-click, dh-fetch, dh-show, dh-html, dh-text)
|
|
17
|
-
- [x] 40+ pre-built UI components
|
|
18
|
-
- [x] Convention-based asset bundler (terser)
|
|
19
|
-
- [x] Float system (modals, toasts, tooltips, popups, overlays)
|
|
20
|
-
- [x] Module system (variables, actions, events, schedules, shortcuts, sources)
|
|
21
|
-
|
|
22
|
-
## Phase 2: Open Source Launch
|
|
23
|
-
|
|
24
|
-
- [x] **2026-02-19** — Published on npm as `divhunt@2.0.0`
|
|
25
|
-
- [x] **2026-02-19** — MIT license
|
|
26
|
-
- [x] **2026-02-19** — Full documentation (6 docs: addons, database, commands, servers, frontend, architecture)
|
|
27
|
-
- [x] **2026-02-19** — Working example (basic-api with 4 commands)
|
|
28
|
-
- [x] **2026-02-19** — Public GitHub repo (tomic-d/framework)
|
|
29
|
-
- [x] **2026-02-19** — Subpath exports and import aliases configured
|
|
30
|
-
|
|
31
|
-
## Phase 3: Maintenance
|
|
32
|
-
|
|
33
|
-
- [x] **2026-02-19** — Project management system set up (CLAUDE.md + brief, architecture, decisions, tasks, progress)
|
|
34
|
-
- [x] **2026-02-19** — Structured error handling: `divhunt.Error(code, message, context)` with emit, HTTP/command integration, LogError enhancement
|
|
35
|
-
- [x] **2026-02-19** — Copyright headers removed from all 92 source files
|
package/tasks.md
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# TASKS — Divhunt Framework
|
|
2
|
-
|
|
3
|
-
*Active tasks. Current phase only, not a wishlist.*
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Phase 3: Maintenance
|
|
8
|
-
|
|
9
|
-
- [x] Set up project management system (CLAUDE.md + files)
|
|
10
|
-
- [x] Add structured error handling (divhunt.Error)
|
|
11
|
-
- [x] Remove copyright headers
|
|
12
|
-
- [ ] Migrate existing throw new Error() to divhunt.Error() incrementally
|
|
13
|
-
- [ ] Audit all addons for edge cases and error handling
|
|
14
|
-
- [ ] Review and update documentation if code has diverged from docs
|
|
15
|
-
|
|
16
|
-
## Later (not now)
|
|
17
|
-
|
|
18
|
-
- Test suite
|
|
19
|
-
- TypeScript definitions
|
|
20
|
-
- CI/CD pipeline
|
|
21
|
-
- Plugin/extension API
|
|
22
|
-
- Community contribution guidelines
|
|
23
|
-
- Additional examples (database CRUD, gRPC, frontend SPA)
|
|
File without changes
|