Skip to content

Commit caa8981

Browse files
Brooooooklynclaude
andcommitted
Initial commit: oxc Angular compiler
Standalone Angular compiler built on oxc crates from crates.io v0.110.0 Includes: - crates/oxc_angular_compiler: Core Angular template compiler - napi/angular-compiler: Node.js bindings (@oxc/vite-plugin-angular) - tasks/angular_conformance: Conformance test runner Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
0 parents  commit caa8981

526 files changed

Lines changed: 218790 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cargo/config.toml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[alias]
2+
# Do not append `--` or it will break IDEs
3+
ck = "check --all-features --all-targets --locked"
4+
lint = "clippy --all-targets --all-features"
5+
# Skip `tasks/website` due to linker errors with `oxlint`
6+
codecov = "llvm-cov --workspace --ignore-filename-regex tasks --exclude website"
7+
coverage = "run -p oxc_coverage --profile coverage --"
8+
benchmark = "bench -p oxc_benchmark"
9+
minsize = "run -p oxc_minsize --profile coverage --"
10+
allocs = "run -p oxc_track_memory_allocations --profile coverage --"
11+
rule = "run -p rulegen"
12+
lintgen = "run -p oxc_linter_codegen"
13+
14+
[target.x86_64-pc-windows-msvc]
15+
rustflags = ["-C", "target-feature=+crt-static"]
16+
17+
[target.i686-pc-windows-msvc]
18+
rustflags = ["-C", "target-feature=+crt-static"]
19+
20+
[target.aarch64-pc-windows-msvc]
21+
rustflags = ["-C", "target-feature=+crt-static"]
22+
23+
[target.'cfg(target_os = "windows")']
24+
rustflags = [
25+
# Disables linking against the default Universal C Runtime (libucrt.lib). This prevents conflicts if another CRT library is linked manually.
26+
"-C",
27+
"link-args=/NODEFAULTLIB:libucrt.lib",
28+
# Manually adds ucrt.lib (the Universal CRT) as a default library to link against, replacing the one you just excluded above.
29+
# This ensures consistent linking when multiple CRTs might be available.
30+
"-C",
31+
"link-args=/DEFAULTLIB:ucrt.lib",
32+
]
33+
34+
# LLD linker is currently broken for us, opt out.
35+
# https://blog.rust-lang.org/2025/09/18/Rust-1.90.0/#what-s-in-1-90-0-stable
36+
[target.x86_64-unknown-linux-gnu]
37+
rustflags = ["-C", "linker-features=-lld"]

.clippy.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
avoid-breaking-exported-api = false
2+
3+
ignore-interior-mutability = ["oxc_linter::rules::RuleEnum"]
4+
5+
disallowed-methods = [
6+
{ path = "str::to_ascii_lowercase", reason = "To avoid memory allocation, use `cow_utils::CowUtils::cow_to_ascii_lowercase` instead." },
7+
{ path = "str::to_ascii_uppercase", reason = "To avoid memory allocation, use `cow_utils::CowUtils::cow_to_ascii_uppercase` instead." },
8+
{ path = "str::to_lowercase", reason = "To avoid memory allocation, use `cow_utils::CowUtils::cow_to_lowercase` instead." },
9+
{ path = "str::to_uppercase", reason = "To avoid memory allocation, use `cow_utils::CowUtils::cow_to_uppercase` instead." },
10+
{ path = "str::replace", reason = "To avoid memory allocation, use `cow_utils::CowUtils::cow_replace` instead." },
11+
{ path = "str::replacen", reason = "To avoid memory allocation, use `cow_utils::CowUtils::cow_replacen` instead." },
12+
]
13+
14+
disallowed-types = [
15+
{ path = "std::collections::HashMap", reason = "Use `rustc_hash::FxHashMap` instead, which is typically faster." },
16+
{ path = "std::collections::HashSet", reason = "Use `rustc_hash::FxHashSet` instead, which is typically faster." },
17+
]

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# https://EditorConfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
trim_trailing_whitespace = true
7+
end_of_line = lf
8+
insert_final_newline = true
9+
indent_style = space
10+
indent_size = 2
11+
12+
[*.rs]
13+
indent_size = 4

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
crates/oxc_formatter/tests/fixtures/** text=auto eol=lf
2+
crates/oxc_formatter/tests/fixtures/js/crlf text=auto eol=crlf
3+
apps/oxfmt/test/**/fixtures/** text=auto eol=lf
4+
apps/oxlint/test/fixtures/** text=auto eol=lf

.github/CODE_OF_CONDUCT.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
- Demonstrating empathy and kindness toward other people
21+
- Being respectful of differing opinions, viewpoints, and experiences
22+
- Giving and gracefully accepting constructive feedback
23+
- Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
- Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
- The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
- Trolling, insulting or derogatory comments, and personal or political attacks
33+
- Public or private harassment
34+
- Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
- Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement.
63+
All complaints will be reviewed and investigated promptly and fairly.
64+
65+
All community leaders are obligated to respect the privacy and security of the
66+
reporter of any incident.
67+
68+
## Enforcement Guidelines
69+
70+
Community leaders will follow these Community Impact Guidelines in determining
71+
the consequences for any action they deem in violation of this Code of Conduct:
72+
73+
### 1. Correction
74+
75+
**Community Impact**: Use of inappropriate language or other behavior deemed
76+
unprofessional or unwelcome in the community.
77+
78+
**Consequence**: A private, written warning from community leaders, providing
79+
clarity around the nature of the violation and an explanation of why the
80+
behavior was inappropriate. A public apology may be requested.
81+
82+
### 2. Warning
83+
84+
**Community Impact**: A violation through a single incident or series
85+
of actions.
86+
87+
**Consequence**: A warning with consequences for continued behavior. No
88+
interaction with the people involved, including unsolicited interaction with
89+
those enforcing the Code of Conduct, for a specified period of time. This
90+
includes avoiding interactions in community spaces as well as external channels
91+
like social media. Violating these terms may lead to a temporary or
92+
permanent ban.
93+
94+
### 3. Temporary Ban
95+
96+
**Community Impact**: A serious violation of community standards, including
97+
sustained inappropriate behavior.
98+
99+
**Consequence**: A temporary ban from any sort of interaction or public
100+
communication with the community for a specified period of time. No public or
101+
private interaction with the people involved, including unsolicited interaction
102+
with those enforcing the Code of Conduct, is allowed during this period.
103+
Violating these terms may lead to a permanent ban.
104+
105+
### 4. Permanent Ban
106+
107+
**Community Impact**: Demonstrating a pattern of violation of community
108+
standards, including sustained inappropriate behavior, harassment of an
109+
individual, or aggression toward or disparagement of classes of individuals.
110+
111+
**Consequence**: A permanent ban from any sort of public interaction within
112+
the community.
113+
114+
## Attribution
115+
116+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
117+
version 2.0, available at
118+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
119+
120+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
121+
122+
[homepage]: https://www.contributor-covenant.org
123+
124+
For answers to common questions about this code of conduct, see the FAQ at
125+
https://www.contributor-covenant.org/faq. Translations are available at
126+
https://www.contributor-covenant.org/translations.

.github/SECURITY.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Security Policy
2+
3+
Please refer to https://oxc.rs/docs/contribute/security.html for our established security practices.
4+
5+
## Security contact information
6+
7+
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security).
8+
Tidelift will coordinate the fix and disclosure.

.github/workflows/ci.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
test:
17+
name: Test
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
submodules: recursive
23+
24+
- name: Install Rust
25+
uses: dtolnay/rust-toolchain@stable
26+
27+
- name: Cache Rust
28+
uses: Swatinem/rust-cache@v2
29+
30+
- name: Check
31+
run: cargo check --all-features
32+
33+
- name: Test
34+
run: cargo test -p oxc_angular_compiler
35+
36+
- name: Clippy
37+
run: cargo clippy --all-features -- -D warnings
38+
39+
format:
40+
name: Format
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v4
44+
45+
- name: Install Rust
46+
uses: dtolnay/rust-toolchain@stable
47+
with:
48+
components: rustfmt
49+
50+
- name: Check formatting
51+
run: cargo fmt --all -- --check
52+
53+
conformance:
54+
name: Conformance
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v4
58+
with:
59+
submodules: recursive
60+
61+
- name: Install Rust
62+
uses: dtolnay/rust-toolchain@stable
63+
64+
- name: Cache Rust
65+
uses: Swatinem/rust-cache@v2
66+
67+
- name: Run Conformance
68+
run: cargo run -p oxc_angular_conformance
69+
70+
napi:
71+
name: NAPI Build
72+
runs-on: ubuntu-latest
73+
steps:
74+
- uses: actions/checkout@v4
75+
with:
76+
submodules: recursive
77+
78+
- name: Install Rust
79+
uses: dtolnay/rust-toolchain@stable
80+
81+
- name: Cache Rust
82+
uses: Swatinem/rust-cache@v2
83+
84+
- name: Install pnpm
85+
uses: pnpm/action-setup@v4
86+
87+
- name: Install Node.js
88+
uses: actions/setup-node@v4
89+
with:
90+
node-version: 22
91+
cache: pnpm
92+
93+
- name: Install dependencies
94+
run: pnpm install
95+
96+
- name: Build NAPI
97+
run: pnpm build-dev
98+
99+
- name: Test NAPI
100+
run: pnpm test

0 commit comments

Comments
 (0)