From 82c913712bd65dd46511c1dcc15e657dd8716189 Mon Sep 17 00:00:00 2001 From: Petr Brzek Date: Thu, 12 Feb 2026 19:29:39 +0100 Subject: [PATCH] =?UTF-8?q?Remove=20library-specific=20code,=20centralize?= =?UTF-8?q?=20CDN=20config,=20fix=20docs=20=E2=80=94=20v0.2.13?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Platform cleanup: - Remove sentry shim (not a real Node.js built-in) - Remove custom convex command (uses generic bin stubs now) - Remove Convex-specific path remaps from fs.ts - Move vfs: prefix stripping from fs.ts to esbuild.ts - Centralize all CDN URLs in src/config/cdn.ts esm.sh fix: - redirectNpmImports now reads package.json dependencies and includes major version in URLs (e.g. ai@4/react), fixing 404s on subpath imports Demo improvements: - Rename ai-chatbot demo → vercel-ai-sdk demo - Add setup overlay dialogs for Convex and Vercel AI SDK demos - Add Vercel AI SDK card to homepage Documentation: - Fix "Just Node" → "almostnode" in tutorials - Fix broken file references and API.md links - Add Demos section to README - Update CHANGELOG for v0.2.13 Co-Authored-By: Claude Opus 4.6 --- CHANGELOG.md | 18 + README.md | 18 +- docs/AI_CHATBOT_TUTORIAL.md | 8 +- docs/CONVEX_TUTORIAL.md | 10 +- examples/demo-convex-app.html | 76 +- ...i-chatbot.html => demo-vercel-ai-sdk.html} | 84 +- index.html | 12 + package.json | 2 +- src/config/cdn.ts | 24 + src/convex-app-demo-entry.ts | 25 + src/convex-app-demo.ts | 897 +++--------------- src/frameworks/code-transforms.ts | 84 +- src/frameworks/next-dev-server.ts | 29 +- src/frameworks/next-html-generator.ts | 44 +- src/frameworks/next-shims.ts | 6 +- src/frameworks/vite-dev-server.ts | 7 +- src/runtime.ts | 13 +- src/shims/child_process.ts | 56 +- src/shims/esbuild.ts | 52 +- src/shims/fs.ts | 44 - src/shims/rollup.ts | 5 +- src/shims/sentry.ts | 133 --- src/transform.ts | 5 +- src/types/external.d.ts | 30 +- ...o-entry.ts => vercel-ai-sdk-demo-entry.ts} | 29 +- ...-chatbot-demo.ts => vercel-ai-sdk-demo.ts} | 0 tests/cdn-config.test.ts | 68 ++ tests/code-transforms.test.ts | 96 ++ tests/virtual-fs.test.ts | 20 + 29 files changed, 764 insertions(+), 1131 deletions(-) rename examples/{demo-ai-chatbot.html => demo-vercel-ai-sdk.html} (59%) create mode 100644 src/config/cdn.ts delete mode 100644 src/shims/sentry.ts rename src/{ai-chatbot-demo-entry.ts => vercel-ai-sdk-demo-entry.ts} (88%) rename src/{ai-chatbot-demo.ts => vercel-ai-sdk-demo.ts} (100%) create mode 100644 tests/cdn-config.test.ts create mode 100644 tests/code-transforms.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 70818dd..eb4a7d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,24 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.2.13] - 2026-02-12 + +### Added +- **Centralized CDN configuration** (`src/config/cdn.ts`): Single source of truth for esm.sh, unpkg, and other CDN URLs used across the codebase +- **esm.sh version resolution**: `redirectNpmImports` now reads `package.json` dependencies and includes the major version in esm.sh URLs (e.g. `ai@4/react`), fixing 404s on subpath imports +- **Setup overlay dialogs**: Convex and Vercel AI SDK demos now show an API key setup dialog on load with privacy notice ("your key stays in your browser") +- **New tests**: `tests/cdn-config.test.ts` (12 tests) and `tests/code-transforms.test.ts` (11 tests) + +### Changed +- Renamed AI chatbot demo files: `demo-ai-chatbot.html` → `demo-vercel-ai-sdk.html`, `ai-chatbot-demo.ts` → `vercel-ai-sdk-demo.ts` +- Replaced hardcoded CDN URLs throughout codebase with imports from `src/config/cdn.ts` + +### Removed +- **`sentry` shim** (`src/shims/sentry.ts`): Was a no-op stub for a non-existent Node.js built-in +- **Custom `convex` command** in `child_process.ts`: Convex now runs through the generic bin stub system like any other CLI tool +- **Convex-specific path remaps** in `fs.ts`: `path.resolve()` with correct `cwd` handles this generically +- **`vfs:` prefix stripping** in `fs.ts`: Moved to esbuild shim where the artifact originates + ## [0.2.12] - 2026-02-12 ### Added diff --git a/README.md b/README.md index 7e1e234..51746e9 100644 --- a/README.md +++ b/README.md @@ -941,6 +941,22 @@ triggerHMR('/app/page.tsx', iframe); --- +## Demos + +Start the dev server with `npm run dev` and open any demo at `http://localhost:5173`: + +| Demo | Path | Description | +|------|------|-------------| +| **Next.js** | `/examples/next-demo.html` | Pages & App Router, CSS modules, route groups, API routes, HMR | +| **Vite** | `/examples/vite-demo.html` | Vite dev server with React and HMR | +| **Vitest** | `/examples/vitest-demo.html` | Real vitest execution with xterm.js terminal and watch mode | +| **Express** | `/examples/express-demo.html` | Express.js HTTP server running in the browser | +| **Convex** | `/examples/demo-convex-app.html` | Real-time todo app with Convex cloud deployment | +| **Vercel AI SDK** | `/examples/demo-vercel-ai-sdk.html` | Streaming AI chatbot with Next.js and OpenAI | +| **Bash** | `/examples/bash-demo.html` | Interactive POSIX shell emulator | + +--- + ## Development ### Setup @@ -967,7 +983,7 @@ npm run test:e2e npm run dev ``` -Open `http://localhost:5173/examples/next-demo.html` to see the Next.js demo. +See the [Demos](#demos) section for all available examples. --- diff --git a/docs/AI_CHATBOT_TUTORIAL.md b/docs/AI_CHATBOT_TUTORIAL.md index 4ed6a76..7302cbf 100644 --- a/docs/AI_CHATBOT_TUTORIAL.md +++ b/docs/AI_CHATBOT_TUTORIAL.md @@ -1,6 +1,6 @@ -# Just Node + AI Chatbot Tutorial +# almostnode — AI Chatbot Tutorial -Build a streaming AI chatbot entirely in the browser using Just Node's virtual Node.js runtime, Next.js, and Vercel AI SDK. +Build a streaming AI chatbot entirely in the browser using almostnode's virtual Node.js runtime, Next.js, and Vercel AI SDK. ## Table of Contents @@ -45,7 +45,7 @@ All code runs client-side - no backend server required. npm run dev ``` -2. Open `http://localhost:5173/examples/demo-ai-chatbot.html` +2. Open `http://localhost:5173/examples/demo-vercel-ai-sdk.html` 3. Enter your OpenAI API key and click "Connect" @@ -460,4 +460,4 @@ for (const chunk of chunks) { - [Vercel AI SDK Documentation](https://sdk.vercel.ai/docs) - [OpenAI API Reference](https://platform.openai.com/docs/api-reference) - [Next.js App Router](https://nextjs.org/docs/app) -- [Just Node API Documentation](./API.md) +- [almostnode API Documentation](../README.md#api-reference) diff --git a/docs/CONVEX_TUTORIAL.md b/docs/CONVEX_TUTORIAL.md index 3fe1c7d..5967437 100644 --- a/docs/CONVEX_TUTORIAL.md +++ b/docs/CONVEX_TUTORIAL.md @@ -1,6 +1,6 @@ -# Just Node + Convex Tutorial +# almostnode — Convex Tutorial -Build and deploy real-time Convex applications entirely in the browser using Just Node's virtual Node.js runtime. +Build and deploy real-time Convex applications entirely in the browser using almostnode's virtual Node.js runtime. ## Table of Contents @@ -15,7 +15,7 @@ Build and deploy real-time Convex applications entirely in the browser using Jus ## Introduction -**Just Node** provides a complete Node.js-compatible runtime that runs in your browser. You can: +**almostnode** provides a complete Node.js-compatible runtime that runs in your browser. You can: - Create a virtual filesystem with project files - Install npm packages (including Convex) @@ -52,7 +52,7 @@ vfs.writeFileSync('/package.json', JSON.stringify({ name: 'my-app' })); vfs.mkdirSync('/app', { recursive: true }); vfs.writeFileSync('/app/page.tsx', ` export default function Home() { - return

Hello from Just Node!

; + return

Hello from almostnode!

; } `); @@ -577,5 +577,5 @@ Some CLI errors are expected (like `process.exit` calls). The deployment happens - [Convex Documentation](https://docs.convex.dev) - [Convex Dashboard](https://dashboard.convex.dev) -- [Just Node API Documentation](./API.md) +- [almostnode API Documentation](../README.md#api-reference) - [CLI Integration Details](./CONVEX_CLI_INTEGRATION.md) diff --git a/examples/demo-convex-app.html b/examples/demo-convex-app.html index e02d8ed..96a71bc 100644 --- a/examples/demo-convex-app.html +++ b/examples/demo-convex-app.html @@ -142,6 +142,71 @@ margin-bottom: 12px; } @keyframes spin { to { transform: rotate(360deg); } } + .setup-overlay { + position: absolute; + inset: 0; + background: rgba(0,0,0,0.85); + display: flex; + align-items: center; + justify-content: center; + z-index: 10; + } + .setup-overlay.hidden { display: none; } + .setup-dialog { + background: var(--surface); + border: 1px solid var(--border); + padding: 32px; + max-width: 420px; + width: 90%; + } + .setup-dialog h2 { + font-family: var(--mono); + font-size: 0.9rem; + color: var(--text-bright); + margin-bottom: 8px; + } + .setup-dialog p { + font-size: 0.8rem; + color: var(--text-dim); + line-height: 1.6; + margin-bottom: 16px; + } + .setup-dialog .privacy-note { + font-family: var(--mono); + font-size: 0.65rem; + color: var(--accent-dim); + background: var(--accent-bg); + border: 1px solid var(--accent-border); + padding: 8px 12px; + margin-bottom: 16px; + line-height: 1.5; + } + .setup-dialog input { + width: 100%; + padding: 10px 12px; + font-family: var(--mono); + font-size: 0.78rem; + border: 1px solid var(--border); + background: var(--black); + color: var(--text); + margin-bottom: 12px; + } + .setup-dialog input::placeholder { color: var(--text-dim); } + .setup-dialog button { + width: 100%; + padding: 10px; + font-family: var(--mono); + font-size: 0.78rem; + font-weight: 600; + background: var(--accent); + color: var(--black); + border: none; + cursor: pointer; + text-transform: uppercase; + letter-spacing: 0.04em; + } + .setup-dialog button:hover { background: #00ffaa; } + .setup-dialog button:disabled { opacity: 0.4; cursor: not-allowed; } @media (max-width: 900px) { .layout { grid-template-columns: 1fr; } .file-tree-panel { display: none; } @@ -160,7 +225,16 @@ next.js · convex · realtime -
+
+
+
+

Convex Deploy Key Required

+

This demo deploys functions to Convex cloud and syncs data in real time. Enter your deploy key to get started.

+
Your key stays in your browser. It is used directly to communicate with the Convex API — it is never sent to our servers.
+ + +
+
diff --git a/examples/demo-ai-chatbot.html b/examples/demo-vercel-ai-sdk.html similarity index 59% rename from examples/demo-ai-chatbot.html rename to examples/demo-vercel-ai-sdk.html index 8b2adf6..10165ba 100644 --- a/examples/demo-ai-chatbot.html +++ b/examples/demo-vercel-ai-sdk.html @@ -3,7 +3,7 @@ - AI Chatbot Demo — almostnode agent runtime + Vercel AI SDK Demo — almostnode agent runtime