Skip to content

Commit

Permalink
feat: Merge stc docs into the monorepo (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 authored Sep 21, 2023
1 parent 95e71f0 commit bf242fc
Show file tree
Hide file tree
Showing 69 changed files with 4,049 additions and 139 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# oss-services

Various open-source project services by Dudy.

## Apps (`apps/`)

### `apps/swc-plugins/`

- Homepage: https://plugins.swc.rs

This is a web app that lists all the plugins for the [swc](https://swc.rs) project.

## Docs (`docs.`)

### `docs/stc/`

Documentation for the new TypeScript type checker, written in the Rust programming language.

- HomePage: https://stc.dudy.dev
2 changes: 1 addition & 1 deletion apps/swc-plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev -p 30000",
"dev": "next dev -p 50000",
"build": "next build",
"start": "next start",
"lint": "next lint"
Expand Down
3 changes: 3 additions & 0 deletions docs/stc/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
36 changes: 36 additions & 0 deletions docs/stc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
3 changes: 3 additions & 0 deletions docs/stc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# DevMap

개발자를 위한 로드맵입니다.
15 changes: 15 additions & 0 deletions docs/stc/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
};

const withNextra = require("nextra")({
theme: "nextra-theme-docs",
themeConfig: "./theme.config.js",
flexsearch: {
codeblocks: false,
},
unstable_staticImage: true,
});
module.exports = withNextra(nextConfig);
34 changes: 34 additions & 0 deletions docs/stc/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "stc",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev -p 50001",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@vercel/analytics": "^0.1.5",
"chart.js": "4.1.2",
"chartjs-adapter-date-fns": "3.0.0",
"date-fns": "2.29.3",
"next": "13.0.6",
"nextra": "2.0.1",
"nextra-theme-docs": "2.0.1",
"react": "^18.0.0",
"react-chartjs-2": "5.2.0",
"react-dom": "^18.0.0"
},
"devDependencies": {
"@types/node": "17.0.24",
"@types/react": "18.0.5",
"@types/react-dom": "18.0.1",
"autoprefixer": "^10.4.4",
"eslint": "8.13.0",
"eslint-config-next": "12.1.5",
"postcss": "^8.4.12",
"tailwindcss": "^3.0.24",
"typescript": "4.6.3"
}
}
27 changes: 27 additions & 0 deletions docs/stc/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import "nextra-theme-docs/style.css";

import { Analytics } from "@vercel/analytics/react";
import { NextPage } from "next";
import { AppProps } from "next/app";
import { ReactElement, ReactNode } from "react";

// https://nextjs.org/docs/basic-features/layouts#with-typescript

export type NextPageWithLayout = NextPage & {
getLayout?: (page: ReactElement) => ReactNode;
};

type AppPropsWithLayout = AppProps & {
Component: NextPageWithLayout;
};

export default function Nextra({ Component, pageProps }: AppPropsWithLayout) {
const getLayout = Component.getLayout ?? ((page) => page);

return getLayout(
<>
<Component {...pageProps} />
<Analytics />
</>
);
}
15 changes: 15 additions & 0 deletions docs/stc/pages/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"index": {
"title": "Introduction",
"type": "page",
"hidden": true
},
"docs": {
"title": "Docs",
"type": "page"
},
"blog": {
"title": "Blog",
"type": "page"
}
}
3 changes: 3 additions & 0 deletions docs/stc/pages/blog/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"this-week-in-stc": "Status updates"
}
26 changes: 26 additions & 0 deletions docs/stc/pages/blog/this-week-in-stc/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"frequency-change": "Frequency change",
"week-23": "Week 23",
"week-22": "Week 22",
"week-21": "Week 21",
"week-20": "Week 20",
"week-19": "Week 19",
"week-18": "Week 18",
"week-17": "Week 17",
"week-16": "Week 16",
"week-15": "Week 15",
"week-14": "Week 14",
"week-13": "Week 13",
"week-12": "Week 12",
"week-11": "Week 11",
"week-10": "Week 10",
"week-9": "Week 9",
"week-8": "Week 8",
"week-7": "Week 7",
"week-6": "Week 6",
"week-5": "Week 5",
"week-4": "Week 4",
"week-3": "Week 3",
"week-2": "Week 2",
"week-1": "Week 1"
}
9 changes: 9 additions & 0 deletions docs/stc/pages/blog/this-week-in-stc/frequency-change.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: "Change to the frequency of update posts"
date: 2023/4/23
description: "We are changing weekly blog post to monthly blog post."
author: kdy1
---

We are changing weekly blog post to monthly blog post.
This is because we are going to focus on large tasks, which do not have much progress every week.
72 changes: 72 additions & 0 deletions docs/stc/pages/blog/this-week-in-stc/week-1.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
title: "This week in stc, 1"
date: 2022/11/13
description: "The first status update for stc"
author: kdy1
---

I'm going to provide a weekly update for the status of [stc][].
This is the first post.

---

## TL;DR;

Stats:

```
{
required_error: 5155 => 4463,
matched_error: 4711 => 5421,
extra_error: 1983 => 999,
panic: 103 => 89,
}
```

This is the diff for [the last commit on November, 6](https://github.com/dudykr/stc/blob/c1e5e0949368f26d2453ed7420aea35edc405507/crates/stc_ts_type_checker/tests/tsc-stats.rust-debug) and [the last commit on November, 13](https://github.com/dudykr/stc/blob/b451a2921766755bf94199f38489addd1d692897/crates/stc_ts_type_checker/tests/tsc-stats.rust-debug)

## Contributions

Many people contributed to stc, either by contributing developer time or financially.

![Contributors](/images/this-week-in-stc/1/contributors.png)

This is a screenshot for 1 month because this is the first update.

## Noticeable changes

- [#284](https://github.com/dudykr/stc/pull/284): Make `fix()` shallow.

This improve performance by margin.
`Type` of `stc` has some invariants to make it easier to handle.
One example of the invariants is that a union cannot include a union as an element, because it causes lots of troubles with the pattern matching of Rust.
There's a function named `fix`, which ensures that a type satisfies all of the invariants.
But previously, it was recursive and it was a costly operation.
It's now shallow and it does not recurse into `Union` nor `Intersection`.
Performance gain is noticeable.
The test execution with a x**debug build** previously took 1m 45s, but it now takes 1m 20s.

- [#275](https://github.com/dudykr/stc/pull/275): Determine project structure for LSP.

My plan is to provide a LSP for TypeScript after fixing all type inference bugs.
I want to make it testable, so I tried various structures.
While triage, I found a project structure which is testable.
I decided to use the `examples` directory of cargo to create a LSP binary which can be used for testing.
Basically, this structure allows **using exactly same code** for testing environment and the release build of stc LSP.

Special thanks to Deno because I referred to the structure of Deno lsp a lot.

- [#245](https://github.com/dudykr/stc/pull/245): Update swc.

This is one of the tasks I wanted to do, but postponed due to the time.
Divy helped a lot, and I managed to update swc crates.
This introduced some regressions, but those are all fixed at the moment.

- [#227](https://github.com/dudykr/stc/pull/227): Fix stack overflow of module loader.

This patch fixes the issue which blocked people from trying stc on their own project.
`stc` could verify a huge TypeScript module if it does not have an import, but this patch reduces the restrictions for real-world project further.

---

[stc]: https://github.com/dudykr/stc
45 changes: 45 additions & 0 deletions docs/stc/pages/blog/this-week-in-stc/week-10.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: "This week in stc, 10"
date: 2023/1/22
description: "The status update for stc"
author: kdy1
---

This is the status update for [stc][], the new TypeScript type checker written in Rust.

## TL;DR;

Stats:

```
Stats {
required_error: 4291 => 4248,
matched_error: 5814 => 5826,
extra_error: 1118 => 929,
panic: 29 => 20,
}
```

This is the diff for [the commit used for previous status update](https://github.com/dudykr/stc/blob/fcf2e3c58eca78aa46fdbe4c16435225b9a2a663/crates/stc_ts_type_checker/tests/tsc-stats.rust-debug) and [the last commit on 1/22](https://github.com/dudykr/stc/blob/5442585ceda0487cb40307a24523b0c96d833d8e/crates/stc_ts_type_checker/tests/tsc-stats.rust-debug).
We changed the way we count the number of errors to make it represent the actual progress more closely.

## Contributions

![Contributors](/images/this-week-in-stc/10/contributors.png)

There were lots of Contributions this week.
Thank you!

## Noticable changes

### builtin update ([#528](https://github.com/dudykr/stc/pull/528))

We updated the builtin types to the latest version.

### `csstype` ([#521](https://github.com/dudykr/stc/pull/521))

`stc` now can process `csstype` package without a false positive.

---

[stc]: https://github.com/dudykr/stc
31 changes: 31 additions & 0 deletions docs/stc/pages/blog/this-week-in-stc/week-11.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: "This week in stc, 11"
date: 2023/1/29
description: "The status update for stc"
author: kdy1
---

This is the status update for [stc][], the new TypeScript type checker written in Rust.

## TL;DR;

Stats:

```
Stats {
required_error: 4248 => 4183,
matched_error: 5826 => 5891,
extra_error: 929 => 825,
panic: 20 => 18,
}
```

This is the diff for [the commit used for previous status update](https://github.com/dudykr/stc/blob/5442585ceda0487cb40307a24523b0c96d833d8e/crates/stc_ts_type_checker/tests/tsc-stats.rust-debug) and [the last commit on 1/29](https://github.com/dudykr/stc/blob/14d5ac24b3c4324d6384ae5d207f4fef9e3ae1fb/crates/stc_ts_type_checker/tests/tsc-stats.rust-debug).

## Contributions

![Contributors](/images/this-week-in-stc/11/contributors.png)

Thank you, everyone!

[stc]: https://github.com/dudykr/stc
37 changes: 37 additions & 0 deletions docs/stc/pages/blog/this-week-in-stc/week-12.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: "This week in stc, 12"
date: 2023/2/5
description: "The status update for stc"
author: kdy1
---

This is the status update for [stc][], the new TypeScript type checker written in Rust.

## TL;DR;

Stats:

```
Stats {
Matched: 5891 => 5881,
Bad (required): 4183 => 4193,
Bad (excess): 825 => 714,
Bad (panic): 18,
}
```

This is the diff for [the commit used for previous status update](https://github.com/dudykr/stc/blob/14d5ac24b3c4324d6384ae5d207f4fef9e3ae1fb/crates/stc_ts_type_checker/tests/tsc-stats.rust-debug) and [the last commit on 2/5](https://github.com/dudykr/stc/blob/8ea5b02590550cdd7d1e6cbf53a54bc719be99a2/crates/stc_ts_type_checker/tests/tsc-stats.rust-debug). I took vacation this week, so there was a lot of progress.

## Contributions

![Contributors](/images/this-week-in-stc/12/contributors.png)

There was one contributor this week, but he's a long-term contributor and he contributed a lot of code. Thank you!

## Noticable changes

### Change of the testing strategy

I'm working to split the official conformance test suite from `tsc` into smaller unit tests. Once it's finished, progress will be much faster.

[stc]: https://github.com/dudykr/stc
Loading

0 comments on commit bf242fc

Please sign in to comment.