diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8d1735f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,20 @@ +name: ci + +on: + push: + branches: [master, v8] + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + node: [24, 26] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + - run: npm install + - run: npm test diff --git a/docs/v8.md b/docs/v8.md new file mode 100644 index 0000000..7f4b272 --- /dev/null +++ b/docs/v8.md @@ -0,0 +1,50 @@ +# choo v8 — branch notes + +This branch is the working tree for the v8 modernization effort. The v7 code +at the repo root is untouched and stays authoritative until 8.0.0 ships; +everything new lives under `packages/`. + +## Layout + +- `packages/core` — `@choojs/core`: the Choo class, same API as choo v7 + (`use`/`route`/`start`/`mount`/`toString`/`emit`), ported to ESM. The + nano* internals are consolidated into `lib/` as attributed ports: + - `lib/bus.js` ← nanobus 4.5.0 + - `lib/router.js` ← nanorouter 4.0.0 + wayfarer 7.0.1 (+ trie) + - `lib/cache.js` ← choo component/cache.js + nanolru 1.0.0 + - `lib/raf.js` ← nanoraf 3.1.0, `lib/href.js` ← nanohref 3.1.0 + - `lib/timing.js` ← nanotiming 7.3.1 (unified on global `performance`) + - `lib/dom.js` ← document-ready 2.0.1 + scroll-to-anchor 1.0.0 + - `lib/query.js` — nanoquery replaced by `URLSearchParams` +- `packages/html` — `@choojs/html`: the rendering package. + - `server.js` — server-side tagged template (← nanohtml 1.10.0 server, + transform branches removed; pure runtime) + - `morph.js` — ← nanomorph 5.4.3, consolidated to one module + - `browser.js` — **Phase 2**: runtime-only cached template tag (WeakMap + keyed on the template strings array, clone-based instantiation, + hydration that adopts server DOM). Throws until implemented. + - `raw.js` — mark pre-encoded strings + +## Status vs the modernization plan + +- [x] Phase 1: monorepo scaffold, ESM ports, choo v7 node test suite green + on `node --test` (Node ≥ 24), CI on GitHub Actions +- [ ] Phase 2: browser renderer rewrite + hydration, `@choojs/component` +- [ ] Phase 3: v8 wiring (`toStream`, devtools, codemod) +- [ ] Phase 4: bankai v10 (Vite 8/Rolldown shell, SSR middleware, + 103 Early Hints, service worker, precompression) +- [ ] Phase 5: docs, examples, launch + +## Deliberate changes from v7 + +- `choo()` still works without `new`; `Choo` is also a named export. +- nanoquery → `URLSearchParams` (same output shape, repeated keys → arrays). +- Assertions live in `lib/assert.js` so production builds can strip them. +- Everything targets Node ≥ 24 and Baseline Widely Available browsers; there + is no compile step and no transpilation anywhere. + +## Attribution + +All ported modules are MIT-licensed work by the original choojs/nano* +authors and contributors; per-file headers note the source package and +version. This branch exists to carry that work forward, not to replace it. diff --git a/package.json b/package.json index f19669f..399dba4 100644 --- a/package.json +++ b/package.json @@ -1,78 +1,18 @@ { - "name": "choo", - "version": "7.1.0", - "description": "A 4kb framework for creating sturdy frontend applications", - "main": "index.js", - "files": [ - "index.js", - "index.d.ts", - "html/index.js", - "html/raw.js", - "html/index.d.ts", - "component/cache.js", - "component/index.js", - "dist", - "example" + "name": "@choojs/monorepo", + "private": true, + "version": "8.0.0-dev", + "description": "Monorepo for choo v8 — a 4kb framework for creating sturdy frontend applications", + "type": "module", + "workspaces": [ + "packages/*" ], - "browser": { - "assert": "nanoassert" + "engines": { + "node": ">=24" }, "scripts": { - "build": "mkdir -p dist/ && browserify index -s Choo -p bundle-collapser/plugin > dist/bundle.js && browserify index -s Choo -p tinyify > dist/bundle.min.js && cat dist/bundle.min.js | gzip --best --stdout | wc -c | pretty-bytes", - "deps": "dependency-check --entry ./html/index.js . && dependency-check . --extra --no-dev --entry ./html/index.js --entry ./component/index.js -i nanoassert", - "inspect": "browserify --full-paths index -p tinyify | discify --open", - "prepublishOnly": "npm run build", - "start": "bankai start example", - "test": "standard && npm run deps && npm run test:types && npm run test:node && npm run test:browser", - "test:types": "tsd", - "test:node": "node test/node.js | tap-format-spec", - "test:browser": "browserify test/browser.js | tape-run | tap-format-spec" + "test": "node --test packages/core/test/ packages/html/test/" }, "repository": "choojs/choo", - "keywords": [ - "client", - "frontend", - "framework", - "minimal", - "composable", - "tiny" - ], - "license": "MIT", - "dependencies": { - "document-ready": "^2.0.1", - "nanoassert": "^1.1.0", - "nanobus": "^4.4.0", - "nanocomponent": "^6.5.0", - "nanohref": "^3.0.0", - "nanohtml": "^1.1.0", - "nanolru": "^1.0.0", - "nanomorph": "^5.1.2", - "nanoquery": "^1.1.0", - "nanoraf": "^3.0.0", - "nanorouter": "^4.0.0", - "nanotiming": "^7.0.0", - "scroll-to-anchor": "^1.0.0" - }, - "devDependencies": { - "@tap-format/spec": "^0.2.0", - "browserify": "^16.2.2", - "bundle-collapser": "^1.2.1", - "dependency-check": "^3.1.0", - "disc": "^1.3.3", - "hyperscript": "^2.0.2", - "pretty-bytes-cli": "^2.0.0", - "spok": "^0.9.1", - "standard": "^11.0.1", - "tape": "^4.6.3", - "tape-run": "^6.0.0", - "tinyify": "^2.2.0", - "tsd": "^0.11.0" - }, - "tsd": { - "compilerOptions": { - "lib": [ - "DOM" - ] - } - } + "license": "MIT" }