Skip to content

Commit 19d8317

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 19d8317

File tree

656 files changed

+296864
-0
lines changed

Some content is hidden

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

656 files changed

+296864
-0
lines changed

.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"]

.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/workflows/ci.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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@v6
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
35+
36+
- name: Conformance
37+
run: |
38+
cargo run -p oxc_angular_conformance
39+
git diff --exit-code
40+
41+
- name: Format
42+
run: cargo fmt --all -- --check
43+
44+
napi:
45+
name: NAPI Build
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@v6
49+
with:
50+
submodules: recursive
51+
52+
- name: Install Rust
53+
uses: dtolnay/rust-toolchain@stable
54+
55+
- name: Cache Rust
56+
uses: Swatinem/rust-cache@v2
57+
58+
- name: Install pnpm
59+
uses: pnpm/action-setup@v4
60+
61+
- name: Install Node.js
62+
uses: actions/setup-node@v6
63+
with:
64+
node-version: 24
65+
cache: pnpm
66+
67+
- name: Install dependencies
68+
run: pnpm install
69+
70+
- name: Build NAPI
71+
run: pnpm build-dev
72+
73+
- name: Test NAPI
74+
run: pnpm test

.github/workflows/release.yml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions: {}
9+
10+
env:
11+
DEBUG: "napi:*"
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
build:
19+
name: Build - ${{ matrix.target }}
20+
permissions:
21+
contents: read
22+
runs-on: ${{ matrix.os }}
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
include:
27+
- target: x86_64-unknown-linux-gnu
28+
os: ubuntu-latest
29+
- target: x86_64-unknown-linux-musl
30+
os: ubuntu-latest
31+
- target: aarch64-unknown-linux-gnu
32+
os: ubuntu-latest
33+
- target: aarch64-unknown-linux-musl
34+
os: ubuntu-latest
35+
- target: x86_64-apple-darwin
36+
os: macos-latest
37+
- target: aarch64-apple-darwin
38+
os: macos-latest
39+
- target: x86_64-pc-windows-msvc
40+
os: windows-latest
41+
- target: aarch64-pc-windows-msvc
42+
os: windows-latest
43+
44+
steps:
45+
- uses: actions/checkout@v4
46+
with:
47+
submodules: recursive
48+
49+
- name: Install Rust
50+
uses: dtolnay/rust-toolchain@stable
51+
with:
52+
targets: ${{ matrix.target }}
53+
54+
- name: Cache Rust
55+
uses: Swatinem/rust-cache@v2
56+
57+
- uses: mlugg/setup-zig@v2
58+
if: ${{ contains(matrix.target, 'musl') }}
59+
with:
60+
version: 0.15.2
61+
62+
- name: Install cargo-zigbuild
63+
uses: taiki-e/install-action@v2
64+
if: ${{ contains(matrix.target, 'musl') }}
65+
env:
66+
GITHUB_TOKEN: ${{ github.token }}
67+
with:
68+
tool: cargo-zigbuild
69+
70+
- name: Install pnpm
71+
uses: pnpm/action-setup@v4
72+
73+
- name: Install Node.js
74+
uses: actions/setup-node@v4
75+
with:
76+
node-version: 24
77+
cache: pnpm
78+
79+
- name: Install dependencies
80+
run: pnpm install
81+
82+
- name: Build ${{ matrix.target }}
83+
working-directory: napi/angular-compiler
84+
if: ${{ !contains(matrix.target , 'gnu') && !contains(matrix.target, 'musl') }}
85+
run: pnpm build-dev -- --release --target ${{ matrix.target }}
86+
87+
- name: Build ${{ matrix.target }}
88+
working-directory: napi/angular-compiler
89+
if: ${{ contains(matrix.target , 'gnu') }}
90+
run: pnpm build-dev -- --release --target ${{ matrix.target }} --use-napi-cross
91+
92+
- name: Build ${{ matrix.target }}
93+
working-directory: napi/angular-compiler
94+
if: ${{ contains(matrix.target, 'musl') }}
95+
run: pnpm build-dev -- --release --target ${{ matrix.target }} -x
96+
97+
- name: Upload artifact
98+
uses: actions/upload-artifact@v6
99+
with:
100+
name: bindings-${{ matrix.target }}
101+
path: napi/angular-compiler/*.node
102+
if-no-files-found: error
103+
104+
publish:
105+
name: Publish
106+
permissions:
107+
contents: write
108+
id-token: write
109+
packages: write
110+
runs-on: ubuntu-latest
111+
needs: build
112+
steps:
113+
- uses: actions/checkout@v4
114+
115+
- name: Install pnpm
116+
uses: pnpm/action-setup@v4
117+
118+
- name: Install Node.js
119+
uses: actions/setup-node@v6
120+
with:
121+
node-version: 24
122+
cache: pnpm
123+
124+
- name: Install dependencies
125+
run: pnpm install
126+
127+
- name: Download artifacts
128+
uses: actions/download-artifact@v7
129+
with:
130+
path: napi/angular-compiler
131+
132+
- name: Create npm dirs
133+
run: pnpm --filter ./napi/angular-compiler exec napi create-npm-dirs
134+
135+
- name: Move artifacts
136+
run: pnpm --filter ./napi/angular-compiler artifacts
137+
138+
- name: Publish to npm
139+
working-directory: napi/angular-compiler
140+
run: |
141+
echo '@voidzero-dev:registry=https://npm.pkg.github.com/' >> ~/.npmrc
142+
npm install -g npm
143+
npm publish
144+
env:
145+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Rust
2+
target/
3+
**/*.rs.bk
4+
5+
# Wasm
6+
**/*.wasm
7+
8+
# node_modules
9+
/node_modules/
10+
/napi/*/node_modules/
11+
/napi/*/npm-dir
12+
13+
# Ignore accidental files from the root
14+
/*.js
15+
/*.jsx
16+
/*.ts
17+
/*.tsx
18+
/*.ast.txt
19+
/*.cfg.txt
20+
/*.dot
21+
*.node
22+
/napi/angular-compiler/npm
23+
24+
# Claude Code
25+
.claude
26+
27+
# NOTE: For non-project files such as `.vscode` or `.idea`, please add them to your `.gitignore_global`.
28+
# In `.gitconfig`, add `[core] excludesfile = ~/.gitignore_global`

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "crates/oxc_angular_compiler/angular"]
2+
path = crates/oxc_angular_compiler/angular
3+
url = https://github.com/angular/angular.git

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
24.12.0

.oxfmtrc.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"ignorePatterns": ["/crates/oxc_angular_compiler/angular"],
4+
"singleQuote": true,
5+
"experimentalSortPackageJson": true,
6+
"experimentalSortImports": {
7+
"order": "asc",
8+
"newlinesBetween": true,
9+
"groups": [
10+
["type-import"],
11+
["type-builtin", "value-builtin"],
12+
["type-external", "value-external", "type-internal", "value-internal"],
13+
["type-parent", "type-sibling", "type-index", "value-parent", "value-sibling", "value-index"],
14+
["ts-equals-import"],
15+
["unknown"]
16+
]
17+
},
18+
"trailingComma": "all",
19+
"semi": false
20+
}

.rustfmt.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
style_edition = "2024"
2+
# Make Rust more readable given most people have wide screens nowadays.
3+
# This is also the setting used by [rustc](https://github.com/rust-lang/rust/blob/master/rustfmt.toml)
4+
use_small_heuristics = "Max"
5+
6+
# Use field initialize shorthand if possible
7+
use_field_init_shorthand = true
8+
9+
reorder_modules = true
10+
11+
# All unstable features that we wish for
12+
# unstable_features = true
13+
# Provide a cleaner impl order
14+
# reorder_impl_items = true
15+
# Provide a cleaner import sort order
16+
# group_imports = "StdExternalCrate"
17+
# Group "use" statements by crate
18+
# imports_granularity = "Crate"

0 commit comments

Comments
 (0)