Skip to content

Commit 8513d16

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 8513d16

File tree

647 files changed

+239966
-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.

647 files changed

+239966
-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: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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: Format
37+
run: cargo fmt --all -- --check
38+
39+
- name: Conformance
40+
run: |
41+
cargo run -p oxc_angular_conformance
42+
git diff --exit-code
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
71+
run: |
72+
pnpm build-dev
73+
pnpm --filter ./napi/angular-compiler build:ts
74+
75+
- name: Lint
76+
run: pnpm check
77+
78+
- name: Test
79+
run: |
80+
pnpm test
81+
pnpm --filter ./napi/angular-compiler exec playwright install --with-deps
82+
pnpm test:e2e
83+
- name: Compare tests
84+
run: pnpm --filter @oxc/angular-compare compare --fixtures

.github/workflows/release.yml

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
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+
- name: Support longpaths
46+
if: ${{ matrix.os == 'windows-latest' }}
47+
run: git config --system core.longpaths true
48+
- uses: actions/checkout@v6
49+
with:
50+
submodules: recursive
51+
52+
- name: Install Rust
53+
uses: dtolnay/rust-toolchain@stable
54+
with:
55+
targets: ${{ matrix.target }}
56+
57+
- name: Cache Rust
58+
uses: Swatinem/rust-cache@v2
59+
60+
- uses: mlugg/setup-zig@v2
61+
if: ${{ contains(matrix.target, 'musl') }}
62+
with:
63+
version: 0.15.2
64+
65+
- name: Install cargo-zigbuild
66+
uses: taiki-e/install-action@v2
67+
if: ${{ contains(matrix.target, 'musl') }}
68+
env:
69+
GITHUB_TOKEN: ${{ github.token }}
70+
with:
71+
tool: cargo-zigbuild
72+
73+
- name: Install pnpm
74+
uses: pnpm/action-setup@v4
75+
76+
- name: Install Node.js
77+
uses: actions/setup-node@v6
78+
with:
79+
node-version: 24
80+
cache: pnpm
81+
82+
- name: Install dependencies
83+
run: pnpm install
84+
85+
- name: Build ${{ matrix.target }}
86+
working-directory: napi/angular-compiler
87+
if: ${{ !contains(matrix.target , 'gnu') && !contains(matrix.target, 'musl') }}
88+
run: pnpm build-dev -- --release --target ${{ matrix.target }}
89+
90+
- name: Build ${{ matrix.target }}
91+
working-directory: napi/angular-compiler
92+
if: ${{ contains(matrix.target , 'gnu') }}
93+
run: pnpm build-dev -- --release --target ${{ matrix.target }} --use-napi-cross
94+
95+
- name: Build ${{ matrix.target }}
96+
working-directory: napi/angular-compiler
97+
if: ${{ contains(matrix.target, 'musl') }}
98+
run: pnpm build-dev -- --release --target ${{ matrix.target }} -x
99+
100+
- name: Upload artifact
101+
uses: actions/upload-artifact@v6
102+
with:
103+
name: bindings-${{ matrix.target }}
104+
path: napi/angular-compiler/*.node
105+
if-no-files-found: error
106+
107+
publish:
108+
name: Publish
109+
permissions:
110+
contents: write
111+
id-token: write
112+
packages: write
113+
runs-on: ubuntu-latest
114+
needs: build
115+
steps:
116+
- uses: actions/checkout@v6
117+
118+
- name: Install pnpm
119+
uses: pnpm/action-setup@v4
120+
121+
- name: Install Node.js
122+
uses: actions/setup-node@v6
123+
with:
124+
node-version: 24
125+
cache: pnpm
126+
127+
- name: Install dependencies
128+
run: pnpm install
129+
130+
- name: Download artifacts
131+
uses: actions/download-artifact@v7
132+
with:
133+
path: napi/angular-compiler/artifacts
134+
135+
- name: Create npm dirs
136+
run: pnpm --filter ./napi/angular-compiler exec napi create-npm-dirs
137+
138+
- name: Move artifacts
139+
run: pnpm --filter ./napi/angular-compiler artifacts
140+
141+
- name: Publish to npm
142+
working-directory: napi/angular-compiler
143+
run: |
144+
echo '@voidzero-dev:registry=https://npm.pkg.github.com/' >> ~/.npmrc
145+
npm install -g npm
146+
npm publish
147+
env:
148+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Rust
2+
target/
3+
**/*.rs.bk
4+
5+
# Wasm
6+
**/*.wasm
7+
8+
# node_modules
9+
node_modules
10+
/napi/*/npm-dir
11+
12+
# Ignore accidental files from the root
13+
/*.js
14+
/*.jsx
15+
/*.ts
16+
/*.tsx
17+
/*.ast.txt
18+
/*.cfg.txt
19+
/*.dot
20+
*.node
21+
/napi/angular-compiler/npm
22+
23+
# Claude Code
24+
.claude
25+
26+
# NOTE: For non-project files such as `.vscode` or `.idea`, please add them to your `.gitignore_global`.
27+
# 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: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"ignorePatterns": [
4+
"/crates/oxc_angular_compiler/angular",
5+
"/crates/angular_conformance/snapshots/angular.snap.md"
6+
],
7+
"singleQuote": true,
8+
"experimentalSortPackageJson": true,
9+
"experimentalSortImports": {
10+
"order": "asc",
11+
"newlinesBetween": true,
12+
"groups": [
13+
["type-import"],
14+
["type-builtin", "value-builtin"],
15+
["type-external", "value-external", "type-internal", "value-internal"],
16+
["type-parent", "type-sibling", "type-index", "value-parent", "value-sibling", "value-index"],
17+
["ts-equals-import"],
18+
["unknown"]
19+
]
20+
},
21+
"semi": false
22+
}

.oxlintrc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"ignorePatterns": [
4+
"/crates/oxc_angular_compiler/angular",
5+
"/napi/angular-compiler/benchmarks",
6+
"/napi/angular-compiler/e2e/compare/src/compilers/angular.ts"
7+
]
8+
}

0 commit comments

Comments
 (0)