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

ts-babel-node-extendable

v1.0.1

Published

TypeScript + Babel execution environment and REPL for node

Downloads

4

Readme

TypeScript-Babel Node

This package enables Babel compilation of TypeScript compilation output through a registration function and a Node binary proxy.

Why do I want this?

Because you want ts-node to run async/await code, but TypeScript will only compile async/await to ES6 and Node 5.x doesn't support all of ES6 yet. So you need Babel to bridge that gap.

ts-babel-node wraps ts-node so you can do just that. Run the ts-babel-node executable exactly the same way you'd run ts-node and require ts-babel-node/register instead of ts-node/register.

Installation

Command Line

To use ts-babel-node on the command line, install this package globally. Be sure to include whichever version of TypeScript you want to compile against.

$ npm install --global ts-babel-node typescript babel-core babel-polyfill babel-preset-es2015 ts-node

$ ts-babel-node my-file.ts

Library

To include ts-babel-node as a register function, install this package as a development dependency. Be sure to include whichever version of TypeScript you want to compile against.

$ npm install --save-dev ts-babel-node typescript babel-core babel-polyfill babel-preset-es2015 ts-node

Usage

Command Line

Since ts-babel-node-extendable is a wrapper around ts-node, anything you can do with ts-node works with ts-babel-node-extendable. See ts-node's docs for more details.

Library

ts-babel-node-extendable exposes two APIs. The first is a wrapper around the ts-node API.

// $ node this-file.js

require('ts-babel-node-extendable').register(/* ts-node options, extra babel property for babel options */);
// Or
require('ts-babel-node-extendable/register');

You can also use this with the --require option on node.

$ node --require ts-babel-node/register my-file.ts

The second API only adds the babel-compilation step. This is useful if your code is run from ts-node, as is the case in the gulp scenario.

// $ ts-node this-file.js

require('ts-babel-node-extendable').registerBabel();
// Or
require('ts-babel-node-extendable/register-babel');

Mocha

$ mocha --require ts-babel-node-extendable/register [...args]

Tape

$ ts-babel-node-extendable node_modules/.bin/tape [...args]

Gulp

In your gulpfile.ts (note, .ts, not .js):

import 'ts-babel-node-extendable/register-babel';
// ...

Then use gulp normally. Keep in mind that the babel traspiler won't be active in your gulpfile.ts, but will be running in all your imports.