Skip to content

Instantly share code, notes, and snippets.

View lucacasonato's full-sized avatar
🖥️
Programming

Luca Casonato lucacasonato

🖥️
Programming
View GitHub Profile
@lucacasonato
lucacasonato / LICENSE
Created February 24, 2026 14:32
A slug generator for slugs with format `$adjective-$noun-$i`
Copyright 2026 Deno Land Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT
import { CountingGovernor } from "./governor.ts";
const tests: { name: string; fn: () => Promise<void> }[] = [];
function test(name: string, fn: () => Promise<void>) {
tests.push({ name, fn });
}
test("test 1", async () => {
await new Promise((resolve) => setTimeout(resolve, 100));

TypeScript type resolution without probing

Supporting expressing resolution entirely in code

Problem

TypeScript’s module resolution for type definitions currently heavily relies on probing. Some examples of this are how node_modules/ folders are probed for @types/ packages when a bare specifier is imported that does not provide it’s own types, or how importing a file with a .js extension will resolve types to a sibling file with a .d.ts extension instead.

Probing is problematic for us at Deno, because we are unable to perform any kind of probing when importing files using https:// specifiers. This is because it is neither side-effect free to perform probing on https:// (ie it is observable), and it is incredibly slow because of network round trip times. Non Deno TypeScript users have also reported similar issues with probing due to reliance on network file systems (microsoft/TypeScript#11979). Additionally, probing has a performance impact for all users regardl

Meta

Key ID: 808AD7C0F245EA46

Subkeys: 412A10CA3031388A, 141C8B418031A4E6, 01A83EB62563811F

Setup GPG

git config --global user.signingkey 808AD7C0F245EA46
@lucacasonato
lucacasonato / .dprintrc.json
Created March 21, 2021 23:18
dprint config for deno with tabs
{
"$schema": "https://dprint.dev/schemas/v0.json",
"projectType": "openSource",
"incremental": true,
"typescript": {
"deno": true,
"useTabs": true
},
"includes": ["**/*.{ts,tsx,js,jsx}"],
"excludes": ["**/node_modules"],
@lucacasonato
lucacasonato / README.md
Last active May 16, 2025 19:14
FetchEvent polyfill in Deno, with demo

This example demonstrates how to polyfill the "fetch" event in Deno, and gives an example for how this can be used to run Cloudflare Workers in Deno.

To try it locally run the script below, and visit http://0.0.0.0:8080:

$ deno run --allow-net https://gist.githubusercontent.com/lucacasonato/1a30a4fa6ef6c053a93f271675ef93fc/raw/efcdc8e798604e194831830fcb962b50261384b3/example-worker.js
export default "a";
setInterval(() => console.log(import.meta.url), 1000);
@lucacasonato
lucacasonato / all.md
Last active July 18, 2022 15:00
All deno.land/x modules without released versions - will update daily

These are all modules on deno.land/x that do not have released versions. These will break soon, so please create a tag / release.

If you want your module to be removed from the list because your module is not maintained anymore, you can let me know until August 1st 2020. After that time removing modules and versions will not be possible anymore.

We will keep your module around until August 14th. If you do not release a version by then, your module name will be unreserved from you, and anyone will be able to register this name.

@lucacasonato
lucacasonato / Cargo.lock
Created July 18, 2020 20:57
reqwest max http2 connections bug
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "adler"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e"
[[package]]
name = "alloc-no-stdlib"