Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw committed Jun 12, 2024
0 parents commit 7019a58
Show file tree
Hide file tree
Showing 16 changed files with 3,027 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Test

on: push

jobs:
build:
name: Test
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
uses: bahmutov/npm-install@v1

- run: npm run tsc
- run: npm run lint
- run: npm run test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# ATA

This was originally based on [Automatic Type Acquisition](https://github.com/microsoft/TypeScript-Website/tree/v2/packages/ata), a subproject
of TypeScript-Website, which powers the TypeScript Playground. What ATA
does is it loads TypeScript types from jsDelivr and figures out `@types/` packages
for imported NPM modules.

When someone types

```ts
import chalk from "npm:chalk";
```

We want to provide them with nice types. That's the intent here.

## Differences from ATA

This is now dramatically different from ATA because Deno is dramatically
different from Node. Here are some of the differences:

- Deno relies heavily on URL (HTTP) imports. TypeScript does not support them at all:
<https://github.com/microsoft/TypeScript/issues/35749>
- Deno references NPM modules using a `npm:` prefix. TypeScript does not support
that at all. It also supports a `jsr:` prefix for JSR imports. TypeScript does not
support that at all.
- Deno requires Node modules be imported using the `node:` prefix. TypeScript does
not make it easy to add that requirement.

Supporting URL imports, the `npm:` and `jsr:` prefixes, the required `node:` prefix,
is very difficult.

## Alternative paths

Deno has a [Deno Language Server](https://github.com/denoland/deno/tree/main/cli/lsp)
which implements all of its workarounds. Unfortunately, it's both written in Rust
and relies on Deno itself. Using it on the frontend would be a total nonstarter - even
if we were to compile it to WASM, it would be tens of megabytes.

We could run the Deno LSP on a server. This would require us to manage a lot of
extra, sandboxed servers.
15 changes: 15 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.1/schema.json",
"organizeImports": {
"enabled": true
},
"formatter": {
"indentStyle": "space"
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
}
}
Loading

0 comments on commit 7019a58

Please sign in to comment.