Skip to content

Instantly share code, notes, and snippets.

View bartlomieju's full-sized avatar
🦕

Bartek Iwańczuk bartlomieju

🦕
View GitHub Profile
@bartlomieju
bartlomieju / http_comparison.md
Created April 11, 2026 15:08
Deno vs Node.js node:http implementation differences - exhaustive comparison

Deno vs Node.js node:http Implementation Differences

Summary of Critical/High-Risk Issues

  1. _http_outgoing.ts line 996: toLowerCasee() typo -- CRITICAL. Breaks uniqueHeaders feature entirely.
  2. _http_outgoing.ts: write() does not set kNeedDrain -- HIGH. Backpressure/drain events broken.
  3. _http_outgoing.ts: addTrailers() not implemented -- HIGH. Throws on use.
  4. _http_outgoing.ts: Cookie header joining missing -- HIGH. Multiple cookie values sent as separate headers.
  5. _http_outgoing.ts: _removedConnection forces close -- HIGH. Connection always closed when default headers removed.
  6. _http_server.js: Missing requestTimeout/headersTimeout -- HIGH. No slow-loris protection.
@bartlomieju
bartlomieju / gist:7b5af287b4cc395677f9d0d8fafe5d19
Last active April 8, 2026 09:32
Investigation: Why vue-tsc ignores .vue files under Deno (denoland/deno#30977)

Why vue-tsc ignores .vue files under Deno

Investigation of denoland/deno#30977

Summary

vue-tsc -b under Deno silently ignores .vue files because Deno's CJS require system bypasses fs.readFileSync, which @volar/typescript relies on to inject its TypeScript compiler patches.

Should Deno Have a Global Config File?

Bun's Global Config

Bun uses bunfig.toml (TOML format) with a two-tier system:

Local Global
File bunfig.toml (project root) $HOME/.bunfig.toml or $XDG_CONFIG_HOME/.bunfig.toml
Dot prefix No Yes
@bartlomieju
bartlomieju / gist:bdc1ef45bd9bba24dc4ed082555092b6
Created March 13, 2026 13:26
Investigation: Deno issue #15176 - Resolving promises in beforeunload event
# Investigation: Deno Issue #15176 — Resolving Promises in `beforeunload` Event
## The Problem
```js
await new Promise(resolve => {
window.onbeforeunload = resolve;
});
```

What is a Dev Server?

A dev server is a local HTTP server optimized for the development loop. Its job is to serve your application locally with features that make iteration fast.

Core Features

  • Hot Module Replacement (HMR) — when you save a file, only the changed module is swapped in the browser without a full page reload. State (like form inputs, scroll position) is preserved.
  • On-demand transformation — instead of bundling everything upfront, modules are transformed (TypeScript → JS, JSX → JS, etc.) only when the browser requests them. This makes startup near-instant even for large projects.
  • File watching — monitors the filesystem and triggers rebuilds/HMR updates.
  • Error overlay — compilation errors are shown directly in the browser.

Issue #26142: Worker blob URL race condition — Analysis & Fix Plan

The Bug

URL.revokeObjectURL() after new Worker(blobURL) causes intermittent "Module not found" errors because blob content is fetched asynchronously on the worker thread, not during construction.

Works in Chrome/Firefox. Fails in Deno.

Race Condition

@bartlomieju
bartlomieju / worker-idle-fix-architecture.md
Created March 9, 2026 22:30
Architecture: Fix node:worker_threads idle termination (denoland/deno#23169)

Fix: node:worker_threads Worker Idle Termination (denoland/deno#23169)

Problem

Workers created with node:worker_threads are terminated when idle, even if they have ref'd transferable objects like MessagePort or SharedArrayBuffer that should keep them alive.

Root Cause: Two Competing Keepalive Systems

There are two independent keepalive decision systems, and that's the root problem:

/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./src/base.ts":
/*!*********************!*\
!*** ./src/base.ts ***!
\*********************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
addEventListener("fetch", (event) => {
new ArrayBuffer(1 << 30);
});
addEventListener("fetch", (event) => {
while (true) {}
});