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
@@ -0,0 +1,55 @@
|
||||
// Build the single-file CDN bundle: everything a browser needs as one
|
||||
// minified ES module, for import-map use against any static host that
|
||||
// serves JavaScript with the right MIME type.
|
||||
//
|
||||
// npm run bundle → dist-cdn/buuh.js (+ sourcemap)
|
||||
//
|
||||
// <script type="importmap">
|
||||
// { "imports": { "buuh": "https://cdn.uhhm.no/buuh@8.0.0.js" } }
|
||||
// </script>
|
||||
// <script type="module">
|
||||
// import { choo, html } from 'buuh'
|
||||
// </script>
|
||||
|
||||
import { build } from 'vite'
|
||||
import { readFile } from 'node:fs/promises'
|
||||
import { join, dirname, resolve } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..')
|
||||
const { version } = JSON.parse(await readFile(join(root, 'packages/core/package.json'), 'utf8'))
|
||||
|
||||
const VIRTUAL = '\0bundle:entry'
|
||||
|
||||
await build({
|
||||
appType: 'custom',
|
||||
logLevel: 'warn',
|
||||
plugins: [{
|
||||
name: 'bundle-entry',
|
||||
resolveId: (id) => id === 'bundle:entry' ? VIRTUAL : undefined,
|
||||
load: (id) => id === VIRTUAL
|
||||
? [
|
||||
"export { default as choo, Choo, lazy } from '@uhhm/buuh'",
|
||||
"export { default as html } from '@uhhm/buuh-html'",
|
||||
"export { default as raw } from '@uhhm/buuh-html/raw'",
|
||||
"export { default as morph } from '@uhhm/buuh-html/morph'",
|
||||
"export { default as hydrate } from '@uhhm/buuh-html/hydrate'",
|
||||
"export { default as Component } from '@uhhm/buuh-component'",
|
||||
"export { default as devtools } from '@uhhm/buuh-devtools'"
|
||||
].join('\n')
|
||||
: undefined
|
||||
}],
|
||||
build: {
|
||||
outDir: join(root, 'dist-cdn'),
|
||||
emptyOutDir: true,
|
||||
sourcemap: true,
|
||||
lib: false,
|
||||
rollupOptions: {
|
||||
input: { buuh: 'bundle:entry' },
|
||||
output: { entryFileNames: 'buuh.js' },
|
||||
preserveEntrySignatures: 'strict'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
console.log(`bundled buuh ${version} → dist-cdn/buuh.js`)
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
// The size budget: what does the framework itself cost on the wire?
|
||||
// Bundles @choojs/core + @choojs/html (browser condition) minified via
|
||||
// Bundles @uhhm/buuh + @uhhm/buuh-html (browser condition) minified via
|
||||
// the same Vite/Rolldown pipeline apps use, then reports min+gzip and
|
||||
// min+brotli. CI fails if min+gzip exceeds the budget.
|
||||
//
|
||||
@@ -28,9 +28,9 @@ await build({
|
||||
name: 'size-entry',
|
||||
resolveId: (id) => id === 'size:entry' ? VIRTUAL : undefined,
|
||||
load: (id) => id === VIRTUAL
|
||||
? "import choo, { Choo, lazy } from '@choojs/core'\n" +
|
||||
"import html from '@choojs/html'\n" +
|
||||
"import raw from '@choojs/html/raw'\n" +
|
||||
? "import choo, { Choo, lazy } from '@uhhm/buuh'\n" +
|
||||
"import html from '@uhhm/buuh-html'\n" +
|
||||
"import raw from '@uhhm/buuh-html/raw'\n" +
|
||||
'window.__keep = { choo, Choo, lazy, html, raw }\n'
|
||||
: undefined
|
||||
}],
|
||||
@@ -52,7 +52,7 @@ const br = brotliCompressSync(code, {
|
||||
}).length
|
||||
|
||||
const kb = (n) => (n / 1024).toFixed(2) + ' kB'
|
||||
console.log(`@choojs/core + @choojs/html (browser, minified)`)
|
||||
console.log(`@uhhm/buuh + @uhhm/buuh-html (browser, minified)`)
|
||||
console.log(` raw: ${kb(code.length)}`)
|
||||
console.log(` gzip: ${kb(gz)} (budget ${kb(BUDGET_GZIP)})`)
|
||||
console.log(` brotli: ${kb(br)}`)
|
||||
|
||||
Reference in New Issue
Block a user