Skip to content

Commit 0041456

Browse files
authored
feat(spec): add documentation for continuations (#114)
1 parent 811f6b7 commit 0041456

23 files changed

+9924
-542
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ jobs:
3737
run: yarn run lint
3838

3939
- name: Build project
40-
run: yarn run build
40+
run: yarn run build:all

cspell.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
3+
"version": "0.2",
4+
"language": "en",
5+
"dictionaryDefinitions": [
6+
{
7+
"name": "main-list",
8+
"path": "./spec/spell/cspell-list.txt"
9+
},
10+
{
11+
"name": "fift-words",
12+
"path": "./spec/spell/cspell-fift-words-adjusted.txt"
13+
},
14+
{
15+
"name": "tvm-instructions",
16+
"path": "./spec/spell/cspell-tvm-instructions.txt"
17+
}
18+
],
19+
"dictionaries": ["main-list", "fift-words", "tvm-instructions"],
20+
"ignoreRegExpList": [
21+
"\\(#.*?\\)",
22+
"^\\[.+?\\]: .+$", // link declarations like [foo]: /ref/stdlib-ownable#bar
23+
"\\[#.+?\\]", // [#nativereserve-combining-modes-with-flags]
24+
"\\{#.+?\\}", // {#some-other-custom-heading-link}
25+
"href=\".+?\"", // href="/cookbook/dexes/stonfi"
26+
"\".+?\": \".+?\"", // "from": "kQBrSAP2y7QIUw4_1q0qciHfqdFmOYR9CC1oinn7kyWWRuoV"
27+
"Urls"
28+
],
29+
"flagWords": [],
30+
"ignorePaths": ["*.boc", "*.fif", "node_modules", "dist", "out"]
31+
}

eslint.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ export default tseslint.config(
1616
ignores: [
1717
"dist",
1818
"src/polyfills.ts",
19+
"src/env.d.ts",
20+
"spec/src/env.d.ts",
21+
"spec/src/content/config.ts",
22+
"spec/.astro/**/*",
1923
"src/features/godbolt/lib/func/func-wasm/func-compile.ts",
2024
"src/features/godbolt/lib/func/func-wasm/funcfiftlib.d.ts",
2125
".test-project/",

package.json

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,21 @@
77
"scripts": {
88
"dev": "vite --port 5174",
99
"build": "tsc -b && vite build",
10+
"build:all": "yarn build && yarn astro:build",
1011
"lint": "eslint . --cache",
1112
"preview": "vite preview",
12-
"deploy": "gh-pages -d dist",
13+
"deploy": "gh-pages -d dist --nojekyll",
1314
"fmt": "prettier --write -l --cache .",
1415
"fmt:check": "prettier --check --cache .",
1516
"test": "vitest",
1617
"test:ui": "vitest --ui",
1718
"test:e2e": "yarn playwright test",
1819
"coverage": "vitest run --coverage",
19-
"precommit": "yarn fmt && yarn lint --fix && yarn build"
20+
"precommit": "yarn fmt && yarn lint --fix && yarn build",
21+
"spell": "cspell --no-progress spec/src/content/docs",
22+
"astro:dev": "cd spec && astro dev",
23+
"astro:clean": "rm -rf dist/spec/doc out/ .astro/",
24+
"astro:build": "yarn astro:clean && cd spec && yarn spell && astro check && astro build"
2025
},
2126
"dependencies": {
2227
"@monaco-editor/react": "^4.7.0",
@@ -30,6 +35,7 @@
3035
"@xyflow/react": "^12.3.2",
3136
"allotment": "^1.20.4",
3237
"buffer": "^6.0.3",
38+
"cspell": "^9.2.1",
3339
"framer-motion": "^12.11.0",
3440
"monaco-editor": "^0.52.2",
3541
"react": "^19.1.0",
@@ -42,6 +48,10 @@
4248
"txtracer-core": "^0.2.0"
4349
},
4450
"devDependencies": {
51+
"@astrojs/check": "0.9.4",
52+
"@astrojs/markdown-remark": "5.3.0",
53+
"@astrojs/react": "^4.3.0",
54+
"@astrojs/starlight": "0.29.3",
4555
"@eslint/js": "^9.25.0",
4656
"@playwright/test": "^1.52.0",
4757
"@testing-library/jest-dom": "^6.6.3",
@@ -52,6 +62,7 @@
5262
"@types/ws": "^8.5.10",
5363
"@vitejs/plugin-react": "^4.4.1",
5464
"@vitest/ui": "^3.1.3",
65+
"astro": "4.16.18",
5566
"eslint": "^9.25.0",
5667
"eslint-config-prettier": "^10.1.5",
5768
"eslint-import-resolver-typescript": "^4.3.4",
@@ -67,7 +78,14 @@
6778
"jsdom": "^26.1.0",
6879
"playwright": "^1.52.0",
6980
"prettier": "3.4.2",
81+
"rehype-autolink-headings": "7.1.0",
82+
"remark": "^15.0.1",
83+
"remark-custom-heading-id": "2.0.0",
7084
"rollup-plugin-visualizer": "^6.0.3",
85+
"sharp": "0.32.6",
86+
"starlight-links-validator": "^0.12.1",
87+
"starlight-llms-txt": "^0.5.0",
88+
"starlight-theme-rapide": "^0.2.1",
7189
"ts-node": "^10.9.1",
7290
"typescript": "~5.8.3",
7391
"typescript-eslint": "^8.30.1",

spec/astro.config.mjs

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
// @ts-check
2+
import {defineConfig} from "astro/config"
3+
import starlight from "@astrojs/starlight"
4+
import starlightThemeRapide from "starlight-theme-rapide"
5+
import {ExpressiveCodeTheme} from "@astrojs/starlight/expressive-code"
6+
import fs from "node:fs"
7+
8+
import remarkHeadingId from "remark-custom-heading-id"
9+
10+
import {rehypeHeadingIds} from "@astrojs/markdown-remark"
11+
import rehypeAutolinkHeadings from "rehype-autolink-headings"
12+
import starlightLinksValidator from "starlight-links-validator"
13+
14+
import react from "@astrojs/react"
15+
16+
// https://astro.build/config
17+
// https://starlight.astro.build/reference/configuration/
18+
export default defineConfig({
19+
outDir: "../dist/spec/doc",
20+
site: "https://txtracer.ton.org",
21+
base: "/spec/doc/",
22+
trailingSlash: "always",
23+
vite: {
24+
define: {
25+
global: "globalThis",
26+
},
27+
optimizeDeps: {
28+
include: ["buffer", "@ton/core", "@ton/crypto"],
29+
exclude: ["@ton/tolk-js", "@ton/sandbox"],
30+
},
31+
resolve: {
32+
alias: {
33+
buffer: "buffer",
34+
},
35+
},
36+
server: {
37+
fs: {
38+
allow: [".."],
39+
},
40+
},
41+
build: {
42+
rollupOptions: {
43+
output: {
44+
manualChunks: {
45+
"tolk-runtime": ["@ton/tolk-js", "@ton/sandbox"],
46+
},
47+
},
48+
},
49+
},
50+
},
51+
markdown: {
52+
remarkPlugins: [remarkHeadingId],
53+
rehypePlugins: [
54+
rehypeHeadingIds,
55+
[
56+
rehypeAutolinkHeadings,
57+
{
58+
behavior: "append",
59+
properties: {
60+
class: "autolink-header",
61+
ariaHidden: "true",
62+
ariaLabel: "Link to this header",
63+
tabIndex: -1,
64+
},
65+
},
66+
],
67+
],
68+
},
69+
integrations: [
70+
starlight({
71+
title: {
72+
en: "TVM Internals",
73+
},
74+
titleDelimiter: undefined,
75+
favicon: "/favicon.ico",
76+
logo: {
77+
dark: "/public/logo-dark.svg",
78+
light: "/public/logo-light.svg",
79+
alt: "TVM Internals",
80+
replacesTitle: false,
81+
},
82+
// 'head' is auto-populated with SEO-friendly contents based on the page frontmatters
83+
head: [
84+
// {
85+
// // Google tag (gtag.js)
86+
// tag: "script",
87+
// attrs: {
88+
// async: true,
89+
// src: "TODO: Add google analytics link",
90+
// },
91+
// },
92+
// {
93+
// // Per-page Google tag setup
94+
// tag: "script",
95+
// content:
96+
// "window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments)}gtag('js',new Date());gtag('config','G-ZJ3GZHJ0Z5');",
97+
// },
98+
],
99+
social: {
100+
github: "https://github.com/ton-blockchain/txtracer",
101+
telegram: "https://t.me/toncore",
102+
},
103+
editLink: {
104+
baseUrl: "https://github.com/ton-blockchain/txtracer/edit/main/spec/src/content/docs/",
105+
},
106+
tableOfContents: {minHeadingLevel: 2, maxHeadingLevel: 4},
107+
expressiveCode: {
108+
themes: [
109+
"one-dark-pro",
110+
ExpressiveCodeTheme.fromJSONString(
111+
fs.readFileSync(new URL(`./themes/one-light-mod.jsonc`, import.meta.url), "utf-8"),
112+
),
113+
],
114+
useStarlightDarkModeSwitch: true,
115+
useStarlightUiThemeColors: true,
116+
shiki: {
117+
langs: [
118+
() => JSON.parse(fs.readFileSync("grammars/grammar-func.json", "utf-8")),
119+
() => JSON.parse(fs.readFileSync("grammars/grammar-tolk.json", "utf-8")),
120+
() => JSON.parse(fs.readFileSync("grammars/grammar-tlb.json", "utf-8")),
121+
() => JSON.parse(fs.readFileSync("grammars/grammar-tasm.json", "utf-8")),
122+
],
123+
},
124+
},
125+
customCss: [
126+
// To adjust Starlight colors and styles
127+
"./src/starlight.custom.css",
128+
],
129+
plugins: [
130+
starlightThemeRapide(),
131+
starlightLinksValidator({
132+
errorOnFallbackPages: false,
133+
errorOnInvalidHashes: false,
134+
}),
135+
],
136+
credits: false,
137+
lastUpdated: true,
138+
disable404Route: false,
139+
// Note that UI translations are bundled by Starlight for many languages:
140+
// https://starlight.astro.build/guides/i18n/#translate-starlights-ui
141+
//
142+
// To use fallback content and translation notices provided by Starlight,
143+
// files across language folders must be named the same!
144+
defaultLocale: "root",
145+
locales: {
146+
root: {
147+
label: "English",
148+
lang: "en",
149+
},
150+
},
151+
sidebar: [
152+
{
153+
label: "Book",
154+
items: [
155+
{slug: "book/basics-register-c0-cc-savelist-if-instruction"},
156+
{slug: "book/diving-deeper-exit-points-of-continuations"},
157+
{slug: "book/manual-handling-and-jmp-vs-execute"},
158+
],
159+
},
160+
],
161+
}),
162+
react(),
163+
],
164+
redirects: {
165+
"/": "/spec/doc/book/basics-register-c0-cc-savelist-if-instruction/",
166+
},
167+
})

0 commit comments

Comments
 (0)