feat: use fastify as server

- [x] implement server framework plugin config
- [x] new @mcflyjs/fastify package
- [x] update readme re: pivot & target state
- [x] new basic template

Reviewed-on: https://git.ayo.run/ayo/mcfly/pulls/2
Co-authored-by: Ayo <ayo@ayco.io>
Co-committed-by: Ayo <ayo@ayco.io>
This commit is contained in:
ayo 2026-06-04 11:03:45 +00:00 committed by ayo
parent 43ba8bc81b
commit 970970fd32
43 changed files with 312 additions and 1022 deletions

View file

@ -8,7 +8,6 @@
"hookable",
"mcfly",
"mcflyjs",
"nitropack",
"ultrahtml",
"unstorage"
],

View file

@ -27,9 +27,13 @@ I thought:
## Project Status
We are currently in a Proof of Concept phase. All parts are subject to breaking changes in minor releases.
We are currently in a focused rewrite. All parts are subject to breaking changes in minor releases.
👉 [Road to v1.0.0 todo items](https://github.com/ayoayco/McFly/issues?q=is%3Aissue%20state%3Aopen%20milestone%3Av1.0.0)
- [x] file-based API routing via fastify as server framework
- [ ] file-based HTML pages routing & templating via Eta
- [ ] auto-registry of custom elements
- [ ] SSR custom elements
- [ ] SSG
## Try it today
@ -39,15 +43,7 @@ Run the following to generate a McFly starter project.
npm create mcfly@latest
```
## How it works (for the nerds)
It is primarily a runtime middleware for [Nitro](https://nitro.build). Every time a page is requested, the McFly middleware intercepts and assembles the view for the requestor. McFly does this with the assets it knows about which are mostly: pages, components, public assets. Additionally, Nitro is also capable of generating static assets on build time.
These patterns are commonly referred to as Server-Side Rendering and Static Site Generation (SSR & SSG).
The idea is to have a plugin system which allows for the core functionality to only "lean" on web platform features. Anything not yet a standard is implemented as a plugin which will be easily "swapped" away when the platform catches up.
## Features
## Target Features
✅ Use vanilla custom elements (or sugar-coated web components)<br>
✅ Write server-powered .html pages<br>
@ -57,19 +53,7 @@ The idea is to have a plugin system which allows for the core functionality to o
## Special directories
**1. `./src/pages/`**
- file-based routing for `.html` files
- directly use custom elements & static fragments (no imports or registry maintenance needed)
- use `<script server:setup>` to define logic that runs on the server, which then gets stripped away
**2. `./src/components/`**
- custom element constructor files (only `.js` files for now)
- all components are automatically registered using their file names; a `hello-world.js` component can be used as `<hello-world>`
- static `.html` fragments; a `my-header.html` fragment can be directly used as `<my-header>`
**3. `./src/api/`**
**1. `./src/api/`**
- file-based routing for REST API endpoints
- e.g., `./src/api/users.js` can be accessed via `http://<domain>/api/users`
@ -79,9 +63,10 @@ The idea is to have a plugin system which allows for the core functionality to o
The following are the project packages published on the NPM registry:
| Package | Description | Version |
| :----------------------------------------------------- | -------------------------------------------- | ---------------------------------------------------------------- |
| [`@mcflyjs/config`](https://ayco.io/n/@mcflyjs/config) | Nitro server config for McFly projects | ![npm version](https://img.shields.io/npm/v/%40mcflyjs%2Fconfig) |
| [`@mcflyjs/core`](https://ayco.io/n/@mcflyjs/core) | Route event and config handlers | ![npm version](https://img.shields.io/npm/v/%40mcflyjs%2Fcore) |
| :----------------------------------------------------- | --------------------------------------------- | ---------------------------------------------------------------- |
| [`@mcflyjs/config`](https://ayco.io/n/@mcflyjs/config) | Configuration handling for McFly projects | ![npm version](https://img.shields.io/npm/v/%40mcflyjs%2Fconfig) |
| [`@mcflyjs/core`](https://ayco.io/n/@mcflyjs/core) | Commands & runtime handling | ![npm version](https://img.shields.io/npm/v/%40mcflyjs%2Fcore) |
| [`@mcflyjs/fastify`](https://ayco.io/n/@mcflyjs/core) | Adapter for using fastify as server framework | ![npm version](https://img.shields.io/npm/v/%40mcflyjs%2Fcore) |
| [`create-mcfly`](https://ayco.io/n/create-mcfly) | Script for scaffolding a new McFly workspace | ![npm version](https://img.shields.io/npm/v/create-mcfly) |
## Project setup
@ -104,9 +89,9 @@ The following commands are available to you on this project. Add more, or modify
## More info
This framework is a result of [an exploration](https://social.ayco.io/@ayo/111195315785886977) for using [Nitro](https://nitro.build) and custom elements using a minimal [Web Component Base](https://WebComponent.io) class.
This framework was initially a result of [an exploration](https://social.ayco.io/@ayo/111195315785886977) for using [Nitro](https://nitro.build) and custom elements using a minimal [Web Component Base](https://WebComponent.io) class.
**Nitro** is the same production-grade web server powering [Nuxt](https://nuxt.com/)
In 2026, we pivoted to a new target architecture to become more like a "glue" that allows putting together existing options that achieve our goals. We avoid building custom mechanisms when we can. The resulting architecture theoretically allows using different server frameworks, templating libraries, custom element libraries, etc.
---

6
demo/mcfly.config.mjs Normal file
View file

@ -0,0 +1,6 @@
import { defineConfig } from '@mcflyjs/config'
import fastify from '@mcflyjs/fastify'
export default defineConfig({
server: fastify(),
})

17
demo/package.json Normal file
View file

@ -0,0 +1,17 @@
{
"name": "demo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "mcfly serve"
},
"author": "",
"license": "ISC",
"dependencies": {
"@mcflyjs/core": "workspace:*",
"@mcflyjs/config": "workspace:*",
"@mcflyjs/fastify": "workspace:*"
}
}

29
demo/src/api/README.md Normal file
View file

@ -0,0 +1,29 @@
# Routes Folder
Routes define the pathways within your application.
Fastify's structure supports the modular monolith approach, where your
application is organized into distinct, self-contained modules.
This facilitates easier scaling and future transition to a microservice architecture.
In the future you might want to independently deploy some of those.
In this folder you should define all the routes that define the endpoints
of your web application.
Each service is a [Fastify
plugin](https://fastify.dev/docs/latest/Reference/Plugins/), it is
encapsulated (it can have its own independent plugins) and it is
typically stored in a file; be careful to group your routes logically,
e.g. all `/users` routes in a `users.js` file. We have added
a `root.js` file for you with a '/' root added.
If a single file becomes too large, create a folder and add a `index.js` file there:
this file must be a Fastify plugin, and it will be loaded automatically
by the application. You can now add as many files as you want inside that folder.
In this way you can create complex routes within a single monolith,
and eventually extract them.
If you need to share functionality between routes, place that
functionality into the `plugins` folder, and share it via
[decorators](https://fastify.dev/docs/latest/Reference/Decorators/).
If you're a bit confused about using `async/await` to write routes, you would
better take a look at [Promise resolution](https://fastify.dev/docs/latest/Reference/Routes/#promise-resolution) for more details.

View file

@ -0,0 +1,6 @@
export default async (fastify) => {
fastify.get('/', async function (request, reply) {
console.log({ request, reply })
return 'This is an example'
})
}

5
demo/src/api/index.js Normal file
View file

@ -0,0 +1,5 @@
export default async (fastify) => {
fastify.get('/', async function (request, reply) {
return 'This is the API Index'
})
}

6
demo/src/api/root.js Normal file
View file

@ -0,0 +1,6 @@
export default async function (fastify, opts) {
fastify.get('/', async function (request, reply) {
console.log({ opts, request, reply })
return { root: true }
})
}

View file

View file

@ -16,7 +16,7 @@ export default [
eslintPluginPrettierRecommended,
includeIgnoreFile(gitignorePath),
{
ignores: ['site/*', 'templates/*', '**/public/*'],
ignores: ['site/*', 'templates/*', '**/public/*', 'demo/*'],
},
{
rules: {

3
mcfly.config.mjs Normal file
View file

@ -0,0 +1,3 @@
export default {
from: 'root',
}

View file

@ -5,8 +5,10 @@
"postinstall": "pnpm -F @mcflyjs/core build && pnpm -F @mcflyjs/config build",
"start": "pnpm run site",
"dev": "pnpm run site",
"site": "pnpm -F @mcflyjs/core run build && pnpm -F @mcflyjs/config run build && pnpm --filter site start",
"demo": "pnpm run build:deps && pnpm -F demo start",
"site": "pnpm run build:deps && pnpm -F site start",
"build": "pnpm -F './packages/**' build",
"build:deps": "pnpm -F @mcflyjs/core build && pnpm -F @mcflyjs/config build",
"build:site": "pnpm -F site build",
"build:site:preview": "pnpm -F site build:preview",
"template:basic": "pnpm run build && pnpm -F basic-template start",

View file

@ -9,8 +9,7 @@
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./define-mcfly-config": "./dist/define-mcfly-config.js",
"./nitro-config": "./dist/nitro-config.js"
"./define-config": "./dist/define-config.js"
},
"scripts": {
"build": "tsc --erasableSyntaxOnly",
@ -32,8 +31,5 @@
"dependencies": {
"h3": "^1.15.1",
"web-component-base": "^4.0.0"
},
"devDependencies": {
"nitropack": "~2.11.7"
}
}

View file

@ -1,8 +1,6 @@
import type { NitroConfig } from 'nitropack'
export type McFlyConfig = {
components: 'js' | 'lit'
nitro?: NitroConfig
server: McFlyServer
components?: 'js' | 'lit'
plugins?: McFlyPlugin[]
}
@ -11,7 +9,7 @@ export type McFlyConfig = {
* @param {McFlyConfig} config
* @returns {function(): McFlyConfig}e
*/
export function defineMcFlyConfig(config: McFlyConfig) {
export function defineConfig(config: McFlyConfig) {
return () => config
}
@ -19,3 +17,5 @@ export function defineMcFlyConfig(config: McFlyConfig) {
* TODO: finalize Plugin type
*/
export type McFlyPlugin = {}
export type McFlyServer = any

View file

@ -1 +1 @@
export { type McFlyConfig, defineMcFlyConfig } from './define-mcfly-config.js'
export { type McFlyConfig, defineConfig } from './define-config.js'

View file

@ -5,6 +5,7 @@
"allowJs": true,
"emitDeclarationOnly": false,
"declarationDir": "./dist",
"outDir": "./dist"
"outDir": "./dist",
"rootDir": "./src"
}
}

View file

@ -3,17 +3,16 @@
"version": "0.8.8",
"description": "McFly core package",
"type": "module",
"main": "./dist/cli/index.js",
"main": "./dist/index.js",
"bin": {
"mcfly": "./dist/cli/index.js"
"mcfly": "./dist/index.js"
},
"exports": {
".": {
"types": "./dist/cli/index.d.ts",
"default": "./dist/cli/index.js"
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./runtime": "./dist/runtime/index.js",
"./cli": "./dist/cli/index.js",
"./package.json": "./package.json"
},
"files": [
@ -43,7 +42,6 @@
"devalue": "^5.1.1",
"esprima": "^4.0.1",
"h3": "^1.15.1",
"nitropack": "^2.11.7",
"pathe": "^2.0.3",
"ultrahtml": "^1.5.3"
},

View file

@ -1,129 +0,0 @@
#!/usr/bin/env node
import { consola } from 'consola'
import { colorize } from 'consola/utils'
import { defineCommand, type ParsedArgs } from 'citty'
import { createRequire } from 'node:module'
import {
type Nitro,
build,
createDevServer,
createNitro,
prepare,
prerender,
} from 'nitropack'
import { resolve } from 'pathe'
import { fileURLToPath } from 'node:url'
import { dirname } from 'pathe'
import { getMcFlyConfig, getNitroConfig } from '../../get-config.js'
const hmrKeyRe = /^runtimeConfig\.|routeRules\./
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
async function printInfo() {
try {
const _require = createRequire(import.meta.url)
const mcflyPkg = await _require('@mcflyjs/core/package.json')
const mcflyPkgVersion = `McFly ${colorize('bold', mcflyPkg.version)}`
const nitroPkg = await _require('nitropack/package.json')
const nitroPkgVersion = `Nitro ${nitroPkg.version}`
consola.log(
`${colorize('blue', mcflyPkgVersion)} ${colorize('dim', nitroPkgVersion)}`
)
} catch (e) {
consola.error(e)
}
}
async function serve(args: ParsedArgs) {
try {
// TODO: check for dir type (should be string)
const dir = args.dir?.toString() || args._dir?.toString()
const rootDir: string = resolve(dir || '.')
let nitro: Nitro
const reload = async () => {
// close existing nitro
if (nitro) {
consola.info('Restarting dev server...')
if ('unwatch' in nitro.options._c12) {
await nitro.options._c12.unwatch()
}
await nitro.close()
}
const { mcflyConfig, configFile } = await getMcFlyConfig()
const nitroConfig = await getNitroConfig(mcflyConfig)
// create new nitro
nitro = await createNitro(
{
rootDir,
dev: true,
preset: 'nitro-dev',
_cli: { command: 'dev' },
...nitroConfig,
},
{
watch: true,
c12: {
async onUpdate({ getDiff, newConfig }: any) {
const diff = getDiff()
if (diff.length === 0) {
return // No changes
}
consola.info(
'Nitro config updated:\n' +
diff
.map((entry: unknown) => ` ${entry?.toString()}`)
.join('\n')
)
// TODO: get types for c12 config & remove unknown
// @ts-ignore
await (diff.every((e: unknown) => hmrKeyRe.test(e.key))
? nitro.updateConfig(newConfig.config || {}) // Hot reload
: reload()) // Full reload
},
},
}
)
nitro.hooks.hookOnce('restart', reload)
nitro.options.runtimeConfig.appConfigFile = configFile
nitro.options.handlers.push({
middleware: true,
handler: resolve(__dirname, '../../route-middleware.js'),
})
const server = createDevServer(nitro)
// const listenOptions = parseArgs(args)
await server.listen(1234)
await prepare(nitro)
await prerender(nitro)
await build(nitro)
}
await reload()
} catch (e) {
consola.error(e)
}
}
export default defineCommand({
meta: {
name: 'serve',
description: 'Runs the dev server.',
},
async run({ args }) {
await printInfo()
await serve(args)
},
})
export const exportedForTest = {
serve,
printInfo,
}

View file

@ -3,15 +3,8 @@
import { consola } from 'consola'
import { defineCommand, type ParsedArgs } from 'citty'
import { dirname, resolve } from 'pathe'
import {
build,
copyPublicAssets,
createNitro,
prepare,
prerender,
} from 'nitropack'
import { fileURLToPath } from 'node:url'
import { getMcFlyConfig, getNitroConfig } from '../../get-config.js'
import { getMcFlyConfig } from '../get-config.js'
async function _build(args: ParsedArgs) {
consola.start('Building project...')
@ -21,33 +14,11 @@ async function _build(args: ParsedArgs) {
const rootDir = resolve(dir)
const { mcflyConfig, configFile } = await getMcFlyConfig()
const nitroConfig = await getNitroConfig(mcflyConfig)
const nitro = await createNitro({
rootDir,
dev: false,
...nitroConfig,
minify: args.minify ?? nitroConfig.minify,
preset: args.preset ?? nitroConfig.preset,
})
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
nitro.options.handlers.push({
middleware: true,
handler: resolve(__dirname, '../../route-middleware.js'),
})
nitro.options.runtimeConfig.appConfigFile = configFile
await prepare(nitro)
await copyPublicAssets(nitro)
await prerender(nitro)
await build(nitro)
await nitro.close()
consola.info('dir', __dirname)
} catch (err) {
consola.error(err)
}

View file

@ -3,8 +3,7 @@
import { consola } from 'consola'
import { defineCommand, type ParsedArgs } from 'citty'
import { resolve } from 'pathe'
import { createNitro, writeTypes } from 'nitropack'
import { getMcFlyConfig, getNitroConfig } from '../../get-config.js'
import { getMcFlyConfig } from '../get-config.js'
async function prepare(args: ParsedArgs) {
consola.start('Preparing McFly workspace...')
@ -16,10 +15,8 @@ async function prepare(args: ParsedArgs) {
const dir: string = args.dir?.toString() || args._dir?.toString() || '.'
const rootDir = resolve(dir)
const { mcflyConfig } = await getMcFlyConfig()
const nitroConfig = await getNitroConfig(mcflyConfig)
const nitro = await createNitro({ rootDir, ...nitroConfig })
await writeTypes(nitro)
consola.info({ mcflyConfig, rootDir })
} catch (e) {
consola.error(e)
err = e

View file

@ -0,0 +1,67 @@
#!/usr/bin/env node
import { consola } from 'consola'
import { colorize } from 'consola/utils'
import { defineCommand, type ParsedArgs } from 'citty'
import { createRequire } from 'node:module'
import { resolve } from 'pathe'
// import { fileURLToPath } from 'node:url'
// import { dirname } from 'pathe'
import { getMcFlyConfig } from '../get-config.js'
// const __filename = fileURLToPath(import.meta.url)
// const __dirname = dirname(__filename)
async function printInfo() {
try {
const _require = createRequire(import.meta.url)
const mcflyPkg = await _require('@mcflyjs/core/package.json')
const mcflyPkgVersion = `McFly ${colorize('bold', mcflyPkg.version)}`
consola.log(`${colorize('blue', mcflyPkgVersion)}`)
} catch (e) {
consola.error(e)
}
}
async function serve(args: ParsedArgs) {
try {
// TODO: check for dir type (should be string)
const dir = args.dir?.toString() || args._dir?.toString()
const rootDir: string = resolve(dir || '.')
const { mcflyConfig } = await getMcFlyConfig()
/**
* TODO: config
* - separate `start` & `dev` commands
* - srcDir, apiDir ?
* - autoLoad config
* - fastify config
*/
if (mcflyConfig.server)
mcflyConfig.server.serve({
rootDir: rootDir + '/src',
apiDir: '/api',
logger: consola,
})
else consola.error('[McFly]: `server` configuration required')
} catch (e) {
consola.error(e)
}
}
export default defineCommand({
meta: {
name: 'serve',
description: 'Runs the dev server.',
},
async run({ args }) {
await printInfo()
await serve(args)
},
})
export const exportedForTest = {
serve,
printInfo,
}

View file

@ -1,27 +1,4 @@
import { loadConfig } from 'c12'
import { mcflyNitroConfig } from './mcfly-nitro-config.js'
/**
* @typedef {import('nitropack').NitroConfig} NitroConfig
*/
/**
* Create a valid Nitro configuration given a McFly config object
* @returns {Promise<NitroConfig>}
*/
export async function getNitroConfig(mcflyConfig = {}) {
const { config: nitroConfig } = await loadConfig({ name: 'nitro' })
return {
// nitro config in mcfly config
...mcflyConfig.nitro,
// nitro config from nitro config
...(nitroConfig ?? {}),
// McFly standard nitro config
...mcflyNitroConfig,
}
}
export async function getMcFlyConfig() {
const { config: mcflyConfig, configFile } = await loadConfig({

View file

@ -1,35 +0,0 @@
import { type NitroConfig } from 'nitropack'
/**
* @typedef {import('nitropack').NitroConfig} NitroConfig
* @type {NitroConfig}
*/
export const mcflyNitroConfig: NitroConfig = {
framework: {
name: 'McFly',
},
compatibilityDate: '2024-12-08',
srcDir: 'src',
apiDir: 'api',
devServer: {
watch: ['./pages', './components', './api'],
},
serverAssets: [
{
baseName: 'pages',
dir: './pages',
},
{
baseName: 'components',
dir: './components',
},
],
imports: {
presets: [
{
from: 'web-component-base',
imports: ['WebComponent', 'html', 'attachEffect'],
},
],
},
}

View file

@ -1,161 +0,0 @@
import { eventHandler } from 'h3'
import { useStorage } from 'nitropack/runtime'
import { createHooks } from 'hookable'
import { consola } from 'consola'
import { colorize } from 'consola/utils'
import { useRuntimeConfig } from 'nitropack/runtime'
import { dirname, relative } from 'pathe'
import { fileURLToPath } from 'node:url'
import {
hooks as mcflyHooks,
defaultMcflyConfig,
evaluateServerScripts,
injectHtmlFragments,
injectCustomElements,
} from '@mcflyjs/core/runtime' // important to import from installed node_module because this script is passed to another context
/**
* @typedef {import('../config').McFlyConfig} Config
* @typedef {import('unstorage').Storage} Storage
* @typedef {import('unstorage').StorageValue} StorageValue
* @typedef {import('h3').EventHandler} EventHandler
*/
/**
* McFly middleware event handler
*/
export default eventHandler(async (event) => {
const timeStart = performance.now()
const hooks = createHooks()
Object.keys(mcflyHooks).forEach((hookName) => hooks.addHooks(hookName))
const { path } = event
const storage = useStorage()
const { appConfigFile } = useRuntimeConfig()
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
let relativePath = relative(__dirname, appConfigFile)
let config
// TODO: this still doesn't work on Netlify
try {
const { default: configFn } = await import(relativePath)
config = configFn()
} catch (err) {
consola.error(err)
}
// if not page, don't render
if (event.path.startsWith('/api')) {
return
}
if (!config || Object.keys(config).length === 0) {
config = defaultMcflyConfig
consola.warn(
`[WARN]: McFly configuration not found, using defaults...`,
defaultMcflyConfig
)
}
const plugins = config.plugins ?? []
plugins.forEach((plugin) => {
const pluginHooks = Object.keys(plugin)
pluginHooks.forEach((pluginHook) => {
hooks.hook(pluginHook, plugin[pluginHook])
})
})
const { components: componentType } = config
let html = await getHtml(path, storage)
if (html) {
const transforms = [
{
fn: evaluateServerScripts,
args: [event],
hook: mcflyHooks.serverScriptsEvaluated,
},
{
fn: injectHtmlFragments,
args: [storage],
hook: mcflyHooks.fragmentsInjected,
},
{
fn: injectCustomElements,
args: [componentType, storage],
hook: mcflyHooks.customElementsInjected,
},
]
if (!!componentType && !!html) {
for (const transform of transforms) {
html = await transform.fn(html.toString(), ...transform.args)
// call hook
if (transform.hook) {
// not sure if we want to await, for now it makes the outcome predictable
await hooks.callHook(transform.hook)
}
}
} else {
consola.error('[ERR]: Failed to insert registry', {
componentType: !componentType ? 'missing' : 'okay',
html: !html ? 'missing' : 'okay',
})
}
}
if (html) {
await hooks.callHook(mcflyHooks.pageRendered)
}
const timeEnd = performance.now()
consola.info(
colorize('green', event.path),
'rendered in',
Math.round(timeEnd - timeStart),
'ms'
)
return (
html ??
new Response(
'😱 ERROR 404: Not found. You can put a 404.html on the ./src/pages directory to customize this error page.',
{ status: 404 }
)
)
})
/**
* Gets the storage path for a file
* @param {string} filename
* @returns {string}
*/
function getPath(filename) {
return `assets:pages${filename}`
}
function getPurePath(path) {
return path.split('?')[0]
}
/**
* Gets the correct HTML depending on the path requested
* @param {string} path
* @param {Storage} storage
* @returns {Promise<StorageValue>}
*/
async function getHtml(path, storage) {
const purePath = getPurePath(path)
const rawPath =
purePath[purePath.length - 1] === '/' ? purePath.slice(0, -1) : purePath
const filename = rawPath === '' ? '/index.html' : `${rawPath}.html`
const fallback = getPath(rawPath + '/index.html')
const filePath = getPath(filename)
let html = await storage.getItem(filePath)
if (!html) html = await storage.getItem(fallback)
if (!html) html = await storage.getItem(getPath('/404.html'))
return html
}

View file

@ -4,4 +4,3 @@ export { getFiles } from './get-files.js'
export { hooks } from './hooks.mjs'
export { injectCustomElements } from './inject-elements.js'
export { injectHtmlFragments } from './inject-fragments.mjs'
export { mcflyNitroConfig as nitroConfig } from '../mcfly-nitro-config.js'

View file

@ -1,7 +1,7 @@
import type { ParsedArgs } from 'citty'
import consola from 'consola'
import { expect, it, vi } from 'vitest'
import { exportedForTest } from '../src/cli/commands/build.js'
import { exportedForTest } from '../src/commands/build'
const build = exportedForTest.build

View file

@ -1,6 +1,6 @@
import { consola } from 'consola'
import { it, expect, vi } from 'vitest'
import { exportedForTest } from '../src/cli/commands/prepare.js'
import { exportedForTest } from '../src/commands/prepare'
const prepare = exportedForTest.prepare
const mocks = vi.hoisted(() => {
@ -9,12 +9,6 @@ const mocks = vi.hoisted(() => {
}
})
vi.mock('nitropack', () => {
return {
createNitro: mocks.createNitro,
}
})
it('start prepare script', () => {
const spy = vi.spyOn(consola, 'start')
@ -23,14 +17,6 @@ it('start prepare script', () => {
expect(spy).toHaveBeenCalled()
})
it.skip('execute nitropack prepare', () => {
const successSpy = vi.spyOn(consola, 'success')
prepare({ dir: 'fakeDir', _: [] })
expect(successSpy).toHaveBeenCalled()
})
it.skip('catch error', () => {
const dir = 'fake-dir'
const errSpy = vi.spyOn(consola, 'error')

View file

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2026 Ayo Ayco
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.

View file

@ -1,12 +0,0 @@
# Create Component
```
npm create @mcflyjs/component@latest
```
Create a new web component powered by [webcomponent.io](https://webcomponent.io)
---
_Just keep building._<br>
_A project by [Ayo](https://ayo.ayco.io)_

View file

@ -1,35 +0,0 @@
{
"name": "@mcflyjs/create-component",
"version": "0.0.1",
"description": "Create a new web component",
"type": "module",
"bin": {
"create-component": "./dist/index.js"
},
"main": "./dist/index.js",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"scripts": {
"build": "tsc --erasableSyntaxOnly",
"dev": "npx jiti ./src/index.ts",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://git.ayo.run/ayo/mcfly",
"directory": "packages/create-component"
},
"author": "Ayo Ayco",
"license": "MIT",
"dependencies": {
"consola": "^3.4.2",
"giget": "^3.2.0"
},
"devDependencies": {
"@types/node": "^25.6.0"
}
}

View file

@ -1,48 +0,0 @@
lockfileVersion: '9.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
importers:
.:
dependencies:
consola:
specifier: ^3.4.2
version: 3.4.2
giget:
specifier: ^3.2.0
version: 3.2.0
devDependencies:
'@types/node':
specifier: ^25.6.0
version: 25.6.2
packages:
'@types/node@25.6.2':
resolution: {integrity: sha512-sokuT28dxf9JT5Kady1fsXOvI4HVpjZa95NKT5y9PNTIrs2AsobR4GFAA90ZG8M+nxVRLysCXsVj6eGC7Vbrlw==}
consola@3.4.2:
resolution: {integrity: sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==}
engines: {node: ^14.18.0 || >=16.10.0}
giget@3.2.0:
resolution: {integrity: sha512-GvHTWcykIR/fP8cj8dMpuMMkvaeJfPvYnhq0oW+chSeIr+ldX21ifU2Ms6KBoyKZQZmVaUAAhQ2EZ68KJF8a7A==}
hasBin: true
undici-types@7.19.2:
resolution: {integrity: sha512-qYVnV5OEm2AW8cJMCpdV20CDyaN3g0AjDlOGf1OW4iaDEx8MwdtChUp4zu4H0VP3nDRF/8RKWH+IPp9uW0YGZg==}
snapshots:
'@types/node@25.6.2':
dependencies:
undici-types: 7.19.2
consola@3.4.2: {}
giget@3.2.0: {}
undici-types@7.19.2: {}

View file

@ -1,197 +0,0 @@
#!/usr/bin/env node
import { consola } from 'consola'
import { colorize } from 'consola/utils'
import { downloadTemplate } from 'giget'
import { spawnSync } from 'node:child_process'
import * as path from 'node:path'
const [, , directoryArg] = process.argv
type PromptAction = {
prompt: string
info?: string
startMessage: string
command: string
subCommand: string
error: string
}
/**
* Create Web Component
*/
async function create() {
const defaultDirectory = 'hello-world'
consola.box(`Hello! Let's build a new ${colorize('bold', 'Web Component')}!`)
let directory = directoryArg
if (!directory) {
directory =
(await consola.prompt('Give your new project a name:', {
placeholder: defaultDirectory,
})) ?? defaultDirectory
} else {
consola.success(`Using ${directory} as name.`)
}
if (typeof directory !== 'string') {
return
}
directory = getSafeDirectory(directory)
const hasErrors = await downloadTemplateToDirectory(directory)
if (!hasErrors) {
const prompts: PromptAction[] = [
{
prompt: `Would you like to install the dependencies to ${colorize(
'bold',
directory
)}?`,
info: 'This might take some time depending on your connectivity.',
startMessage: 'Installing dependencies using npm...',
command: `npm`,
subCommand: 'install',
error: `Install dependencies later with ${colorize(
'yellow',
'npm install'
)}`,
},
{
prompt: 'Would you like to initialize your git repository?',
startMessage: 'Initializing git repository...',
command: `git`,
subCommand: 'init',
error: `Initialize git repository later with ${colorize(
'yellow',
'git init'
)}`,
},
]
const intentions = await askPrompts(prompts, directory)
if (!!intentions && intentions.length > 0)
showResults(directory, intentions[0])
}
}
/**
* Returns string that is safe for commands
* @param {string} directory
* @returns string
*/
function getSafeDirectory(directory: string): string {
const { platform } = process
const locale = path[platform === `win32` ? `win32` : `posix`]
const localePath = directory.split(path.sep).join(locale.sep)
return path.normalize(localePath)
}
/**
* Tries to download the template to the directory and returns a Promise whether the operation resulted to errors
* @param {string} directory
* @returns Promise<boolean> hasErrors
*/
async function downloadTemplateToDirectory(
directory: string
): Promise<boolean> {
let hasErrors = false
try {
consola.start(
`Copying template to ${colorize('bold', getSafeDirectory(directory))}...`
)
await downloadTemplate('github:ayo-run/web-component', {
dir: directory,
})
} catch (_ㆆ) {
if (_ㆆ instanceof Error) {
consola.error(_ㆆ.message)
} else {
consola.error(_ㆆ)
}
consola.info('Try a different name.\n')
hasErrors = true
}
return hasErrors
}
/**
* Iterate over an array of prompts and ask for user intention
* @param {Array<PromptAction>} prompts
* @param {string} cwd
* @returns Promise<Array<boolean> | undefined>
*/
async function askPrompts(
prompts: PromptAction[],
cwd: string
): Promise<boolean[] | undefined> {
const results: boolean[] = []
for (const p of prompts) {
const userIntends = await consola.prompt(p.prompt, {
type: 'confirm',
})
if (typeof userIntends !== 'boolean') {
return
}
if (userIntends) {
p.info && consola.info(p.info)
consola.start(p.startMessage)
try {
spawnSync(p.command, [p.subCommand], {
cwd,
shell: true,
timeout: 100_000,
stdio: 'inherit',
})
consola.success('Done!')
} catch (_ㆆ) {
if (_ㆆ instanceof Error) {
consola.error(_ㆆ.message)
} else {
consola.error(_ㆆ)
}
consola.info(p.error + '\n')
}
}
results.push(userIntends)
}
return results
}
/**
* Displays the success result string based on directory and choices
* @param {string} directory
* @param {boolean} installDeps
*/
function showResults(directory: string, installDeps: boolean) {
let nextActions = [
`Go to your project by running ${colorize('yellow', `cd ${directory}`)}`,
]
if (!installDeps) {
nextActions.push(
`Install the dependencies with ${colorize('yellow', 'npm install')}`
)
}
nextActions = nextActions.concat([
`Start the dev server with ${colorize('yellow', 'npm start')}`,
])
const result = `🎉 Your new ${colorize(
'bold',
'Web Commponent'
)} app is ready: ${directory}\n\nNext actions: ${nextActions
.map((action, index) => `\n${++index}. ${action}`)
.join('')}`
consola.box(result)
}
create()

View file

@ -1,10 +0,0 @@
{
"extends": "../../tsconfig.base.json",
"include": ["src"],
"compilerOptions": {
"allowJs": true,
"emitDeclarationOnly": false,
"declarationDir": "./dist",
"outDir": "./dist"
}
}

View file

@ -4,7 +4,7 @@ import { consola } from 'consola'
import { colorize } from 'consola/utils'
import { downloadTemplate } from 'giget'
import { spawnSync } from 'node:child_process'
import * as path from 'node:path'
import path from 'node:path'
const [, , directoryArg] = process.argv

View file

@ -0,0 +1,7 @@
import serve from './serve'
export default () => {
return {
serve,
}
}

View file

@ -0,0 +1,16 @@
{
"name": "@mcflyjs/fastify",
"version": "0.0.1",
"type": "module",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"@fastify/autoload": "6.3.1",
"fastify": "5.8.5"
}
}

22
packages/fastify/serve.js Normal file
View file

@ -0,0 +1,22 @@
import Fastify from 'fastify'
import AutoLoad from '@fastify/autoload'
import path from 'node:path'
export default ({ rootDir, apiDir, logger, port }) => {
const server = Fastify()
const portNumber = port ?? 3000
server.register(AutoLoad, {
dir: path.join(rootDir, apiDir),
options: {
prefix: apiDir,
},
})
server
.listen({ port: portNumber })
.then(() => {
logger.log(`API now serving at http://localhost:${portNumber}${apiDir}`)
})
.catch((err) => logger.error(err))
}

View file

@ -37,7 +37,7 @@ importers:
version: 9.1.7
netlify-cli:
specifier: ^25.6.0
version: 25.6.2(@types/node@25.6.2)(db0@0.3.4(@electric-sql/pglite@0.3.16))(ioredis@5.10.1)(picomatch@4.0.4)
version: 25.6.2(@types/node@25.6.2)(db0@0.3.4(@electric-sql/pglite@0.3.16))(ioredis@5.10.1)(picomatch@4.0.4)(rollup@4.60.3)
prettier:
specifier: ^3.8.3
version: 3.8.3
@ -51,6 +51,18 @@ importers:
specifier: ^4.1.5
version: 4.1.5(@opentelemetry/api@1.8.0)(@types/node@25.6.2)(vite@7.3.3(@types/node@25.6.2)(jiti@2.7.0)(terser@5.47.1)(yaml@2.8.4))
demo:
dependencies:
'@mcflyjs/config':
specifier: workspace:*
version: link:../packages/config
'@mcflyjs/core':
specifier: workspace:*
version: link:../packages/core
'@mcflyjs/fastify':
specifier: workspace:*
version: link:../packages/fastify
packages/config:
dependencies:
h3:
@ -59,10 +71,6 @@ importers:
web-component-base:
specifier: ^4.0.0
version: 4.1.2
devDependencies:
nitropack:
specifier: ~2.11.7
version: 2.11.13(@electric-sql/pglite@0.3.16)(@netlify/blobs@10.7.4)
packages/core:
dependencies:
@ -84,9 +92,6 @@ importers:
h3:
specifier: ^1.15.1
version: 1.15.11
nitropack:
specifier: ^2.11.7
version: 2.11.13(@electric-sql/pglite@0.3.16)(@netlify/blobs@10.7.4)
pathe:
specifier: ^2.0.3
version: 2.0.3
@ -122,19 +127,6 @@ importers:
specifier: ^3.0.9
version: 3.2.4(@types/node@25.6.2)(@vitest/ui@3.0.9)(jiti@2.7.0)(terser@5.47.1)(yaml@2.8.4)
packages/create-component:
dependencies:
consola:
specifier: ^3.4.2
version: 3.4.2
giget:
specifier: ^3.2.0
version: 3.2.0
devDependencies:
'@types/node':
specifier: ^25.6.0
version: 25.6.2
packages/create-mcfly:
dependencies:
consola:
@ -148,6 +140,15 @@ importers:
specifier: ^22.13.11
version: 22.19.18
packages/fastify:
dependencies:
'@fastify/autoload':
specifier: 6.3.1
version: 6.3.1
fastify:
specifier: 5.8.5
version: 5.8.5
site:
dependencies:
'@mcflyjs/config':
@ -164,7 +165,7 @@ importers:
version: 0.2.9
'@mcflyjs/core':
specifier: ^0.8.8
version: 0.8.8(@electric-sql/pglite@0.3.16)(@netlify/blobs@10.7.0)(magicast@0.3.5)
version: 0.8.8(@electric-sql/pglite@0.3.16)(@netlify/blobs@10.7.4)(magicast@0.3.5)
packages:
@ -966,6 +967,9 @@ packages:
'@fastify/ajv-compiler@4.0.5':
resolution: {integrity: sha512-KoWKW+MhvfTRWL4qrhUwAAZoaChluo0m0vbiJlGMt2GXvL4LVPQEjt8kSpHI3IBq5Rez8fg+XeH3cneztq+C7A==}
'@fastify/autoload@6.3.1':
resolution: {integrity: sha512-0fsG+lO3m5yEZVjXKpltCe+2eHhM6rfAPQhvlGUgLUFTw/N2wA9WqPTObMtrF3oUCUrxbSDv60HlUIoh+aFM1A==}
'@fastify/busboy@3.2.0':
resolution: {integrity: sha512-m9FVDXU3GT2ITSe0UaMA5rU3QkfC/UXtCU8y0gSN/GugTqtVldOBWIB5V6V3sbmenVZUIpU6f+mPEO2+m5iTaA==}
@ -6853,6 +6857,8 @@ snapshots:
ajv-formats: 3.0.1(ajv@8.20.0)
fast-uri: 3.1.2
'@fastify/autoload@6.3.1': {}
'@fastify/busboy@3.2.0': {}
'@fastify/error@4.2.0': {}
@ -7080,7 +7086,7 @@ snapshots:
h3: 1.15.11
web-component-base: 4.1.2
'@mcflyjs/core@0.8.8(@electric-sql/pglite@0.3.16)(@netlify/blobs@10.7.0)(magicast@0.3.5)':
'@mcflyjs/core@0.8.8(@electric-sql/pglite@0.3.16)(@netlify/blobs@10.7.4)(magicast@0.3.5)':
dependencies:
c12: 3.3.4(magicast@0.3.5)
citty: 0.1.6
@ -7088,7 +7094,7 @@ snapshots:
devalue: 5.8.0
esprima: 4.0.1
h3: 1.15.11
nitropack: 2.11.13(@electric-sql/pglite@0.3.16)(@netlify/blobs@10.7.0)
nitropack: 2.11.13(@electric-sql/pglite@0.3.16)(@netlify/blobs@10.7.4)
pathe: 2.0.3
ultrahtml: 1.6.0
transitivePeerDependencies:
@ -7166,23 +7172,23 @@ snapshots:
find-up: 7.0.0
minimatch: 10.2.5
read-pkg: 9.0.1
semver: 7.7.2
semver: 7.8.0
yaml: 2.8.4
yargs: 17.7.2
'@netlify/build@35.13.4(@opentelemetry/api@1.8.0)(@types/node@25.6.2)(picomatch@4.0.4)':
'@netlify/build@35.13.4(@opentelemetry/api@1.8.0)(@types/node@25.6.2)(picomatch@4.0.4)(rollup@4.60.3)':
dependencies:
'@bugsnag/js': 8.9.0
'@netlify/blobs': 10.7.0(supports-color@10.2.2)
'@netlify/cache-utils': 6.0.5
'@netlify/config': 24.5.0
'@netlify/edge-bundler': 14.10.1
'@netlify/functions-utils': 6.2.30(supports-color@10.2.2)
'@netlify/functions-utils': 6.2.30(rollup@4.60.3)(supports-color@10.2.2)
'@netlify/git-utils': 6.0.4
'@netlify/opentelemetry-utils': 2.0.2(@opentelemetry/api@1.8.0)
'@netlify/plugins-list': 6.81.6
'@netlify/run-utils': 6.0.3
'@netlify/zip-it-and-ship-it': 14.5.4(supports-color@10.2.2)
'@netlify/zip-it-and-ship-it': 14.5.4(rollup@4.60.3)(supports-color@10.2.2)
'@opentelemetry/api': 1.8.0
'@sindresorhus/slugify': 2.2.1
ansi-escapes: 7.3.0
@ -7215,7 +7221,7 @@ snapshots:
resolve: 2.0.0-next.6
rfdc: 1.4.1
safe-json-stringify: 1.2.0
semver: 7.7.2
semver: 7.8.0
string-width: 7.2.0
supports-color: 10.2.2
terminal-link: 4.0.0
@ -7310,7 +7316,7 @@ snapshots:
image-size: 2.0.2
js-image-generator: 1.0.4
parse-gitignore: 2.0.0
semver: 7.7.2
semver: 7.8.0
tmp-promise: 3.0.3
uuid: 13.0.0
write-file-atomic: 5.0.1
@ -7328,12 +7334,12 @@ snapshots:
image-size: 2.0.2
js-image-generator: 1.0.4
parse-gitignore: 2.0.0
semver: 7.7.2
semver: 7.8.0
tmp-promise: 3.0.3
uuid: 13.0.0
write-file-atomic: 5.0.1
'@netlify/dev@4.17.3(db0@0.3.4(@electric-sql/pglite@0.3.16))(ioredis@5.10.1)':
'@netlify/dev@4.17.3(db0@0.3.4(@electric-sql/pglite@0.3.16))(ioredis@5.10.1)(rollup@4.60.3)':
dependencies:
'@netlify/ai': 0.4.1
'@netlify/blobs': 10.7.4
@ -7341,7 +7347,7 @@ snapshots:
'@netlify/database-dev': 0.10.0
'@netlify/dev-utils': 4.4.3
'@netlify/edge-functions-dev': 1.0.16
'@netlify/functions-dev': 1.2.6
'@netlify/functions-dev': 1.2.6(rollup@4.60.3)
'@netlify/headers': 2.1.8
'@netlify/images': 1.3.7(@netlify/blobs@10.7.4)(db0@0.3.4(@electric-sql/pglite@0.3.16))(ioredis@5.10.1)
'@netlify/redirects': 3.1.10
@ -7393,7 +7399,7 @@ snapshots:
p-wait-for: 5.0.2
parse-imports: 2.2.1
path-key: 4.0.0
semver: 7.7.2
semver: 7.8.0
tar: 7.5.15
tmp-promise: 3.0.3
urlpattern-polyfill: 8.0.2
@ -7416,12 +7422,12 @@ snapshots:
dependencies:
'@netlify/types': 2.6.0
'@netlify/functions-dev@1.2.6':
'@netlify/functions-dev@1.2.6(rollup@4.60.3)':
dependencies:
'@netlify/blobs': 10.7.4
'@netlify/dev-utils': 4.4.3
'@netlify/functions': 5.2.0
'@netlify/zip-it-and-ship-it': 14.5.4
'@netlify/zip-it-and-ship-it': 14.5.4(rollup@4.60.3)(supports-color@10.2.2)
cron-parser: 4.9.0
decache: 4.6.2
extract-zip: 2.0.1
@ -7429,7 +7435,7 @@ snapshots:
jwt-decode: 4.0.0
lambda-local: 2.2.0
read-package-up: 11.0.0
semver: 7.7.2
semver: 7.8.0
source-map-support: 0.5.21
transitivePeerDependencies:
- bare-abort-controller
@ -7439,9 +7445,9 @@ snapshots:
- rollup
- supports-color
'@netlify/functions-utils@6.2.30(supports-color@10.2.2)':
'@netlify/functions-utils@6.2.30(rollup@4.60.3)(supports-color@10.2.2)':
dependencies:
'@netlify/zip-it-and-ship-it': 14.5.4(supports-color@10.2.2)
'@netlify/zip-it-and-ship-it': 14.5.4(rollup@4.60.3)(supports-color@10.2.2)
cpy: 11.1.0
path-exists: 5.0.0
transitivePeerDependencies:
@ -7669,7 +7675,7 @@ snapshots:
'@babel/types': 7.28.0
'@netlify/binary-info': 1.0.0
'@netlify/serverless-functions-api': 2.15.1
'@vercel/nft': 0.29.4(rollup@4.60.3)
'@vercel/nft': 0.29.4(rollup@4.60.3)(supports-color@10.2.2)
archiver: 7.0.1
common-path-prefix: 3.0.0
copy-file: 11.1.0
@ -7706,13 +7712,13 @@ snapshots:
- rollup
- supports-color
'@netlify/zip-it-and-ship-it@14.5.4':
'@netlify/zip-it-and-ship-it@14.5.4(rollup@4.60.3)(supports-color@10.2.2)':
dependencies:
'@babel/parser': 7.29.3
'@babel/types': 7.29.0
'@netlify/binary-info': 1.0.0
'@netlify/serverless-functions-api': 2.15.0
'@vercel/nft': 0.29.4(rollup@4.60.3)
'@vercel/nft': 0.29.4(rollup@4.60.3)(supports-color@10.2.2)
archiver: 7.0.1
common-path-prefix: 3.0.0
copy-file: 11.1.0
@ -7733,49 +7739,7 @@ snapshots:
precinct: 12.3.2(supports-color@10.2.2)
require-package-name: 2.0.1
resolve: 2.0.0-next.6
semver: 7.7.2
tmp-promise: 3.0.3
toml: 3.0.0
unixify: 1.0.0
urlpattern-polyfill: 8.0.2
yargs: 17.7.2
zod: 3.25.76
transitivePeerDependencies:
- bare-abort-controller
- bare-buffer
- encoding
- react-native-b4a
- rollup
- supports-color
'@netlify/zip-it-and-ship-it@14.5.4(supports-color@10.2.2)':
dependencies:
'@babel/parser': 7.29.3
'@babel/types': 7.29.0
'@netlify/binary-info': 1.0.0
'@netlify/serverless-functions-api': 2.15.0
'@vercel/nft': 0.29.4(supports-color@10.2.2)
archiver: 7.0.1
common-path-prefix: 3.0.0
copy-file: 11.1.0
es-module-lexer: 1.7.0
esbuild: 0.27.3
execa: 8.0.1
fast-glob: 3.3.3
filter-obj: 6.1.0
find-up: 7.0.0
is-path-inside: 4.0.0
junk: 4.0.1
locate-path: 7.2.0
merge-options: 3.0.4
minimatch: 10.2.5
normalize-path: 3.0.0
p-map: 7.0.3
path-exists: 5.0.0
precinct: 12.3.2(supports-color@10.2.2)
require-package-name: 2.0.1
resolve: 2.0.0-next.6
semver: 7.7.2
semver: 7.8.0
tmp-promise: 3.0.3
toml: 3.0.0
unixify: 1.0.0
@ -7928,7 +7892,7 @@ snapshots:
'@opentelemetry/propagator-b3': 1.30.1(@opentelemetry/api@1.9.0)
'@opentelemetry/propagator-jaeger': 1.30.1(@opentelemetry/api@1.9.0)
'@opentelemetry/sdk-trace-base': 1.30.1(@opentelemetry/api@1.9.0)
semver: 7.7.2
semver: 7.8.0
'@opentelemetry/semantic-conventions@1.28.0': {}
@ -8292,26 +8256,7 @@ snapshots:
'@typescript-eslint/types': 8.59.2
eslint-visitor-keys: 5.0.1
'@vercel/nft@0.29.4(rollup@4.60.3)':
dependencies:
'@mapbox/node-pre-gyp': 2.0.3(supports-color@10.2.2)
'@rollup/pluginutils': 5.3.0(rollup@4.60.3)
acorn: 8.16.0
acorn-import-attributes: 1.9.5(acorn@8.16.0)
async-sema: 3.1.1
bindings: 1.5.0
estree-walker: 2.0.2
glob: 10.5.0
graceful-fs: 4.2.11
node-gyp-build: 4.8.4
picomatch: 4.0.4
resolve-from: 5.0.0
transitivePeerDependencies:
- encoding
- rollup
- supports-color
'@vercel/nft@0.29.4(supports-color@10.2.2)':
'@vercel/nft@0.29.4(rollup@4.60.3)(supports-color@10.2.2)':
dependencies:
'@mapbox/node-pre-gyp': 2.0.3(supports-color@10.2.2)
'@rollup/pluginutils': 5.3.0(rollup@4.60.3)
@ -9849,7 +9794,7 @@ snapshots:
process-warning: 5.0.0
rfdc: 1.4.1
secure-json-parse: 4.1.0
semver: 7.7.2
semver: 7.8.0
toad-cache: 3.7.0
fastq@1.20.1:
@ -10689,7 +10634,7 @@ snapshots:
lodash.isstring: 4.0.1
lodash.once: 4.1.1
ms: 2.1.3
semver: 7.7.2
semver: 7.8.0
junk@4.0.1: {}
@ -11017,16 +10962,16 @@ snapshots:
negotiator@1.0.0: {}
netlify-cli@25.6.2(@types/node@25.6.2)(db0@0.3.4(@electric-sql/pglite@0.3.16))(ioredis@5.10.1)(picomatch@4.0.4):
netlify-cli@25.6.2(@types/node@25.6.2)(db0@0.3.4(@electric-sql/pglite@0.3.16))(ioredis@5.10.1)(picomatch@4.0.4)(rollup@4.60.3):
dependencies:
'@fastify/static': 9.0.0
'@netlify/ai': 0.4.1
'@netlify/api': 14.0.18
'@netlify/blobs': 10.7.0(supports-color@10.2.2)
'@netlify/build': 35.13.4(@opentelemetry/api@1.8.0)(@types/node@25.6.2)(picomatch@4.0.4)
'@netlify/build': 35.13.4(@opentelemetry/api@1.8.0)(@types/node@25.6.2)(picomatch@4.0.4)(rollup@4.60.3)
'@netlify/build-info': 10.5.1
'@netlify/config': 24.5.0
'@netlify/dev': 4.17.3(db0@0.3.4(@electric-sql/pglite@0.3.16))(ioredis@5.10.1)
'@netlify/dev': 4.17.3(db0@0.3.4(@electric-sql/pglite@0.3.16))(ioredis@5.10.1)(rollup@4.60.3)
'@netlify/dev-utils': 4.4.3
'@netlify/edge-bundler': 14.10.1
'@netlify/edge-functions': 3.0.6
@ -11035,7 +10980,7 @@ snapshots:
'@netlify/images': 1.3.7(@netlify/blobs@10.7.0)(db0@0.3.4(@electric-sql/pglite@0.3.16))(ioredis@5.10.1)
'@netlify/local-functions-proxy': 2.0.3
'@netlify/redirect-parser': 15.0.4
'@netlify/zip-it-and-ship-it': 14.5.4
'@netlify/zip-it-and-ship-it': 14.5.4(rollup@4.60.3)(supports-color@10.2.2)
'@octokit/rest': 22.0.0
'@opentelemetry/api': 1.8.0
'@pnpm/tabtab': 0.5.4
@ -11162,110 +11107,6 @@ snapshots:
p-wait-for: 5.0.2
qs: 6.15.1
nitropack@2.11.13(@electric-sql/pglite@0.3.16)(@netlify/blobs@10.7.0):
dependencies:
'@cloudflare/kv-asset-handler': 0.4.2
'@netlify/functions': 3.1.10(rollup@4.60.3)
'@rollup/plugin-alias': 5.1.1(rollup@4.60.3)
'@rollup/plugin-commonjs': 28.0.9(rollup@4.60.3)
'@rollup/plugin-inject': 5.0.5(rollup@4.60.3)
'@rollup/plugin-json': 6.1.0(rollup@4.60.3)
'@rollup/plugin-node-resolve': 16.0.3(rollup@4.60.3)
'@rollup/plugin-replace': 6.0.3(rollup@4.60.3)
'@rollup/plugin-terser': 0.4.4(rollup@4.60.3)
'@vercel/nft': 0.29.4(rollup@4.60.3)
archiver: 7.0.1
c12: 3.3.4(magicast@0.3.5)
chokidar: 4.0.3
citty: 0.1.6
compatx: 0.2.0
confbox: 0.2.4
consola: 3.4.2
cookie-es: 2.0.1
croner: 9.1.0
crossws: 0.3.5
db0: 0.3.4(@electric-sql/pglite@0.3.16)
defu: 6.1.7
destr: 2.0.5
dot-prop: 9.0.0
esbuild: 0.25.12
escape-string-regexp: 5.0.0
etag: 1.8.1
exsolve: 1.0.8
globby: 14.1.0
gzip-size: 7.0.0
h3: 1.15.11
hookable: 5.5.3
httpxy: 0.1.7
ioredis: 5.10.1
jiti: 2.7.0
klona: 2.0.6
knitwork: 1.3.0
listhen: 1.10.0
magic-string: 0.30.21
magicast: 0.3.5
mime: 4.1.0
mlly: 1.8.2
node-fetch-native: 1.6.7
node-mock-http: 1.0.4
ofetch: 1.5.1
ohash: 2.0.11
pathe: 2.0.3
perfect-debounce: 1.0.0
pkg-types: 2.3.1
pretty-bytes: 6.1.1
radix3: 1.1.2
rollup: 4.60.3
rollup-plugin-visualizer: 6.0.11(rollup@4.60.3)
scule: 1.3.0
semver: 7.8.0
serve-placeholder: 2.0.2
serve-static: 2.2.1
source-map: 0.7.6
std-env: 3.10.0
ufo: 1.6.4
ultrahtml: 1.6.0
uncrypto: 0.1.3
unctx: 2.5.0
unenv: 2.0.0-rc.24
unimport: 5.7.0
unplugin-utils: 0.2.5
unstorage: 1.17.5(@netlify/blobs@10.7.0)(db0@0.3.4(@electric-sql/pglite@0.3.16))(ioredis@5.10.1)
untyped: 2.0.0
unwasm: 0.3.11
youch: 4.1.0-beta.8
youch-core: 0.3.3
transitivePeerDependencies:
- '@azure/app-configuration'
- '@azure/cosmos'
- '@azure/data-tables'
- '@azure/identity'
- '@azure/keyvault-secrets'
- '@azure/storage-blob'
- '@capacitor/preferences'
- '@deno/kv'
- '@electric-sql/pglite'
- '@libsql/client'
- '@netlify/blobs'
- '@planetscale/database'
- '@upstash/redis'
- '@vercel/blob'
- '@vercel/functions'
- '@vercel/kv'
- aws4fetch
- bare-abort-controller
- bare-buffer
- better-sqlite3
- drizzle-orm
- encoding
- idb-keyval
- mysql2
- react-native-b4a
- rolldown
- sqlite3
- supports-color
- uploadthing
nitropack@2.11.13(@electric-sql/pglite@0.3.16)(@netlify/blobs@10.7.4):
dependencies:
'@cloudflare/kv-asset-handler': 0.4.2
@ -11277,7 +11118,7 @@ snapshots:
'@rollup/plugin-node-resolve': 16.0.3(rollup@4.60.3)
'@rollup/plugin-replace': 6.0.3(rollup@4.60.3)
'@rollup/plugin-terser': 0.4.4(rollup@4.60.3)
'@vercel/nft': 0.29.4(rollup@4.60.3)
'@vercel/nft': 0.29.4(rollup@4.60.3)(supports-color@10.2.2)
archiver: 7.0.1
c12: 3.3.4(magicast@0.3.5)
chokidar: 4.0.3
@ -11425,13 +11266,13 @@ snapshots:
normalize-package-data@7.0.1:
dependencies:
hosted-git-info: 8.1.0
semver: 7.7.2
semver: 7.8.0
validate-npm-package-license: 3.0.4
normalize-package-data@8.0.0:
dependencies:
hosted-git-info: 9.0.3
semver: 7.7.2
semver: 7.8.0
validate-npm-package-license: 3.0.4
normalize-path@2.1.1:
@ -11622,7 +11463,7 @@ snapshots:
ky: 1.14.3
registry-auth-token: 5.1.1
registry-url: 6.0.1
semver: 7.7.2
semver: 7.8.0
parallel-transform@1.2.0:
dependencies:
@ -12916,7 +12757,7 @@ snapshots:
is-npm: 6.1.0
latest-version: 9.0.0
pupa: 3.3.0
semver: 7.7.2
semver: 7.8.0
xdg-basedir: 5.1.0
uqr@0.1.3: {}

View file

@ -1,7 +1,8 @@
packages:
- "packages/**"
- "templates/**"
- "site/**"
- 'packages/**'
- 'templates/**'
- 'site'
- 'demo'
allowBuilds:
'@parcel/watcher': false
esbuild: true

View file

@ -1,27 +1,28 @@
// @ts-check
import { defineMcFlyConfig } from '@mcflyjs/config'
import { defineConfig } from '@mcflyjs/config'
// import testPlugin from './test-plugin.mjs'
export default defineMcFlyConfig({
export default defineConfig({
server: {},
components: 'js',
// plugins: [testPlugin()],
nitro: {
preset: 'netlify',
devServer: {
watch: ['../packages'],
},
routeRules: {
'/chat': {
redirect: {
to: 'https://matrix.to/#/#mcfly:matrix.org',
statusCode: 302,
},
},
},
compressPublicAssets: {
gzip: true,
brotli: true,
},
compatibilityDate: '2024-12-08',
},
// nitro: {
// preset: 'netlify',
// devServer: {
// watch: ['../packages'],
// },
// routeRules: {
// '/chat': {
// redirect: {
// to: 'https://matrix.to/#/#mcfly:matrix.org',
// statusCode: 302,
// },
// },
// },
// compressPublicAssets: {
// gzip: true,
// brotli: true,
// },
// compatibilityDate: '2024-12-08',
// },
})