Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/node_modules
**/dist
**/.turbo
**/.vercel
12 changes: 6 additions & 6 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file modified packages/cataloger/src/index.ts
100644 → 100755
Empty file.
2 changes: 2 additions & 0 deletions packages/example-wormhole/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
# Finder (MacOS) folder config
.DS_Store
.wormhole

.vercel
43 changes: 22 additions & 21 deletions packages/example-wormhole/package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
{
"name": "@vortexjs/example-wormhole",
"module": "index.ts",
"type": "module",
"license": "MIT-0",
"private": true,
"devDependencies": {
"@types/bun": "catalog:"
},
"dependencies": {
"@vortexjs/core": "workspace:*",
"@vortexjs/dom": "workspace:*",
"@vortexjs/wormhole": "workspace:*",
"tailwindcss": "catalog:",
"valibot": "catalog:"
},
"scripts": {
"dev": "wormhole dev"
},
"peerDependencies": {
"typescript": "catalog:"
}
"name": "@vortexjs/example-wormhole",
"module": "index.ts",
"type": "module",
"license": "MIT-0",
"private": true,
"devDependencies": {
"@types/bun": "catalog:"
},
"dependencies": {
"@vortexjs/core": "workspace:*",
"@vortexjs/dom": "workspace:*",
"@vortexjs/wormhole": "workspace:*",
"tailwindcss": "catalog:",
"valibot": "catalog:"
},
"scripts": {
"dev": "wormhole dev",
"vbuild": "wormhole build vercel"
},
"peerDependencies": {
"typescript": "catalog:"
}
}
109 changes: 57 additions & 52 deletions packages/example-wormhole/src/features/home/index.tsx
Original file line number Diff line number Diff line change
@@ -1,62 +1,67 @@
import { useAwait } from "@vortexjs/core";
import route, { query } from "@vortexjs/wormhole/route";
import * as v from "valibot";

route("/", {
page() {
return (
<>
<h1 class="text-4xl font-bold">
Welcome to Wormhole, {Object.entries(globalThis).length}
</h1>
<p>
This is an example app, go to the{" "}
<a href="/docs/tada">docs</a>
</p>
<button on:click={async () => {
console.log(await add({
a: 1,
b: 2
}))
}}>
add
</button>
</>
);
},
layout({ children }) {
return (
<>
<title>Wormhole Example</title>
{children}
</>
);
},
notFound() {
return (
<>
<h1>404 not found</h1>
</>
)
}
page() {
const pause = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));
const awaited = useAwait();

return (
<>
<h1 class="text-4xl font-bold">
Welcome to Wormhole, {Object.entries(globalThis).length}
</h1>
<p>
This is an example app, go to the{" "}
<a href="/docs/tada">docs</a>
</p>
<button on:click={async () => {
console.log(await add({
a: 1,
b: 2
}))
}}>
add
</button>
</>
);
},
layout({ children }) {
return (
<>
<title>Wormhole Example</title>
{children}
</>
);
},
notFound() {
return (
<>
<h1>404 not found</h1>
</>
)
}
});

route("/docs/[...page]", {
page({ page }) {
return (
<>
<h1>Documentation for {page.join(", ")}</h1>
<p>This is the documentation page for {page.join(", ")}.</p>
</>
);
},
route("/docs", {
page({ }) {
const page = "introduction";
return (
<>
<h1>Documentation for {page}</h1>
<p>This is the documentation page for {page}.</p>
</>
);
},
});

export const add = query("/api/add", {
schema: v.object({
a: v.number(),
b: v.number()
}),
impl({ a, b }) {
return a + b;
}
schema: v.object({
a: v.number(),
b: v.number()
}),
impl({ a, b }) {
return a + b;
}
})
Empty file modified packages/locounter/src/index.ts
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion packages/vortex-core/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class StreamingContext {
private updateCallbackImmediate = 0;
private updateCallbacks = new Set<() => void>();
private loadingCounter = 0;
private onDoneLoadingCallback = () => {};
private onDoneLoadingCallback = () => { };
onDoneLoading: Promise<void>;

constructor() {
Expand Down
26 changes: 26 additions & 0 deletions packages/wormhole/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,32 @@ Wormhole is the metaframework for Vortex, providing an opinionated way to build
- What we believe is the best way to structure applications
- Provides a set of tools that synergize with said reccommended structure

## Build Adapters

Wormhole supports different build adapters for various deployment targets:

### Development
```bash
wormhole dev
```
Uses the DevAdapter for local development with hot reloading and debugging features.

### Vercel
```bash
wormhole build vercel
```
Uses the VercelAdapter with the Vercel Build Output API for production deployment to Vercel. This adapter:
- Generates production-optimized builds (minified, no dev flags)
- Creates lightweight edge functions for each route and API endpoint
- Outputs in the `.vercel/output` directory structure
- Handles static assets separately from serverless functions
- Supports both server-side rendering and API routes

The build output follows the Vercel Build Output API format:
- `.vercel/output/static/`: Client-side JavaScript and CSS bundles
- `.vercel/output/functions/`: Individual edge functions for each route
- `.vercel/output/config.json`: Vercel configuration and routing rules

## Who this isn't for

- People who don't want to use Vortex
Expand Down
Loading