All Things Typescript

Share this post

All Things Typescript Newsletter - Issue #17 - Bun is a fast all-in-one JavaScript runtime

www.allthingstypescript.dev

All Things Typescript Newsletter - Issue #17 - Bun is a fast all-in-one JavaScript runtime

Maina Wycliffe
Jul 18, 2022
1
Share this post

All Things Typescript Newsletter - Issue #17 - Bun is a fast all-in-one JavaScript runtime

www.allthingstypescript.dev

Good morning; I hope you had a fantastic weekend. Over the last few days, I have worked on a Visual Studio Code extension named NPM Imported Packages Lens, which shows links to NPM, Github, and Homepage for an imported package in JS and TS files. It also supports React TSX and JSX. Here is the Github repository and the marketplace link to install it. Please try it out and give me any feedback you have to improve. I would love to expand it to Vue and other web frameworks.

On top of that, I spent some playing with Bun - the JS runtime, and I have an overview of it in today’s lesson section. I haven’t done any reviews on technology in the past; let me know if you want more on topics like this.

Thanks for reading All Things Typescript! Subscribe for free to receive new posts and support my work.

I hope you have a great week ahead, and let’s keep on learning.

Bun is a fast all-in-one JavaScript runtime

Bun is a self-contained JavaScript runtime, i.e., unlike NodeJS, which doesn’t handle building/bundling your project, just the runtime part, Bun does it all, from replacing your package manager to building to runtime. The current landscape for web development is very fragmented, and we have seen tools such as Vite try to solve some of these problems.

Bun tries to solve this by being an all-in-one drop-in replacement for your current tools. Replacing everything from your package manager to your bundling tool to your runtime environment for your JS/TS project. You can open any Javascript/Typescript project you have and run Bun install instead of yarn/npm/pnpm install. You can replace all your npm/yarn commands with burn, and they will likely work, including running the scripts file inside the package.json.

Quote

“Bun is a modern JavaScript runtime like Node or Deno. It was built from scratch to focus on three main things:

  • in Start fast (it has the edgemind).

  • New levels of performance (extending JavaScriptCore, the engine).

  • Being a great and complete tool (bundler, transpiler, package manager).”

On top of that, Bun has a few more features:

  • Bult-in support for Fetch and Websockets

  • Supports Typescript and JSX (TSX) out of the box and are transpiled automatically

  • It supports most (if not all) NodeJS API, so your code works out of the box, unlike something like Deno, which would require some rewrite.

  • It supports node_modules, so all packages that work with NodeJS will work with Bun.

  • Automatically loads environment variables from .env; no need for third-party libraries.

  • It’s also very fast ⚡. It is implemented with JavaScriptCore from WebKit and uses Zig programming language for low-level control over memory, performance profiling, and benchmarking over every aspect that contributes to its being fast.

Twitter avatar for @tomarpari90
Pari Tomar 🔊 @tomarpari90
BUN IS INSANE !!! Never seen React JS running fast Tested out #bun today and the results are mind-blowing 🤯🤯🤯🤯 For reference: bun.sh #NodeJS #Bun #Javascript
Image
5:12 PM ∙ Jul 13, 2022

Share


Highlighted Projects

GitHub - mainawycliffe/npm-imported-packages-lens

GitHub - mainawycliffe/npm-imported-packages-lens

Contribute to mainawycliffe/npm-imported-packages-lens development by creating an account on GitHub.

github.com

Articles

TypeScript for Deno

In the previous delivery we saw several data types that TypeScript has and we also saw the custom types that are the union of several types. It is important to mention that you can make “object types”, that is to say, a “custom type” that is an object with a certain structure.

betterprogramming.pub

Understanding the exclamation mark in TypeScript

The exclamation mark ! is known as the non-null assertion operator in TypeScript. We will be using these terms interchangeably in this article. But what does this operator do? The non-null assertion operator tells the TypeScript compiler that a value typed as optional cannot be null or undefined.

blog.logrocket.com

Guide to promises in Node.js

In Node.js applications, it’s not unusual to see a large number of nested callback functions being used to accomplish several activities. This is commonly referred to as callback hell, as it can make the code extremely complicated and disorganized.

blog.logrocket.com

Setup a Monorepo with PNPM workspaces and speed it up with Nx!

In this article we’re going to have a deep dive into setting up a new monorepo using PNPM workspaces that hosts a Remix application as well as a React-based library.

blog.nrwl.io

Building an accessible glossary in vanilla JavaScript

The Kognity solution is written in Vue.js, but as much of its functionality is specific to their platform — and because I’d like to make things as generic as possible for this post — I will be implementing a similar solution in vanilla JavaScript.

blog.logrocket.com

Understanding schema stitching in GraphQL

One of the major benefits of GraphQL is that you can query for all the data you need through one schema. This may assume that most systems are one big monolithic service. However, as the schema grows, it may need to be split into smaller schemas to be maintainable.

blog.logrocket.com

React Hooks: The Deep Cuts

DigitalOcean joining forces with CSS-Tricks! Special welcome offer: get $100 of free credit. Hooks are reusable functions. They allow you to use state and other features (e.g. lifecycle methods and so on) without writing a class.

css-tricks.com

How to Lint Commit Messages with Husky and CommitLint

How many times have you come across a git log that looks like this? More than you’d like, right? We developers have a tendency to become lazy, and not put much effort into things we don’t consider important (which is mostly everything outside of our code).

betterprogramming.pub

Advanced TypeScript With Code Challenges: Intersection Types

TypeScript is awesome! More and more projects use it as the primary programming language. Especially in the area of frontend development, it became essential to build large-scale applications.

javascript.plainenglish.io

Tweets

Twitter avatar for @selbekk
selbekk @selbekk
Using TypeScript's template string types to validate that all relative URLs passed to my fetch abstraction starts with a slash is such a great developer experience! 🤩
const ROOT_URL = "http://localhost:3000";
const get = (relativeUrl: `/${string}`) => { 
  return fetch(ROOT_URL + relativeUrl);
}
get("hello") // errors
get("/hello") // works as expected
7:11 AM ∙ Jul 15, 2022
2,362Likes230Retweets
Twitter avatar for @heyImMapleLeaf
MapleLeaf 🍁 @heyImMapleLeaf
i've dived deep into TS type land and i'm drowning
3:52 PM ∙ Jul 15, 2022
54Likes2Retweets
Twitter avatar for @Enea_Jahollari
Enea Jahollari @Enea_Jahollari
#Angular Dependency Injection Quizz❓ What will be the token value inside div in app component? #javascript #typescript #quizz #js
Image
9:26 AM ∙ Jul 13, 2022
96Likes17Retweets
Twitter avatar for @Loopinfility
Ganesh @Loopinfility
Types of Data Structure #webdeveloper #programming #coding #javascript #programmer #webdeveloper #webdesign #coding #typescript #webdevelopment #100DaysOfCode #100devs #datastructure
Image
1:31 AM ∙ Jul 12, 2022
13Likes19Retweets
Twitter avatar for @EliasBrange
Elias Brange @EliasBrange
Node.js by default creates new TCP connections for every request, adding unneccesary overhead. Re-using connections can speed up your execution times: docs.aws.amazon.com/sdk-for-javasc… #aws #serverless #serverlesstips #nodeJS #TypeScript #javascript
Image
11:10 AM ∙ Jul 7, 2022
57Likes19Retweets
Share this post

All Things Typescript Newsletter - Issue #17 - Bun is a fast all-in-one JavaScript runtime

www.allthingstypescript.dev
Previous
Next
Comments
TopNewCommunity

No posts

Ready for more?

© 2023 Maina Wycliffe
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing