Skip to content

Instantly share code, notes, and snippets.

@naruaway
naruaway / webcontainers-demo.ts
Created September 27, 2023 13:38
webcontainers-demo
import { WebContainer } from "@webcontainer/api";
let webcontainerInstance: WebContainer;
const packages = [
{ name: 'react-dom', version: '18.2.0' },
{ name: 'react', version: '18.2.0' },
{ name: 'zod', version: '3.22.2' },
{ name: 'framer-motion', version: '10.16.4' },
@naruaway
naruaway / filetype-detection-in-different-ecosystems.md
Last active January 8, 2022 07:01
Filetype detection in different ecosystems

Filetype detection in different ecosystems

The concept of "file type" is important. For example, a text editor wants to figure out whether the current open file is written in Python or TypeScript to provide file type specific features including something like syntax highlighting.

Many editors / tools are using short identifier to distinguish file types (e.g. javascript, typescriptreact, zsh, python). For example, (probably) the most popular open source text editor, VS Code has a list of "known language identifiers" and closely related, LSP spec is also mentioning "common language identifier". Since VS Code and LSP are popular, I think these language identifiers are considered kind of "standard" and other editors tend to follow them (e.g. [Vim/Neovim is using "typescriptreact" for ".tsx" files](https://