@cosmic-ts/node
v0.2.2
Published
Opt-in Node island for cosmic-ts: enable real npm and node:* imports
Readme
@cosmic-ts/node
Opt-in Node island for cosmic-ts. Import this package to allow real
node:* builtins and third-party npm packages (express, lodash, …).
Without it, Cosmic stays dialect-only: npm / node:* imports are errors.
import "@cosmic-ts/node";
import http from "node:http";
import express from "express";
// Runs on real Node (system `node` on PATH).pnpm add @cosmic-ts/node
cosmic-ts build ./server.ts # requires `node` on PATH at run time
cosmic-ts build ./server.ts --self-contained # pack Node into the artifact
cosmic-ts check ./server.ts # Node island report
cosmic-ts build ./server.ts --native-only # fail if island requiredWhat this package is
- The mandatory opt-in for Node / npm
- Docs and a small dialect-facing marker API (
NODE_ISLAND,enableNodeIsland)
It does not vendor npm packages or the Node binary. Install packages with
pnpm/npm as usual; Node comes from PATH or --self-contained.
Dialect-native Cosmic packages (@cosmic-ts/http-client, …) do not need this.
