npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@zaydek/esnode

v0.1.2

Published

Node runner for JavaScript XML (JSX) and TypeScript.

Downloads

54

Readme

esnode

esnode is the answer to the question: How do I run JSX or TypeScript on the server without build-steps?

esnode builds on esbuild and source-map-support (thanks @evanw!) to enable transpilation on-the-fly for .js, .jsx, .ts, and .tsx files.

Note that esnode does not type-check at build-time. If this is important to you, you may want to use ts-node or Deno. Note that Deno is not largely compatible with the existing Node.js ecosystem. Therefore if type-checking at build-time and interoperability with Node.js is important to you, you may want to use ts-node or defer to VS Code and or tsc for type-checking.

Installation

To install esnode, simply install @zaydek/esnode and run ./node_modules/.bin/esnode.

NPM

npm i --save-dev @zaydek/esnode
./node_modules/.bin/esnode [file]

Yarn

yarn --dev @zaydek/esnode
./node_modules/.bin/esnode [file]

Finally, create and run a JSX or TypeScript file:

// hello.ts
function hello(who?: string): string {
	return `Hello, ${who ?? "world"}!`
}

console.log(hello())
% ./node_modules/.bin/esnode hello.ts
Hello, world!

For convenience, you may want to alias esnode as alias esnode=./node_modules/.bin/esnode. To alias esnode globally, add alias esnode=./node_modules/.bin/esnode to your ~/.bash_profile.

CLI


 esnode [file]

   esnode runs a JavaScript or TypeScript file using the Node.js runtime. This is
   almost the same as 'node [file]' except that 'esnode [file]' is compatible with
   '.js', '.jsx', '.ts', and '.tsx' files. You may even interoperate JavaScript and
   TypeScript.

   Your entry point and its dependencies are transpiled on-the-fly by esbuild.
   esbuild is configured to not bundle 'package.json' dependencies at build-time;
   these dependencies use 'require' at runtime.

   Note that '.ts' and '.tsx' files are not type-checked. You may use VS Code or the
   TypeScript CLI 'tsc' for type-checking. To add the TypeScript CLI, use
   'npm i --save-dev typescript' or 'yarn add --dev typescript'.

 Examples

   % ./node_modules/.bin/esnode hello.ts
   Hello, world!

   % alias esnode=./node_modules/.bin/esnode
   % esnode hello.ts
   Hello, world!

   % STACK_TRACE=true esnode hello.ts
   Hello, world!

 Repositories

   esnode:  https://github.com/zaydek/esnode
   esbuild: https://github.com/evanw/esbuild

License

Licensed as MIT open source.