Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
732 changes: 729 additions & 3 deletions crates/oxc_angular_compiler/src/component/transform.rs

Large diffs are not rendered by default.

499 changes: 499 additions & 0 deletions crates/oxc_angular_compiler/tests/integration_test.rs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
source: crates/oxc_angular_compiler/tests/integration_test.rs
expression: result.code
---
import { Component } from '@angular/core';
import { __decorate } from "tslib";

let AppComponent = class AppComponent {
title = 'app';
};
AppComponent = __decorate([
Component({
selector: 'app-root',
template: '<h1>Hello</h1>',
})
], AppComponent);
export { AppComponent };
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
source: crates/oxc_angular_compiler/tests/integration_test.rs
expression: result.code
---
import { Component } from '@angular/core';
import { TitleService } from './title.service';
import { __decorate } from "tslib";

let AppComponent = class AppComponent {
constructor(private titleService: TitleService) {}

static ctorParameters = () => [
{ type: TitleService }
];
};
AppComponent = __decorate([
Component({
selector: 'app-root',
template: '<h1>Hello</h1>',
})
], AppComponent);
export { AppComponent };
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
source: crates/oxc_angular_compiler/tests/integration_test.rs
expression: result.code
---
import { Directive, Input } from '@angular/core';
import { __decorate } from "tslib";

let HighlightDirective = class HighlightDirective {
color: string = 'yellow';

static propDecorators = {
color: [{ type: Input }]
};
};
HighlightDirective = __decorate([
Directive({
selector: '[appHighlight]',
standalone: true,
})
], HighlightDirective);
export { HighlightDirective };
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
source: crates/oxc_angular_compiler/tests/integration_test.rs
expression: result.code
---
import { Component, signal } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { Lib1 } from 'lib1';
import { TitleService } from './title.service';
import { __decorate } from "tslib";
import __NG_CLI_RESOURCE__0 from "angular:jit:template:file;./app.html";
import __NG_CLI_RESOURCE__1 from "angular:jit:style:file;./app.css";

let App = class App {
titleService;
title = signal('app');
constructor(titleService: TitleService) {
this.titleService = titleService;
this.title.set(this.titleService.getTitle());
}

static ctorParameters = () => [
{ type: TitleService }
];
};
App = __decorate([
Component({
selector: 'app-root',
imports: [RouterOutlet, Lib1],
template: __NG_CLI_RESOURCE__0,
styles: [__NG_CLI_RESOURCE__1],
})
], App);
export { App };
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
source: crates/oxc_angular_compiler/tests/integration_test.rs
expression: result.code
---
import { Component } from '@angular/core';
import { __decorate } from "tslib";

let AppComponent = class AppComponent {};
AppComponent = __decorate([
Component({
selector: 'app-root',
template: '<h1>Hello</h1>',
standalone: true,
})
], AppComponent);
export { AppComponent };
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
source: crates/oxc_angular_compiler/tests/integration_test.rs
expression: result.code
---
import { Directive, Input, Output, HostBinding, EventEmitter } from '@angular/core';
import { __decorate } from "tslib";

let HighlightDirective = class HighlightDirective {
color: string = 'yellow';
title: string = '';
colorChange = new EventEmitter<string>();
isActive = false;

static propDecorators = {
color: [{ type: Input }],
title: [{ type: Input, args: ['aliasName'] }],
colorChange: [{ type: Output }],
isActive: [{ type: HostBinding, args: ['class.active'] }]
};
};
HighlightDirective = __decorate([
Directive({
selector: '[appHighlight]',
})
], HighlightDirective);
export { HighlightDirective };
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
source: crates/oxc_angular_compiler/tests/integration_test.rs
expression: result.code
---
import { Component } from '@angular/core';
import { __decorate } from "tslib";
import __NG_CLI_RESOURCE__0 from "angular:jit:style:file;./app.css";

let AppComponent = class AppComponent {};
AppComponent = __decorate([
Component({
selector: 'app-root',
template: '<h1>Hello</h1>',
styles: [__NG_CLI_RESOURCE__0],
})
], AppComponent);
export { AppComponent };
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
source: crates/oxc_angular_compiler/tests/integration_test.rs
expression: result.code
---
import { Component } from '@angular/core';
import { __decorate } from "tslib";
import __NG_CLI_RESOURCE__0 from "angular:jit:template:file;./app.html";

let AppComponent = class AppComponent {};
AppComponent = __decorate([
Component({
selector: 'app-root',
template: __NG_CLI_RESOURCE__0,
standalone: true,
})
], AppComponent);
export { AppComponent };
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
source: crates/oxc_angular_compiler/tests/integration_test.rs
assertion_line: 6360
expression: result.code
---

import { Component } from '@angular/core';
import { ServiceA } from './a.service';
import { ServiceB } from './b.service';
import { ServiceC } from './c.service';
import { __decorate } from "tslib";

let TestComponent = class TestComponent {
constructor(
svcA: undefined | ServiceA,
svcB: null | undefined | ServiceB,
svcC: ServiceC | null,
) {}

static ctorParameters = () => [
{ type: undefined },
{ type: undefined },
{ type: ServiceC }
];
};
TestComponent = __decorate([
Component({ selector: 'test', template: '' })
], TestComponent);
export { TestComponent };
Loading