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
299 changes: 150 additions & 149 deletions .github/workflows/dart.yml

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ pubspec.lock
# Files generated by dart tools.
**/.dart_tool/
**/doc/api/

# melos
# pubspec_overrides.yaml
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/runConfigurations/melos_bootstrap.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/runConfigurations/melos_clean.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions _tests/melos__tests.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Dart Packages" level="project" />
</component>
</module>
33 changes: 16 additions & 17 deletions _tests/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
name: _tests
description: Tests for AngularDart.
publish_to: none
environment:
sdk: '>=2.14.0 <3.0.0'

dependencies:
# No strict dependencies, we always use dependency_overrides.
ngdart:
ngtest:
ngforms:

# Actual valid dependencies required.
build_resolvers: ^2.0.0
Expand All @@ -15,9 +17,6 @@ dependencies:
test: ^1.16.0

dev_dependencies:
# No strict dependencies, we always use dependency_overrides.
ngforms:

# Actual valid dependencies required.
analyzer: ^4.0.0
build_runner: ^2.0.0
Expand All @@ -30,17 +29,17 @@ dev_dependencies:
term_glyph: ^1.2.0

# DO NOT REMOVE. We don't publish this package, it is just for testing.
dependency_overrides:
ngdart:
path: ../ngdart
ngast:
path: ../ngast
ngcompiler:
path: ../ngcompiler
ngforms:
path: ../ngforms
ngrouter:
path: ../ngrouter
ngtest:
path: ../ngtest
analyzer: ^4.0.0
# dependency_overrides:
# ngdart:
# path: ../ngdart
# ngast:
# path: ../ngast
# ngcompiler:
# path: ../ngcompiler
# ngforms:
# path: ../ngforms
# ngrouter:
# path: ../ngrouter
# ngtest:
# path: ../ngtest
# analyzer: ^4.0.0
12 changes: 12 additions & 0 deletions _tests/pubspec_overrides.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# melos_managed_dependency_overrides: ngast,ngcompiler,ngdart,ngforms,ngtest
dependency_overrides:
ngast:
path: ../ngast
ngcompiler:
path: ../ngcompiler
ngdart:
path: ../ngdart
ngforms:
path: ../ngforms
ngtest:
path: ../ngtest
16 changes: 16 additions & 0 deletions examples/hello_world/melos_examples.hello_world.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Dart Packages" level="project" />
</component>
</module>
8 changes: 8 additions & 0 deletions examples/hello_world/pubspec_overrides.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# melos_managed_dependency_overrides: ngdart,ngast,ngcompiler
dependency_overrides:
ngdart:
path: ../../ngdart
ngast:
path: ../../ngast
ngcompiler:
path: ../../ngcompiler
21 changes: 21 additions & 0 deletions melos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: angular
repository: https://github.com/angulardart-community/angular

packages:
- "**"
# - ngast
# - ngcompiler
# - ngdart
# - ngforms
# - ngrouter
# - ngtest

ignore:
# - _tests
- examples
- goldens
- tests

command:
bootstrap:
usePubspecOverrides: true
12 changes: 12 additions & 0 deletions melos_angular.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Dart Packages" level="project" />
</component>
</module>
68 changes: 67 additions & 1 deletion ngast/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,67 @@
See https://github.com/angulardart-community for current updates on this project.
# ngast

<!-- Badges -->

[![Pub Package](https://img.shields.io/pub/v/ngast.svg)](https://pub.dartlang.org/packages/ngast)
[![Build Status](https://img.shields.io/github/workflow/status/angulardart-community/angular/Dart%20CI)](https://github.com/angulardart-community/angular/actions/workflows/dart.yml)
[![Gitter](https://img.shields.io/gitter/room/angulardart/community)](https://gitter.im/angulardart/community)

Parser and utilities for [AngularDart][gh_angular_dart] templates.

[gh_angular_dart]: https://github.com/angulardart-community/angular

## Usage

*Currently in development* and **not stable**.

```dart
import 'package:ngast/ngast.dart';

main() {
// Create an AST tree by parsing an AngularDart template.
var tree = parse('<button [title]="someTitle">Hello</button>');

// Print to console.
print(tree);

// Output:
// [
// ElementAst <button> {
// properties=
// PropertyAst {
// title="ExpressionAst {someTitle}"}
// childNodes=TextAst {Hello}
// }
// }
// ]
}
```

Additional flags can be passed to change the behavior of the parser:

| Data type | Name | Description | Default Value |
|------------|------------|--------------|---------------|
| `String` | _sourceUrl_ | String describing the path of the HTML string. | |
| `bool` | _desugar_ | Enabled desugaring of banana-syntax, star syntax, and pipes. | true |
| `bool` | _parseExpressions_ | Parses Dart expressions raises exceptions if occurred. | true |
| `ExceptionHandler` | _exceptionHandler_ | Switch to 'new RecoveringExceptionHandler()' to enable error recovery. | ThrowingExceptionHandler |

When using RecoveringExceptionHandler, the accumulated exceptions can be
accessed through the RecoveringExceptionHandler object. Refer to the following
example:

```dart
void parse(String content, String sourceUrl) {
var exceptionHandler = new RecoveringExceptionHandler();
var asts = parse(
content,
sourceUrl: sourceUrl,
desugar: false,
parseExpressions: false,
exceptionHandler: exceptionHandler,
);
for (AngularParserException e in exceptionHandler.exceptions) {
// Do something with exception.
}
}
```
File renamed without changes.
16 changes: 16 additions & 0 deletions ngast/melos_ngast.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Dart Packages" level="project" />
</component>
</module>
2 changes: 1 addition & 1 deletion ngast/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: ngast
repository: https://github.com/angulardart-community/angular
description: Parser and utilities for AngularDart templates
version: 2.2.0
version: 2.1.2

environment:
sdk: '>=2.17.0 <3.0.0'
Expand Down
2 changes: 1 addition & 1 deletion ngast/test/ast_cli_tester.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:io';

import 'package:path/path.dart' as p;
import 'package:ngast/angular_ast.dart';
import 'package:ngast/ngast.dart';

RecoveringExceptionHandler exceptionHandler = RecoveringExceptionHandler();

Expand Down
2 changes: 1 addition & 1 deletion ngast/test/cli_tester.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:convert';
import 'dart:io';

import 'package:ngast/angular_ast.dart';
import 'package:ngast/ngast.dart';

RecoveringExceptionHandler exceptionHandler = RecoveringExceptionHandler();
Iterable<NgToken> tokenize(String html) {
Expand Down
2 changes: 1 addition & 1 deletion ngast/test/e2e/e2e_template_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'dart:io';

import 'package:path/path.dart' as p;
import 'package:test/test.dart';
import 'package:ngast/angular_ast.dart';
import 'package:ngast/ngast.dart';

void main() {
var parse = const NgParser().parse;
Expand Down
2 changes: 1 addition & 1 deletion ngast/test/expression/micro/parser_test.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:test/test.dart';
import 'package:ngast/angular_ast.dart';
import 'package:ngast/ngast.dart';
import 'package:ngast/src/expression/micro/ast.dart';
import 'package:ngast/src/expression/micro/parser.dart';

Expand Down
2 changes: 1 addition & 1 deletion ngast/test/lexer_test.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:test/test.dart';
import 'package:ngast/angular_ast.dart';
import 'package:ngast/ngast.dart';

void main() {
// Returns the html parsed as a series of tokens.
Expand Down
2 changes: 1 addition & 1 deletion ngast/test/parser_test.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:test/test.dart';
import 'package:ngast/angular_ast.dart';
import 'package:ngast/ngast.dart';

void main() {
List<StandaloneTemplateAst> parse(String template) {
Expand Down
2 changes: 1 addition & 1 deletion ngast/test/random_generator_test/random_tester.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'dart:io';
import 'dart:math';

import 'package:path/path.dart' as p;
import 'package:ngast/angular_ast.dart';
import 'package:ngast/ngast.dart';
import 'package:ngast/src/token/tokens.dart';

final int generationCount = 10000;
Expand Down
2 changes: 1 addition & 1 deletion ngast/test/recover_errors_lexer_test.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:test/test.dart';
import 'package:ngast/angular_ast.dart';
import 'package:ngast/ngast.dart';
import 'package:ngast/src/parser/reader.dart';
import 'package:ngast/src/scanner.dart';
import 'package:ngast/src/token/tokens.dart';
Expand Down
2 changes: 1 addition & 1 deletion ngast/test/recover_errors_parser_test.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:test/test.dart';
import 'package:ngast/angular_ast.dart';
import 'package:ngast/ngast.dart';

final recoveringExceptionHandler = RecoveringExceptionHandler();

Expand Down
2 changes: 1 addition & 1 deletion ngast/test/visitor_test.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:test/test.dart';
import 'package:ngast/angular_ast.dart';
import 'package:ngast/ngast.dart';

void main() {
// DesugarVisitor is tested by parser_test.dart
Expand Down
2 changes: 1 addition & 1 deletion ngast/test/whitespace_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:ngast/angular_ast.dart';
import 'package:ngast/ngast.dart';
import 'package:test/test.dart';

void main() {
Expand Down
6 changes: 4 additions & 2 deletions ngcompiler/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Tooling for compiling [AngularDart](https://pub.dev/packages/angular).
[![Pub Package](https://img.shields.io/pub/v/ngcompiler.svg)](https://pub.dev/packages/ngcompiler)
[![Build Status](https://img.shields.io/github/workflow/status/angulardart-community/angular/Dart%20CI)](https://github.com/angulardart-community/angular/actions/workflows/dart.yml)
[![Gitter](https://img.shields.io/gitter/room/angulardart/community)](https://gitter.im/angulardart/community)

See https://github.com/angulardart-community for current updates on this project.
Tooling for compiling [AngularDart](https://pub.dev/packages/angular).
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:ngdart/src/meta.dart';
import 'package:ngast/angular_ast.dart' as ast;
import 'package:ngast/ngast.dart' as ast;
import 'package:ngcompiler/v1/angular_compiler.dart';
import 'package:ngcompiler/v1/cli.dart';
import 'package:ngcompiler/v2/context.dart';
Expand Down
Loading