You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+136Lines changed: 136 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,6 +98,142 @@ pnpm test
98
98
99
99
Always run `just ready` as the last step after code has been committed to the repository.
100
100
101
+
## 🚀 Running Example Applications
102
+
103
+
The repository includes numerous example applications in the `examples/` directories of various crates. These examples demonstrate how to use different parts of the Oxc toolchain and serve as practical learning resources.
104
+
105
+
### Quick Start
106
+
107
+
Most examples follow this pattern:
108
+
```bash
109
+
# Create a test file (many examples default to "test.js")
110
+
echo"console.log('Hello, World!');"> test.js
111
+
112
+
# Run an example
113
+
cargo run -p <package_name> --example <example_name> [filename] [options]
114
+
```
115
+
116
+
### Available Examples by Category
117
+
118
+
#### Parser Examples (`oxc_parser`)
119
+
```bash
120
+
# Basic JavaScript/TypeScript parsing with AST display
121
+
cargo run -p oxc_parser --example parser [filename] [--ast] [--estree] [--comments]
122
+
123
+
# TypeScript JSX parsing demonstration
124
+
cargo run -p oxc_parser --example parser_tsx
125
+
126
+
# Regular expression parsing within JavaScript
127
+
cargo run -p oxc_parser --example regular_expression
128
+
129
+
# AST visitor pattern demonstration
130
+
cargo run -p oxc_parser --example visitor [filename]
131
+
```
132
+
133
+
#### Linter Examples (`oxc_linter`)
134
+
```bash
135
+
# Simple linter with basic rules (debugger detection, empty destructuring)
136
+
cargo run -p oxc_linter --example linter [filename]
137
+
```
138
+
139
+
#### Semantic Analysis Examples (`oxc_semantic`)
140
+
```bash
141
+
# Control flow graph generation and analysis
142
+
cargo run -p oxc_semantic --example cfg [filename]
143
+
144
+
# Semantic analysis with symbol information
145
+
cargo run -p oxc_semantic --example semantic [filename] [--symbols]
146
+
```
147
+
148
+
#### Code Generation Examples (`oxc_codegen`)
149
+
```bash
150
+
# Code generation from AST
151
+
cargo run -p oxc_codegen --example codegen [filename] [--minify] [--twice]
152
+
153
+
# Source map generation
154
+
cargo run -p oxc_codegen --example sourcemap [filename]
155
+
```
156
+
157
+
#### Transformer Examples (`oxc_transformer`)
158
+
```bash
159
+
# Code transformation with Babel compatibility
160
+
cargo run -p oxc_transformer --example transformer [filename] [options]
0 commit comments