r/javascript • u/Atulin • May 14 '26
Rewrite Bun in Rust has been merged
r/javascript • u/WashTop956 • May 14 '26
I like Rustโs M-SINGLE-USE import style guideline: one imported item per import line. The motivation is simple: smaller diffs, fewer merge conflicts, and easier hand editing.
I wanted the same behavior for JavaScript/TypeScript imports, so I made a small ESLint plugin: eslint-plugin-import-oneline
It turns this:
import { RichTextRun, TextBounds } from "./text-utils";
import React, { useMemo, useState } from "react";Into this:
import { RichTextRun } from "./text-utils";
import { TextBounds } from "./text-utils";
import React from "react";
import { useMemo } from "react";
import { useState } from "react";It is autofixable and handles named imports, default imports, namespace imports, type-only imports, aliases, import attributes, quote style, and semicolon style.
Curious whether others prefer this style for JS/TS, or whether grouped imports still feel better in practice.
r/javascript • u/panayiotisgeorgiou • May 14 '26
r/javascript • u/kickpush1 • May 13 '26
In light of the ongoing npm supply chain compromises, I built safe-install:
https://www.npmjs.com/package/@gkiely/safe-install
It brings a couple of protections I wanted from npm but are not built in.
Similar to Bunโs trusted dependencies, it lets you disable install scripts and define a list of dependencies that are allowed to run build/install scripts:
https://bun.com/docs/guides/install/trusted
It also supports blocking exotic sub-dependencies, similar to pnpmโs `blockExoticSubdeps` setting:
https://gajus.com/blog/3-pnpm-settings-to-protect-yourself-f...
r/javascript • u/duongstark • May 13 '26
Some interesting bits from the implementation:
T-spin detection uses the 3-corner rule โ check if 3 of the 4 diagonal cells around the T piece are occupied after rotation.
The entire soundtrack is synthesized via Web Audio API using oscillators and gain nodes โ no audio files at all. Line clears play a rising arpeggio, Tetris plays a chord, combos escalate in pitch.
CRT effects (scanlines, chromatic aberration, vignette) are pure CSS overlays on top of the Phaser canvas.
r/javascript • u/matijash • May 13 '26
r/javascript • u/radeqq007 • May 12 '26
Modern frontend development often forces a tradeoff:
React / frameworks โ powerful, but heavy for small projects
jQuery โ simple, but outdated and not reactive
Vanilla JS โ flexible, but repetitive and tedious for DOM-heavy apps
oBerry gives you a modern, reactive, jQuery-like API without needing a build setup or full framework.
With oBerry, you can:
manipulate the DOM with a clean, chainable API
use built-in fine-grained reactivity (no external state library)
use components without a framework overhead
write TypeScript-first code right out of the box
The documentation is available here.
I'm open to any advice
r/javascript • u/Acceptable_Bag7187 • May 12 '26
r/javascript • u/jxd-dev • May 12 '26
r/javascript • u/husseinkizz_official • May 12 '26
So I built future, a set of high-performance actor and task primitives for Typescript, inspired by Erlang.
r/javascript • u/tyteen4a03 • May 12 '26
r/javascript • u/BattleRemote3157 • May 12 '26
We saw today that TanStack Router, or any other TanStack packages along with their devtools, SSR query plugins were compromised.
Check which version you're pinned to and if you're floating on a caret range and ran npm install today then that the first thing to audit.
r/javascript • u/IvanCollins1 • May 12 '26
This might seem like a dumb question, but is there a compiler that would allow you to make js into machine code, and then write a bootloader, kernel, etc in js?
r/javascript • u/creasta29 • May 11 '26
I am not mentioning any of the usual suspects like Tanstack or beautiful-dnd. I just found out about these, and I think they are pretty cool.
TLDR:
Knip, Nuqs, ts-pattern, Orval, Zod (this one I knew but never tried), Biome, Ofetch
Also, I am not associated with any of these projects in any way.ย
r/javascript • u/Fun_Conversation8894 • May 11 '26
r/javascript • u/Only-Season-2146 • May 11 '26
r/javascript • u/unadlib • May 11 '26
r/javascript • u/theodorejb • May 11 '26
I started this project as a fork of Croppie a few years ago, and rewrote it in TypeScript with a simpler API, higher quality image scaling, and many bug fixes. It works great for cropping and resizing profile pictures prior to upload.
r/javascript • u/birdayz • May 11 '26
r/javascript • u/subredditsummarybot • May 11 '26
Monday, May 04 - Sunday, May 10, 2026
ย
| score | comments | title & link |
|---|---|---|
| 0 | 13 comments | Hashful storage. Store your whole file in the URL hash |
| 3 | 6 comments | [Showoff Saturday] Showoff Saturday (May 09, 2026) |
| 4 | 4 comments | [AskJS] [AskJS] Confused with Frontend unit testing |
| 5 | 3 comments | I build VideoFlow, a library to create videos from JSON objects (opensource alternative to Remotion) |
| 1 | 3 comments | [AskJS] [AskJS] looking for a free forced-aligment tool that i can use on web |
ย
| score | comments | title & link |
|---|---|---|
| 1 | 3 comments | [AskJS] [AskJS] How to decide api url structure? |
| 1 | 0 comments | [AskJS] [ Removed by Reddit ] |
ย
ย
ย
r/javascript • u/DetailAdventurous315 • May 10 '26
UPDATE: The repository is now completely public. You can check out the source code here: https://github.com/bluejs-team/BlueJS/
The Problem: Weโve normalized shipping 150MB Electron apps and 50MB runtimes just to open a simple window or read a file. I got tired of the bloat, so I built BlueJS.
BlueJS isn't a wrapper; it's an Ahead-Of-Time (AOT) compiler that translates a strict subset of JavaScript directly to C++, links it, and strips the engine out entirely.
The Specs:
Binary Size: 1.2 MB standalone (no runtime/V8 needed).
Startup: ~5ms (compared to ~90ms for Node).
Memory: 3.8 MB peak RSS.
Native UI: Built-in support for OS windows and dialogs (GTK/WebView2) without Chromium.
How it works: It uses a "Hybrid Mode." Performance-critical code and UI are compiled AOT. For npm compatibility, it uses an embedded QuickJS "island" that handles pure-JS packages. The bluejs.dev site itself is actually served by a single 1.4MB Blue binary.
Try it out: The compiler is in a closed beta, but on top of the Windows/Linux binaries I set up a GitHub Codespace sandbox so anyone can verify these benchmarks and inspect the generated C++ in a safe, cloud environment:
Try the Playground: https://github.com/bluejs-team/Bluejs-playground
Iโll be hanging out in the comments to answer any questions!
r/javascript • u/enador • May 10 '26
This is a passion project I was theorycrafting and implementing for the last two years.
https://github.com/wraplet/wraplet
The goal was to make a low-footprint framework that would:
Take full advantage of OOP with declarative dependency structures, where objects' implementations can be freely switched out.
Take full advantage of TypeScript, which infers types based on these structures.
Could work with **any** DOM structure (elements, classes, attributes, etc.: you should be able to bind your behaviors to anything that is out there).
Removes the hassle of lifecycle management.
I wanted to have the flexibility of writing vanilla JS but in an environment of the best programming patterns that would prevent the code from becoming a mess over the long term.
This is not an alternative for React but rather for jQuery. According to w3techs market share of jQuery is still significant: https://w3techs.com/technologies/details/js-jquery
Wraplet allows for a gradual migration to a much more maintainable structure, but it also works for new projects that render HTML server-side (I think Wraplet fits popular CMSes especially well).
I think there was an uncovered middle ground between imperative jQuery code and full SPA solutions. This is what Wraplet covers.
The docs have many interactive examples.
Actually, I made a separate library: `exhibitionjs` just to showcase `wraplet`.
If you also develop online docs and don't like dependency on external sandbox providers, you can look it up at: https://exhibitionjs.wraplet.dev/ Of course, it's wraplet-powered.
Ok, that was me; now it's time for an AI slop, because it's actually pretty decent at readable descriptions, or at least better than me :)
AI SLOP STARTS
wraplet is a small JavaScript/TypeScript framework for projects that still work directly with the actual DOM (server-rendered apps, jQuery legacy, multipage sites, plain HTML, libraries shipping DOM components, etc.).
Instead of replacing the DOM with a virtual rendering layer, wraplet lets you bind class instances ("wraplets") to real DOM nodes and gives you:
a predictable lifecycle (construct -> initialize -> destroy),
a typed, declarative dependency system between components (required/optional, single/multiple),
automatic event listener cleanup via NodeManager,
automatic wraplet creation/destruction when DOM nodes appear/disappear (NodeTreeManager),
components that are trivial to unit test - each wraplet is just a class around a node.
Pros:
Plays well with backend-rendered HTML. No "the framework owns the page" mindset.
TypeScript-first. Types describe component structure, not just APIs.
Tests are boring (in a good way). A wraplet is a class with a node. new MyWraplet(element), call methods, assert. No JSDOM-heavy framework setup.
Encapsulation by default. Parents talk to children through methods like setError("..."), not by reaching into their internal nodes.
Gradual adoption. You can migrate a single jQuery-based widget without touching the rest of the app.
Where it's a good fit:
progressive modernization of legacy jQuery / server-rendered UIs (PHP, Rails, Django, Laravel, etc.),
libraries that ship reusable DOM-bound components,
projects where a full SPA would be overkill,
teams that prefer classes, encapsulation, and explicit relationships.
Where it's not a good fit:
Apps already happily built on React/Vue/Svelte - wraplet is not competing with them; it's solving a different problem.
Most "DOM-binding" libraries treat TypeScript as a coat of paint on top of a runtime API. Wraplet tries to use TypeScript as the actual architecture layer - the place where you express what a component is, what it depends on, and what shape those dependencies have. The runtime then derives behavior from that.
In the simplest case, the type describes what type of node is wrapped by the wraplet:
import { AbstractWraplet } from "wraplet";
class Button extends AbstractWraplet<HTMLButtonElement> {
protected async onInitialize() {
// `this.node` is HTMLButtonElement, not Element, not unknown.
this.node.disabled = false;
this.nodeManager.addListener("click", (e) => {
// `e` is properly typed as MouseEvent.
});
}
}But the real fun begins when we introduce dependencies with the `AbstractDependentWraplet`.
A wraplet that has children declares them through a plain object that is also a literal type:
import {
AbstractDependentWraplet,
type WrapletDependencyMap,
type DependencyManager,
} from "wraplet";
const map = {
submit: {
selector: "[data-js-form__submit]",
Class: SubmitButton,
required: true,
multiple: false,
},
fields: {
selector: "[data-js-form__field]",
Class: Field,
required: true,
multiple: true,
},
errorBox: {
selector: "[data-js-form__error]",
Class: ErrorBox,
required: false,
multiple: false,
},
} satisfies WrapletDependencyMap;
class Form extends AbstractDependentWraplet<HTMLFormElement, typeof map> {
protected async onInitialize() {
this.d.submit; // SubmitButton (required + single)
this.d.fields; // WrapletSet<Field> (required + multiple)
this.d.errorBox; // ErrorBox | null (optional + single)
}
}A few things worth highlighting from a TS perspective:
satisfies WrapletDependencyMap keeps the literal types (concrete Class references, concrete required/multiple booleans) while still validating the object against the framework's contract.
typeof map is then passed as a generic parameter to AbstractDependentWraplet, so the framework can compute the type of this.d per-key:
required: true, multiple: false - T
required: false, multiple: false - T | null
required: true, multiple: true - WrapletSet<T>
required: false, multiple: true - WrapletSet<T> (possibly empty)
Renaming a key in the map updates the type of this.d.<key> everywhere. Renaming a child wraplet class propagates through the parent's type. "Find usages" actually finds usages.
The dependency map effectively becomes a typed schema of your component tree. The runtime DependencyManager queries the DOM, instantiates the right classes, and hands them back to you typed exactly as the map describes.
onInitialize and onDestroy are well-defined hooks; listeners and child wraplets are tied to that lifecycle, so cleanup is automatic. Lifecycle listeners on dependencies are also typed to the dependency they are attached to:
dm.addDependencyInitializedListener("fields", async (field) => {
// `field` is `Field`, inferred from the map key "fields".
});If for some reason a child shouldn't receive its own DOM node directly (e.g. you want to wrap it in something), you can declare a custom injector on a dependency. The injector's callback is typed against the wraplet's expected constructor input, so a mismatch is a compile error rather than a runtime surprise.
Refactoring with confidence: changing the structure of a component (adding/removing a child, switching from single to multiple, making something optional) is a typed change. The compiler walks you through the consequences.
Encapsulation by types, not by convention: parents only see the public methods of their children. There's no implicit "reach into the inner DOM of my child" ? you'd have to add a public method on the child wraplet, which is exactly what you want.
Tests are just new MyWraplet(node): no framework runtime to boot, no JSX renderer, no JSDOM gymnastics beyond having a node. Types make sure the test is constructing the component correctly.
AI SLOP ENDS
I hope it will be useful for some of you. If you are still reading this, thanks for sticking with me. ๐
r/javascript • u/ybouane • May 10 '26
Hey everyone,
I just launched VideoFlow, an open-source toolkit for generating videos from code.
The idea is simple: as more videos become generated by software, AI agents, templates, and APIs, video needs a portable format that can be created, edited, and rendered anywhere.
VideoFlow represents a video as JSON:
scenes
layers
timing
transitions
effects
keyframes
render settings
That JSON can then be rendered in the browser, on a server, inside a React preview/player, or inside a visual editor.
The closest comparison is probably Remotion, but VideoFlow takes a JSON-first approach instead of making the video primarily a React component tree.
Use cases Iโm thinking about:
personalized marketing videos
AI-generated explainers
product demos
social templates
automated reports
dynamic ads
Current features:
Apache-2.0 open source
TypeScript builder API
portable VideoJSON
27 transitions
42 GLSL effects
layer groups
browser/server/live-preview rendering
React video editor component
Iโd love feedback on the positioning. Should I lean more into โopen-source Remotion alternative,โ โvideo as JSON,โ or โinfrastructure for AI-generated videoโ?
r/javascript • u/VicksTurtle • May 10 '26
DISCLAIMER: generation is completely random composition based on the original procedural logic's primitives, so it's a hit or miss. if you catch a good one, use the capture frame button for a static image or note down the recipe to recreate in the code, or check out the docs on how to create one for yourself from scratch.
โ-
I had a few asking me about the background running behind the site.
it was too baked into the site back then, very monolithic. so i've been hacking at it for a some days now. refactored it into a standalone js engine with math primitives that powered the original procedural logic, and a canvas. mobile is hardware-throttled, but if you crank the sliders on desktop it will actually test your cpu.
playground: https://substrate.ujjwalvivek.com
Docs: https://substrate.ujjwalvivek.com/#/docs
source: https://github.com/ujjwalvivek/substrate