Bundle-time macros with Bun

#​641 — June 1, 2023

Read on the Web

JavaScript Weekly

JavaScript Macros in Bun — Not content with giving the JavaScript world a brand new bundler, Bun’s Jarred has taken it a bit further: ‘macros’ that run at bundle time with the result being directly inlined into your code. They use stage 3 annotated import statements (so may become regular JS eventually) and Jarred shows off some use cases here.

Jarred Sumner

▶  Discussing the Future of React with Two Core Team Members — As part of the celebrations around React’s 10th birthday, Vercel’s Delba de Oliveira interviewed Andrew Clark and Sebastian Markbåge of the React core team on modern topics including server components, Suspense, Actions, and the next steps React will take.

Delba de Oliveira (Vercel)

URL Validation 101 — with Snyk — Keep script injection and server side request forgery out of your JavaScript applications with Snyk.

Snyk sponsor

Aimless.js: The ‘Missing’ JavaScript Randomness Library — If you’ve been itching for functions to give you random characters, numbers from custom distributions, random sequences, random items, weighted random numbers, or more, this is for you.

Christopher Cavalea

⚡️ IN BRIEF:

???? Two big birthdays in the past week: Node.js turned 14 and React turned 10.

Intel and Google have been working together on the Compute Pressure API which you can use, in origin trial, in Chrome 115. It provides a way to measure the ‘computational strain’ of the system your code is running on to then adjust how your app operates accordingly.

???? Misko Hevery, creator of Angular and now Qwik, was on the Stack Overflow Podcast talking about ▶️ how he’s ‘dehydrating the Web’ in an ongoing quest for higher performance.

‘Deferring Module Evaluation’ is a TC39 proposal for basically being able to lazily load modules which are executed only upon use.

You can now use Node.js built-in modules on Deno Deploy, making it easier to run existing JS apps ‘at the edge’ on their platform.

Tom Preston-Werner, GitHub co-founder and Redwood co-creator, writes about how Redwood is going ‘all in on React Server Components’ and announces the first Redwood conference this September.

SupportsCSS: Feature Detection for Modern CSS — Inspired by Modernizr, this script expands on the capabilities of CSS’s @supports feature by adding classes to your HTML and exposing a results object so you can run custom tests live in the browser.

Stephanie Eckles

????  JSDayIE 2023: The First JavaScript Conference in Ireland Is Back! — Join us on September 26th in Dublin to experience everything the Irish JavaScript community and Ireland have to offer.

JSDayIE sponsor

RELEASES:

Electron 25 – Now offering a Chrome-powered net.fetch (as opposed to Node’s flavor of fetch()).

Neutralinojs 4.12 – Desktop app dev framework.

Parcel 2.9

Bootstrap 5.3.0

node-oracledb 6.0

???? Articles & Tutorials

How to Draw Any Regular Shape with Just One JavaScript Function — Mozilla/MDN has a (relatively) new blog — here they share how to use JavaScript to draw any regular shape to a HTML canvas with a single function, and how to modify it to draw multiple shapes.

Ruth John

Sharing WebSocket Connections between Tabs and Windows — If your users open your app in multiple tabs or windows, being able to share a WebSocket connection could be a lot more efficient both at the client and server end. Is it possible? With SharedWorkers (supported by all major browsers, except Chrome on Android), you can.

Szymon Chmal

▶  How React Works Under The Hood: 2023 Edition — Quite a lot of depth for a mere 13-minutes. Covers React broadly, along with the pros and cons of JSX, how the virtual DOM approach works, plus React’s diffing algorithm.

FrontStart

Connected APM and Infrastructure Monitoring at Up to 1/3rd the Cost of Datadog

New Relic sponsor

Why Does a Farmer Emoji Have a Length of 7 in JS? — This is a nicely accessible introduction to a topic that often causes confusion. Get ready to learn a little about grapheme clusters, scalars, and code units.

Evan Hahn

The Evolution of React APIs and Code Reuse — An exploration of common React patterns, from mixins and higher-order components to render props & hooks.

Rem / Frontend Mastery

▶  ‘I Tried 8 Different Postgres ORMs’ — A modern, fast-paced, and slightly irreverent look at working with Postgres from back-end JavaScript runtimes. (9 minutes.)

Beyond Fireship

Automatically Unsubscribe from RxJS Observables in Angular Components

Rob Bell

Deploying Vanilla Node.js Apps on Fly.io

Sam Ruby (Fly)

Asynchronous JavaScript for Beginners

Daniel Agantem

???? Code & Tools

Svelvet: A Svelte Component Library for Interactive Node-Based Diagrams — You can create flow diagrams using pre-built components with seamless zooming and panning, draggable interactivity, customizable edges/nodes, etc.

Svelvet Team

Inkline 4.0: A Customizable Vue.js 3 UI/UX Library — A design system and numerous customizable components designed for mobile-first (but desktop friendly) and built with accessibility in mind.

Alex Grozav

Handsontable: Data Editor for React — There’s a lot of JS data grids out there, but none quite like Handsontable: Excel-like design, keyboard shortcuts, and React support make it the perfect data editor for web apps.

Handsontable Data Grid sponsor

JECS: An Entity Component System (ECS) for JSEntity component systems are common in game development as they provide a lot of flexibility for managing the many objects present in games.

Stuhl

Color Names: A Gigantic List of Handpicked Color Names — At first, I thought this was just going to be a hundred or so obvious choices like the named colors in HTML (???? rebeccapurple) but it’s actually over 30,000 colors with a fantastic array of names and uses, plus JavaScript functions to work with them.

David Aerne

fastgron: High-Performance JSON to GRON Converter‘gron’ is a transpiled form of JSON into individual assignment operations which makes it easier to grep. (fastgron is itself written in C++.)

Adam Ritter

Orama 1.0.3
↳ In-memory, typo-tolerant, text search engine.

Perspective 2.2
↳ WASM-powered high-perf data visualization component.

Javet 2.2 – Java + V8. Embed JS into Java.

OverlayScrollbars 2.2 – JS custom scrollbar plugin.

html-react-parser 4.0 – HTML to React parser.

Vuetify 3.3.2 – Vue component framework.

React Slider 10.2Demos.

???? Jobs

Find JavaScript Jobs with Hired — Hired makes job hunting easy-instead of chasing recruiters, companies approach you with salary details up front. Create a free profile now.

Hired

????‍???? Got a job listing to share? Here’s how.

????  Live-streaming from JavaScript

JSFiddle: Did You Know You Can Stream on Twitch from JavaScript? — This is an interesting experiment, but I tried it and it worked! Twitch added support for WebRTC ingestion a while ago and this CodePen example ties that together with fewer than 50 lines of JavaScript to send your preferred video source to the popular livestreaming service. It’s hardly OBS, but I imagine someone will rustle up something fancier with this approach in time.

Sean DuBois on JSFiddle

2023 N|Solid Awards: The Top 10 Best Node.js Open Source Projects to Watch

NodeSource has been a part of the Node.js ecosystem since 2014, contributing to the open-source project, distributing binaries (over 100m annually!), providing expert Node Services, and building tooling (N|Solid) to support developers to make the best software leveraging Node.js. Every year, we look at the open-source projects we believe are the most interesting and will impact the ecosystem. This year we decided to recognize each of these projects with an award, so welcome to the first installment of the N|Solid Awards!

As the technology has become more ubiquitous in recent years, the list of Node.js projects and technologies to keep an eye on in 2023 is growing longer. As champions of Node, we are excited to see the creativity of the developers using Node.js and the positive impact the technology has in the world.

Node.js, a JavaScript open-source runtime environment, has become one of the most popular platforms for developing applications. With the rapid rise of Node.js usage, developers are constantly pushing the boundaries of what’s possible with the platform. As a result, many open-source Node.js projects are available for everyone to tinker around with.

“JavaScript is everywhere, including in 98% of the world’s websites. Representing this enormous developer ecosystem is a humbling and awesome responsibility. The work of our maintainers matters, as they keep lavaScript safe and modern for those who depend on it.” – OpenJS Foundation

Before we get to the award winners, here. A quick list of the pros and cons of Node.js:

Pros and Cons of Node.js

The pros of Node.js include the following:

Flexibility – Node.js is designed to be used with many different types of applications;
Speed – Node.js is faster than other server-side languages;
Scalability – Node.js makes it easy to scale applications;
Great ecosystems – Node.js has a large and vibrant community of developers constantly building new libraries and tools;
Async I/O – Node.js is built on the concept of asynchronous I/O, which makes it great for handling multiple requests simultaneously.
Cost savings – Node.js can reduce hosting and maintenance costs.

The cons of Node.js include the following:

Single threading – Node.js is single-threaded, which can limit performance;
Compatibility issues – As Node.js is updated, older versions may not be compatible with newer libraries and frameworks;
Lack of debugging

Skilled professionals like experienced Node.js developers require tools to get their jobs done quickly and effectively. However, it can be challenging to make the right choice from the range of options available. Node.js is known for its strong community that offers many tools. Such additions have been instrumental in contributing to the success of modern apps. To help you narrow down your choices, here are some of the top open-source projects you should keep an eye on.

The Winners of the N|Solid Award for 2023!

Selected for the project’s importance and value and the team’s outstanding effort, here are 10 of the best open-source projects (in no particular order) worth keeping an eye on…

Fastify-vite
Mercurius
Platformatic
Next.js
Prisma
Redwood
Nuxt
Strapi
Herbs.js
PNPM

Fastify-vite

Fastify-Vite is a minimalistic web framework designed to build modern web applications quickly. It supports React and Vue at the moment, which means you can use the same familiar components, lifecycle hooks, and other patterns. With its lightning-fast performance, developers can quickly develop, test, and deploy web applications.

Note: And if you ask, Why is fastify-vite but no vite itself? Because according to our lead engineers, it “is a game-changer in SSR” (And if we wanted to present the top 10, well, we couldn’t go on, to be honest, 😅🤷‍♀️); however, we are fans of the great work done by this project, so here: Vite itself has a special mention in our list.

And if we talk about Vite, then we cannot leave the Fastify ecosystem aside.

Fastify

Fastify is an open-source web framework for Node.js that enables developers to create modern and efficient web applications quickly. It provides a great foundation to build the application logic while abstracting away much of the complexity associated with web development. Fastify has an extensive ecosystem of modules, plug-ins, and tools that can be used to improve the development process. These include web servers, logging, validation, authentication, security, routing, and more. With such a wide range of features, Fastify makes it easy to create secure, reliable, and performant web applications.

Mercurius

Mercurius is a Node. a js-based project focusing on bringing IoT to the edge. It is designed for distributed IoT devices and provides tools for connecting them to cloud services such as Amazon AWS, Microsoft Azure, and Google Cloud Platform. It also supports real-time streaming, analytics, machine learning, and more. Mercurius provides an easy-to-use API that allows developers to quickly and easily interact with their devices. Furthermore, Mercurius is open-source and free to use, making it an ideal choice for developers who want to create innovative IoT solutions.

Platformatic

Platformatic project in Node.js is a powerful and scalable platform that enables businesses to quickly create, deploy, and manage sophisticated customer experiences using the power of AI. Node.js is used to incorporate custom logic into Platformatic’s interactive environment, allowing for a more tailored user experience for customers. Node.js is also used to provide faster performance and improved scalability across the platform, which is essential for powering high-volume customer interactions. With Node.js at its core, Platformatic project in Node.js delivers an efficient, robust, and secure customer experience.

Next.js

Next.js is an open-source project used to build server-side rendered React applications. It is based on the React framework and is a popular choice for developing single-page applications. It is easy to start with Next.js, as it handles the configuration and provides built-in features such as server-side rendering, static site generation, routing, code splitting, and much more. It also enables developers to start building apps quickly and efficiently while providing a range of customization options.

Prisma

Prisma is an open-source project that provides an ORM (Object Relational Mapping) for Node.js applications. It is designed to make it simpler and easier to interact with databases, reduce complexity and pain points in the development process, and help developers quickly build and deploy robust applications. Prisma provides automatic schema management, powerful data modeling, scalability, and high-performance querying.

Redwood

Redwood is a full-stack JavaScript framework for building web, mobile, and desktop applications. It allows you to rapidly use modern technologies like React, Node.js, GraphQL, and TypeScript to create powerful applications with an opinionated yet extensible architecture rapidly. With Redwood, you get the best of both worlds: the robustness and scalability of a full-stack framework and the flexibility and efficiency of a modern JavaScript stack.

Nuxt

Nuxt is an open-source project built on Vue.js and Node.js that provides an easy-to-setup framework for server-side-rendered (Universal) or Single Page Applications (SPA). It supports Vue components and allows developers to create custom projects from scratch or pre-made templates. Nuxt comes with integrated routing, code-splitting, and hot module reloading out of the box and also provides features such as custom layouts, meta tags management, and server middleware.

Strapi

Strapi is an open-source Node.js project that allows developers to create and manage their own API’s with ease. It provides a RESTful API structure and a customizable admin panel that will enable users to manage content and users easily. Additionally, it supports multiple databases and can be easily extended with plug-ins. Strapi provides an intuitive user experience and allows for rapid development of web applications.

Herbs.js

Herbs.js is a Node.js project that helps developers streamline the development process by allowing them to quickly and easily create Node.js applications with the help of various pre-defined tools, libraries, and modules. It provides a wide range of features, such as code syntax highlighting, modular components, integrated debugging and testing, and a streamlined build process. It also offers a convenient command-line interface for creating and managing a Node.js project.

PNPM

PNPM is an advanced package manager for node.js. It is optimized for performance and focuses on being a minimal footprint and making dependency resolution faster by creating a hard link, symlink, or cloning the dependencies into the local project. It also features an automated garbage collection system that detects and removes unnecessary packages. PNPM is designed to create reproducible and reliable builds. It utilizes a deterministic package-lock file to ensure that the same version of all required packages is installed on each machine.

Congratulations to the projects and their teams, you are doing truly incredible work, and we are excited to see what you do throughout the year! If you would like to nominate a project for the N|Solid Award, reach out to our community team at [email protected] and tell us why!

Why Choose N|Solid on top of Node.js?

Companies and developers looking for an enterprise-grade Node.js platform should consider N|Solid due to its superior performance and scalability. N|Solid delivers up to 10x better performance than most other Node.js production platforms and offers a range of tools to help developers scale their applications quickly and easily.

Additionally, N|Solid solves the problem of missing debugging capabilities, offering advanced insights, profiling capabilities, and real-time monitoring with built-in alerting, so developers can quickly identify and fix issues. It also includes a range of additional features, such as progressive deployments, automated patching, secure log data transmission, and more. Read about the top ten features in N|Solid here!

Conclusion

Node.js is a powerful platform that can help you create the project of your dreams. With plenty of open-source projects available, you can find solutions to develop exceptional applications. From the top ten NodeJS open-source projects, you have the opportunity to try out something new or contribute actively.

It is possible to get overwhelmed by all the options, but this is a fantastic opportunity to build and experiment with the tools you need.

Please help us to reach more people and support use cases in Node.js. We care about the Node.js community! Happy to connect with you on

Twitter

LinkedIn,

GitHub.

You’re welcome to explore, read, and participate in the Node.js Project.
We proudly support Node.js Binary Distributions since 2014. 💚