Skip to content

fix(cli): start command is Deno-only despite cross-runtime claim #622

Description

@SisyphusZheng

Problem

packages/adapter-vite/src/cli/start.ts:93 uses Deno.serve() directly:

Deno.serve({ port, hostname }, async (request) => { ... });

The project's stated constraint is "跨运行时(支持Deno/Node/Bun/边缘运行时)" and published packages are "pure ESM and runtime-agnostic." However, the start CLI is Deno-only — Node/Bun users cannot run deno task start or npx @openelement/adapter-vite/cli/start.

Evidence

  • packages/adapter-vite/src/cli/start.ts:93Deno.serve hardcoded
  • packages/adapter-vite/src/cli/start.ts:131import.meta.main (Deno-only)
  • CONTRIBUTING.md:29 — "consumers can run them under Deno, Node, Bun, or edge runtimes"
  • The generated dist/server/index.js uses createOpenElementNitroHandler which is runtime-agnostic, but the CLI wrapper is not.

Fix options

Option A (preferred): Use Node's node:http + Web-standard Request/Response conversion (works in Node 18+, Deno, Bun):

import { createServer } from 'node:http';
// Convert IncomingMessage → Request, handle, write Response back

Option B: Document start as Deno-only and provide a separate start:node script.

Option C: Delegate to Nitro's own output runner (node .output/server/index.mjs).

Acceptance

  • start CLI works in at least Deno + Node 18+
  • OR documentation explicitly marks it Deno-only with a Node alternative path

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions