rebrand: buuh — a friendly public fork under the uhhm org
Packages renamed to the @uhhm scope (@uhhm/buuh, @uhhm/buuh-html, @uhhm/buuh-component, @uhhm/buuh-devtools, @uhhm/buuh-migrate, @uhhm/bankai). Scoping is load-bearing twice over: npm routes registries per scope so @uhhm/* resolves against project.uhhm.no while everything else stays on npmjs, and it means this fork never squats upstream's names anywhere. The codemod now migrates choo v7 apps to the @uhhm names. README rewritten with the fork framing and full upstream credit; the choojs RFC moves to docs/upstream-rfc-draft.md, in the drawer for if this work ever goes home. API unchanged — choo() is still choo(). Also: Gitea Actions CI + release workflows (npm publish to the uhhm registry on tag push, CDN bundle uploaded as a generic package), npm run bundle producing dist-cdn/buuh.js (the whole framework as one minified ES module for import-map use), docs/publishing.md explaining what Gitea Packages is (a real npm registry) and is not (a CDN — serve the bundle from a static host with module-safe MIME instead), and onload.js constructing window.MutationObserver to match its own guard (surfaced by smoke-testing the bundle outside a full browser). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014NgfSjHE11oFpoSnLVKLXd
This commit is contained in:
co-authored by
Claude Fable 5
parent
b957b02410
commit
ce1ec9e4a9
Regular → Executable
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "bankai",
|
||||
"name": "@uhhm/bankai",
|
||||
"version": "10.0.0-dev",
|
||||
"description": "The isomorphic choo compiler & server: one command, streaming SSR, zero config",
|
||||
"type": "module",
|
||||
@@ -20,7 +20,7 @@
|
||||
"dependencies": {
|
||||
"vite": "^8.0.0"
|
||||
},
|
||||
"repository": "choojs/choo",
|
||||
"repository": "https://project.uhhm.no/uhhm/buuh",
|
||||
"keywords": [
|
||||
"choo",
|
||||
"bankai",
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// Native DOM components: render once, morph on update, lifecycle hooks via
|
||||
// onload. In v8 this class is also the intended island/hydration boundary.
|
||||
|
||||
import morph from '@choojs/html/morph'
|
||||
import nanotiming from '@choojs/core/timing'
|
||||
import morph from '@uhhm/buuh-html/morph'
|
||||
import nanotiming from '@uhhm/buuh/timing'
|
||||
import onload, { KEY_ATTR } from './onload.js'
|
||||
|
||||
function makeID () {
|
||||
|
||||
@@ -8,7 +8,7 @@ const KEY_ATTR = 'data-' + KEY_ID
|
||||
let INDEX = 0
|
||||
|
||||
if (typeof window !== 'undefined' && window.MutationObserver) {
|
||||
const observer = new MutationObserver(function (mutations) {
|
||||
const observer = new window.MutationObserver(function (mutations) {
|
||||
if (Object.keys(watch).length < 1) return
|
||||
for (let i = 0; i < mutations.length; i++) {
|
||||
if (mutations[i].attributeName === KEY_ATTR) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@choojs/component",
|
||||
"name": "@uhhm/buuh-component",
|
||||
"version": "8.0.0-dev",
|
||||
"description": "Native DOM components with lifecycle hooks — the choo island boundary",
|
||||
"type": "module",
|
||||
@@ -15,10 +15,10 @@
|
||||
"node": ">=24"
|
||||
},
|
||||
"dependencies": {
|
||||
"@choojs/core": "*",
|
||||
"@choojs/html": "*"
|
||||
"@uhhm/buuh": "*",
|
||||
"@uhhm/buuh-html": "*"
|
||||
},
|
||||
"repository": "choojs/choo",
|
||||
"repository": "https://project.uhhm.no/uhhm/buuh",
|
||||
"keywords": [
|
||||
"component",
|
||||
"dom",
|
||||
|
||||
@@ -5,7 +5,7 @@ import { test, before } from 'node:test'
|
||||
import assert from 'node:assert'
|
||||
import { Window } from 'happy-dom'
|
||||
|
||||
import serverHtml from '@choojs/html/server'
|
||||
import serverHtml from '@uhhm/buuh-html/server'
|
||||
|
||||
test('renders via createElement on the server (no window)', async () => {
|
||||
const { default: Component } = await import('../index.js')
|
||||
@@ -29,8 +29,8 @@ test('browser: render, mount, update morphs in place, proxy stands in', async ()
|
||||
// module registry caches per specifier; component/index.js re-evaluates
|
||||
// _hasWindow per instance, so importing after globals are set is enough
|
||||
const { default: Component } = await import('../index.js?browser')
|
||||
const { default: html } = await import('@choojs/html/browser')
|
||||
const { default: morph } = await import('@choojs/html/morph')
|
||||
const { default: html } = await import('@uhhm/buuh-html/browser')
|
||||
const { default: morph } = await import('@uhhm/buuh-html/morph')
|
||||
|
||||
class Counter extends Component {
|
||||
createElement (n) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Ported from choo 7.1.0 index.js (MIT) — https://github.com/choojs/choo
|
||||
// Same API, same event flow; ESM, consolidated nano* internals in ./lib.
|
||||
|
||||
import morph from '@choojs/html/morph'
|
||||
import hydrate from '@choojs/html/hydrate'
|
||||
import morph from '@uhhm/buuh-html/morph'
|
||||
import hydrate from '@uhhm/buuh-html/hydrate'
|
||||
import nanotiming from './lib/timing.js'
|
||||
import Nanorouter from './lib/router.js'
|
||||
import Nanobus from './lib/bus.js'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@choojs/core",
|
||||
"name": "@uhhm/buuh",
|
||||
"version": "8.0.0-dev",
|
||||
"description": "A 4kb framework for creating sturdy frontend applications",
|
||||
"type": "module",
|
||||
@@ -15,9 +15,9 @@
|
||||
"node": ">=24"
|
||||
},
|
||||
"dependencies": {
|
||||
"@choojs/html": "*"
|
||||
"@uhhm/buuh-html": "*"
|
||||
},
|
||||
"repository": "choojs/choo",
|
||||
"repository": "https://project.uhhm.no/uhhm/buuh",
|
||||
"keywords": [
|
||||
"client",
|
||||
"frontend",
|
||||
|
||||
@@ -12,8 +12,8 @@ before(async () => {
|
||||
globalThis.window = win
|
||||
globalThis.document = win.document
|
||||
globalThis.requestAnimationFrame = win.requestAnimationFrame.bind(win)
|
||||
;({ default: choo } = await import('@choojs/core'))
|
||||
;({ default: html } = await import('@choojs/html/browser'))
|
||||
;({ default: choo } = await import('@uhhm/buuh'))
|
||||
;({ default: html } = await import('@uhhm/buuh-html/browser'))
|
||||
})
|
||||
|
||||
const tick = (ms = 30) => new Promise((resolve) => setTimeout(resolve, ms))
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
import { test } from 'node:test'
|
||||
import assert from 'node:assert'
|
||||
|
||||
import html from '@choojs/html'
|
||||
import raw from '@choojs/html/raw'
|
||||
import choo, { Choo } from '@choojs/core'
|
||||
import html from '@uhhm/buuh-html'
|
||||
import raw from '@uhhm/buuh-html/raw'
|
||||
import choo, { Choo } from '@uhhm/buuh'
|
||||
|
||||
test('should render on the server with @choojs/html', () => {
|
||||
test('should render on the server with @uhhm/buuh-html', () => {
|
||||
const app = choo()
|
||||
app.route('/', function (state, emit) {
|
||||
const strong = '<strong>Hello filthy planet</strong>'
|
||||
|
||||
@@ -12,15 +12,15 @@ let choo, browserHtml, serverString
|
||||
before(async () => {
|
||||
// Server side first, before any window exists — exactly like production,
|
||||
// and toString() enforces it.
|
||||
;({ default: choo } = await import('@choojs/core'))
|
||||
const { default: serverHtml } = await import('@choojs/html/server')
|
||||
;({ default: choo } = await import('@uhhm/buuh'))
|
||||
const { default: serverHtml } = await import('@uhhm/buuh-html/server')
|
||||
serverString = makeApp(serverHtml).toString('/')
|
||||
|
||||
const win = new Window({ url: 'http://localhost/' })
|
||||
globalThis.window = win
|
||||
globalThis.document = win.document
|
||||
globalThis.requestAnimationFrame = win.requestAnimationFrame.bind(win)
|
||||
;({ default: browserHtml } = await import('@choojs/html/browser'))
|
||||
;({ default: browserHtml } = await import('@uhhm/buuh-html/browser'))
|
||||
})
|
||||
|
||||
const tick = (ms = 30) => new Promise((resolve) => setTimeout(resolve, ms))
|
||||
|
||||
@@ -13,8 +13,8 @@ before(async () => {
|
||||
globalThis.window = win
|
||||
globalThis.document = win.document
|
||||
globalThis.requestAnimationFrame = win.requestAnimationFrame.bind(win)
|
||||
;({ default: choo, lazy } = await import('@choojs/core'))
|
||||
;({ default: html } = await import('@choojs/html/browser'))
|
||||
;({ default: choo, lazy } = await import('@uhhm/buuh'))
|
||||
;({ default: html } = await import('@uhhm/buuh-html/browser'))
|
||||
})
|
||||
|
||||
const tick = (ms = 30) => new Promise((resolve) => setTimeout(resolve, ms))
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
import { test } from 'node:test'
|
||||
import assert from 'node:assert'
|
||||
|
||||
import html from '@choojs/html'
|
||||
import choo, { lazy } from '@choojs/core'
|
||||
import html from '@uhhm/buuh-html'
|
||||
import choo, { lazy } from '@uhhm/buuh'
|
||||
|
||||
const wait = (ms, value) => new Promise((resolve) => setTimeout(() => resolve(value), ms))
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
import { test } from 'node:test'
|
||||
import assert from 'node:assert'
|
||||
|
||||
import html from '@choojs/html'
|
||||
import choo from '@choojs/core'
|
||||
import html from '@uhhm/buuh-html'
|
||||
import choo from '@uhhm/buuh'
|
||||
|
||||
function view (state) {
|
||||
return html`<div></div>`
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// event log, emit-from-the-console, and render timings via the
|
||||
// PerformanceObserver watching nanotiming's measures. Usage:
|
||||
//
|
||||
// import devtools from '@choojs/devtools'
|
||||
// import devtools from '@uhhm/buuh-devtools'
|
||||
// app.use(devtools())
|
||||
//
|
||||
// The store is a no-op on the server and (by default) stays quiet in the
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@choojs/devtools",
|
||||
"name": "@uhhm/buuh-devtools",
|
||||
"version": "8.0.0-dev",
|
||||
"description": "Console devtools for choo: window.choo, event log, perf timings",
|
||||
"type": "module",
|
||||
@@ -12,7 +12,7 @@
|
||||
"engines": {
|
||||
"node": ">=24"
|
||||
},
|
||||
"repository": "choojs/choo",
|
||||
"repository": "https://project.uhhm.no/uhhm/buuh",
|
||||
"keywords": [
|
||||
"choo",
|
||||
"devtools",
|
||||
|
||||
@@ -9,8 +9,8 @@ before(async () => {
|
||||
globalThis.window = win
|
||||
globalThis.document = win.document
|
||||
globalThis.requestAnimationFrame = win.requestAnimationFrame.bind(win)
|
||||
;({ default: choo } = await import('@choojs/core'))
|
||||
;({ default: html } = await import('@choojs/html/browser'))
|
||||
;({ default: choo } = await import('@uhhm/buuh'))
|
||||
;({ default: html } = await import('@uhhm/buuh-html/browser'))
|
||||
;({ default: devtools } = await import('../index.js'))
|
||||
})
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@choojs/html",
|
||||
"name": "@uhhm/buuh-html",
|
||||
"version": "8.0.0-dev",
|
||||
"description": "HTML template literals that render to DOM in the browser and strings on the server",
|
||||
"type": "module",
|
||||
@@ -24,7 +24,7 @@
|
||||
"engines": {
|
||||
"node": ">=24"
|
||||
},
|
||||
"repository": "choojs/choo",
|
||||
"repository": "https://project.uhhm.no/uhhm/buuh",
|
||||
"keywords": [
|
||||
"html",
|
||||
"template",
|
||||
|
||||
@@ -80,7 +80,7 @@ export class HtmlChunks {
|
||||
for (const part of this.parts) {
|
||||
if (typeof part !== 'string') {
|
||||
throw new Error(
|
||||
'@choojs/html: this template has async content and cannot render synchronously — stream it (choo: use toStream() instead of toString())'
|
||||
'@uhhm/buuh-html: this template has async content and cannot render synchronously — stream it (choo: use toStream() instead of toString())'
|
||||
)
|
||||
}
|
||||
out += part
|
||||
@@ -168,7 +168,7 @@ export default function html (pieces, ...values) {
|
||||
|
||||
// tag position: attributes are synchronous, always
|
||||
if (isThenable(value) || isAsyncIterable(value)) {
|
||||
throw new Error('@choojs/html: async values are only allowed in child position, not in attributes')
|
||||
throw new Error('@uhhm/buuh-html: async values are only allowed in child position, not in attributes')
|
||||
}
|
||||
|
||||
// Event handlers are behavior, not markup: `onclick=${fn}` renders
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
import { test } from 'node:test'
|
||||
import assert from 'node:assert'
|
||||
|
||||
import html from '@choojs/html'
|
||||
import raw from '@choojs/html/raw'
|
||||
import html from '@uhhm/buuh-html'
|
||||
import raw from '@uhhm/buuh-html/raw'
|
||||
|
||||
test('renders a template to a string', () => {
|
||||
const res = html`<p>hello</p>`
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
import { test } from 'node:test'
|
||||
import assert from 'node:assert'
|
||||
|
||||
import html from '@choojs/html'
|
||||
import raw from '@choojs/html/raw'
|
||||
import html from '@uhhm/buuh-html'
|
||||
import raw from '@uhhm/buuh-html/raw'
|
||||
|
||||
async function collect (chunks) {
|
||||
const out = []
|
||||
|
||||
@@ -49,4 +49,4 @@ for (const target of targets) {
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`\n${dry ? 'dry run — no files written' : changedCount + ' file(s) rewritten'}. Remember: package.json needs "type": "module" and deps on @choojs/*.`)
|
||||
console.log(`\n${dry ? 'dry run — no files written' : changedCount + ' file(s) rewritten'}. Remember: package.json needs "type": "module" and deps on @uhhm/*.`)
|
||||
|
||||
@@ -5,28 +5,28 @@
|
||||
|
||||
// old specifier → new specifier
|
||||
export const SPECIFIERS = {
|
||||
choo: '@choojs/core',
|
||||
'choo/html': '@choojs/html',
|
||||
'choo/html/raw': '@choojs/html/raw',
|
||||
'choo/component': '@choojs/component',
|
||||
nanohtml: '@choojs/html',
|
||||
'nanohtml/raw': '@choojs/html/raw',
|
||||
nanomorph: '@choojs/html/morph',
|
||||
nanocomponent: '@choojs/component',
|
||||
'choo-devtools': '@choojs/devtools'
|
||||
choo: '@uhhm/buuh',
|
||||
'choo/html': '@uhhm/buuh-html',
|
||||
'choo/html/raw': '@uhhm/buuh-html/raw',
|
||||
'choo/component': '@uhhm/buuh-component',
|
||||
nanohtml: '@uhhm/buuh-html',
|
||||
'nanohtml/raw': '@uhhm/buuh-html/raw',
|
||||
nanomorph: '@uhhm/buuh-html/morph',
|
||||
nanocomponent: '@uhhm/buuh-component',
|
||||
'choo-devtools': '@uhhm/buuh-devtools'
|
||||
}
|
||||
|
||||
// old specifier → guidance (no direct replacement package)
|
||||
export const RETIRED = {
|
||||
nanobus: "built into @choojs/core — use app.emitter, or import Nanobus from '@choojs/core' internals is no longer needed",
|
||||
nanorouter: 'built into @choojs/core — app.route covers it',
|
||||
nanohref: 'built into @choojs/core — link handling is automatic',
|
||||
nanotiming: "built into @choojs/core — import from '@choojs/core/timing' if you need it directly",
|
||||
nanobus: "built into @uhhm/buuh — use app.emitter, or import Nanobus from '@uhhm/buuh' internals is no longer needed",
|
||||
nanorouter: 'built into @uhhm/buuh — app.route covers it',
|
||||
nanohref: 'built into @uhhm/buuh — link handling is automatic',
|
||||
nanotiming: "built into @uhhm/buuh — import from '@uhhm/buuh/timing' if you need it directly",
|
||||
nanoraf: 'retired — use requestAnimationFrame, or rely on choo render batching',
|
||||
nanoquery: 'retired — state.query is built in; use URLSearchParams directly elsewhere',
|
||||
nanoassert: 'retired — use plain checks or node:assert',
|
||||
nanolru: 'retired — the component cache is built into @choojs/core',
|
||||
'choo-lazy-route': "replaced by lazy() from '@choojs/core': app.route('/x', lazy(() => import('./x.js')))",
|
||||
nanolru: 'retired — the component cache is built into @uhhm/buuh',
|
||||
'choo-lazy-route': "replaced by lazy() from '@uhhm/buuh': app.route('/x', lazy(() => import('./x.js')))",
|
||||
'choo-service-worker': 'kept as a concept; bankai v10 will inject the asset manifest — check docs before migrating this one'
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "@choojs/migrate",
|
||||
"name": "@uhhm/buuh-migrate",
|
||||
"version": "8.0.0-dev",
|
||||
"description": "Codemod: migrate choo v7 apps to @choojs v8 (ESM, new package names)",
|
||||
"description": "Codemod: migrate choo v7 apps to buuh (choo v8) (ESM, new package names)",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
"choo-migrate": "./cli.js"
|
||||
"buuh-migrate": "./cli.js"
|
||||
},
|
||||
"exports": {
|
||||
".": "./lib/transform.js"
|
||||
@@ -16,7 +16,7 @@
|
||||
"engines": {
|
||||
"node": ">=24"
|
||||
},
|
||||
"repository": "choojs/choo",
|
||||
"repository": "https://project.uhhm.no/uhhm/buuh",
|
||||
"keywords": [
|
||||
"choo",
|
||||
"codemod",
|
||||
|
||||
@@ -16,9 +16,9 @@ test('converts a classic choo v7 header to v8 ESM', () => {
|
||||
|
||||
const { code, changed, notes } = transform(src)
|
||||
assert.ok(changed)
|
||||
assert.match(code, /import choo from '@choojs\/core'/)
|
||||
assert.match(code, /import html from '@choojs\/html'/)
|
||||
assert.match(code, /import devtools from '@choojs\/devtools'/)
|
||||
assert.match(code, /import choo from '@uhhm\/buuh'/)
|
||||
assert.match(code, /import html from '@uhhm\/buuh-html'/)
|
||||
assert.match(code, /import devtools from '@uhhm\/buuh-devtools'/)
|
||||
assert.match(code, /export default app/)
|
||||
assert.deepStrictEqual(notes, [])
|
||||
})
|
||||
@@ -48,11 +48,11 @@ test('already-ESM sources get specifiers remapped', () => {
|
||||
].join('\n')
|
||||
|
||||
const { code } = transform(src)
|
||||
assert.match(code, /from '@choojs\/core'/)
|
||||
assert.match(code, /from '@choojs\/html'\n/)
|
||||
assert.match(code, /from '@choojs\/html\/raw'/)
|
||||
assert.match(code, /from '@choojs\/html\/morph'/)
|
||||
assert.match(code, /from '@choojs\/component'/)
|
||||
assert.match(code, /from '@uhhm\/buuh'/)
|
||||
assert.match(code, /from '@uhhm\/buuh-html'\n/)
|
||||
assert.match(code, /from '@uhhm\/buuh-html\/raw'/)
|
||||
assert.match(code, /from '@uhhm\/buuh-html\/morph'/)
|
||||
assert.match(code, /from '@uhhm\/buuh-component'/)
|
||||
})
|
||||
|
||||
test('retired packages produce notes, not rewrites', () => {
|
||||
@@ -69,7 +69,7 @@ test('retired packages produce notes, not rewrites', () => {
|
||||
|
||||
test('dynamic import() specifiers are remapped too', () => {
|
||||
const { code } = transform("const mod = await import('choo/html')")
|
||||
assert.match(code, /import\('@choojs\/html'\)/)
|
||||
assert.match(code, /import\('@uhhm\/buuh-html'\)/)
|
||||
})
|
||||
|
||||
test('unconvertible CJS is reported honestly', () => {
|
||||
@@ -79,7 +79,7 @@ test('unconvertible CJS is reported honestly', () => {
|
||||
].join('\n')
|
||||
|
||||
const { code, notes } = transform(src)
|
||||
assert.match(code, /require\('@choojs\/core'\)/, 'specifier remapped even inside functions')
|
||||
assert.match(code, /require\('@uhhm\/buuh'\)/, 'specifier remapped even inside functions')
|
||||
assert.ok(notes.some((n) => n.includes('module.exports')))
|
||||
assert.ok(notes.some((n) => n.includes('require() calls remain')))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user