diff --git a/angel_jael/example/main.dart b/angel_jael/example/main.dart index ee902dc1..b77503dc 100644 --- a/angel_jael/example/main.dart +++ b/angel_jael/example/main.dart @@ -19,8 +19,8 @@ main() async { (req, res) => res.render('index', {'title': 'Sample App', 'message': null})); - app.post('/', (RequestContext req, res) async { - var body = await req.parseBody(); + app.post('/', (req, res) async { + var body = await req.parseBody().then((_) => req.bodyAsMap); print('Body: $body'); var msg = body['message'] ?? ''; return await res.render('index', { diff --git a/build_jael/.gitignore b/build_jael/.gitignore deleted file mode 100644 index 69d2288e..00000000 --- a/build_jael/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -# Created by .ignore support plugin (hsz.mobi) -### Dart template -# See https://www.dartlang.org/tools/private-files.html - -# Files and directories created by pub -.packages -.pub/ -build/ -# If you're building an application, you may want to check-in your pubspec.lock -pubspec.lock - -# Directory created by dartdoc -# If you don't generate documentation locally you can remove this line. -doc/api/ -.dart_tool -*.html \ No newline at end of file diff --git a/build_jael/CHANGELOG.md b/build_jael/CHANGELOG.md deleted file mode 100644 index 92642921..00000000 --- a/build_jael/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# 1.0.0 -* Initial version. \ No newline at end of file diff --git a/build_jael/README.md b/build_jael/README.md deleted file mode 100644 index 86b551eb..00000000 --- a/build_jael/README.md +++ /dev/null @@ -1,49 +0,0 @@ -# build_jael -[![Pub](https://img.shields.io/pub/v/build_jael.svg)](https://pub.dartlang.org/packages/build_jael) -[![build status](https://travis-ci.org/angel-dart/jael.svg)](https://travis-ci.org/angel-dart/jael) - - -Compile Jael files to HTML using the power of `package:build`. - -# Installation -In your `pubspec.yaml`: - -```yaml -dependencies: - build_jael: ^1.0.0 -dev_dependencies: - build_runner: ^0.7.0 -``` - -# Usage -You can run `pub run build_runner serve` to incrementally build Jael templates, -and run an HTTP server. - -For further customization, you'll need to either modify the `build.yaml` or -instantiate a `JaelBuilder` manually. - -## Defining Variables -Pass variables as `config` in `build.yaml`: - -```yaml -targets: - $default: - builders: - build_jael: - config: - foo: bar - baz: quux - one: 1.0 -``` - -## Minifying HTML -Pass `minify: true` in the build configuration to produce "minified" HTML, -without newlines or whitespace (other than where it is required). - -## Strict Variable Resolution -By default, identifiers pointing to non-existent symbols return `null`. -To disable this and throw an error when an undefined symbol is referenced, -set `strict: true` in `build.yaml`. - -To apply additional transforms to parsed documents, provide a -set of `patch` functions, like in `package:jael_preprocessor`. \ No newline at end of file diff --git a/build_jael/build.yaml b/build_jael/build.yaml deleted file mode 100644 index 11d18ba1..00000000 --- a/build_jael/build.yaml +++ /dev/null @@ -1,18 +0,0 @@ -builders: - jael: - target: "build_jael" - import: "package:build_jael/build_jael.dart" - builder_factories: - - jaelBuilder - auto_apply: root_package - build_extensions: - .jl: - - ".html" - required_inputs: - - ".jl" -targets: - $default: - sources: - - "**.jl" - - "*.jl" - - "**/*.jl" \ No newline at end of file diff --git a/build_jael/example/hello.jl b/build_jael/example/hello.jl deleted file mode 100644 index be935f82..00000000 --- a/build_jael/example/hello.jl +++ /dev/null @@ -1,12 +0,0 @@ - - - - Hello, world! - - -

Hello!

- - - \ No newline at end of file diff --git a/build_jael/lib/build_jael.dart b/build_jael/lib/build_jael.dart deleted file mode 100644 index 0e93052e..00000000 --- a/build_jael/lib/build_jael.dart +++ /dev/null @@ -1,76 +0,0 @@ -import 'dart:async'; -import 'package:build/build.dart'; -import 'package:code_buffer/code_buffer.dart'; -import 'package:file/file.dart'; -import 'package:jael/jael.dart' as jael; -import 'package:jael_preprocessor/jael_preprocessor.dart' as jael; -import 'package:symbol_table/symbol_table.dart'; - -Builder jaelBuilder(BuilderOptions options) => new JaelBuilder(options); - -class JaelBuilder implements Builder { - final BuilderOptions options; - final List patch; - - const JaelBuilder(this.options, {this.patch: const []}); - - @override - Map> get buildExtensions { - return { - '.jl': ['.html'], - }; - } - - @override - Future build(BuildStep buildStep) async { - CodeBuffer buf; - - if (options.config['minify'] == true) - buf = new CodeBuffer(space: '', newline: '', trailingNewline: false); - else - buf = new CodeBuffer(); - - Directory dir; - - var errors = []; - - var doc = await jael.parseDocument( - await buildStep.readAsString(buildStep.inputId), - sourceUrl: buildStep.inputId.uri, - onError: errors.add, - ); - - doc = await jael.resolve( - doc, - dir, - onError: errors.add, - patch: this.patch, - ); - - if (errors.isNotEmpty) { - jael.Renderer.errorDocument(errors, buf); - } else { - var scope = new SymbolTable(values: new Map.from(options.config)); - - try { - const jael.Renderer().render( - doc, - buf, - scope, - strictResolution: options.config['strict'] == true, - ); - } on jael.JaelError catch (e) { - errors.add(e); - } - - if (errors.isNotEmpty) { - jael.Renderer.errorDocument(errors, buf); - } - } - - buildStep.writeAsString( - buildStep.inputId.changeExtension('.html'), - buf.toString(), - ); - } -} diff --git a/build_jael/pubspec.yaml b/build_jael/pubspec.yaml deleted file mode 100644 index 8bc6a6ef..00000000 --- a/build_jael/pubspec.yaml +++ /dev/null @@ -1,17 +0,0 @@ -name: build_jael -version: 1.0.0 -description: Compile Jael files to HTML using the power of `package:build`. -author: Tobe O -homepage: https://github.com/angel-dart/jael/tree/master/build_jael -environment: - sdk: ">=1.19.0 <=2.0.0" -dependencies: - build: ^0.12.0 - build_config: ^0.2.0 - code_buffer: ^1.0.0 - file: ^2.0.0 - jael: ^1.0.0-alpha - jael_preprocessor: ^1.0.0-alpha - symbol_table: ^1.0.0 -dev_dependencies: - build_runner: ^0.7.0 \ No newline at end of file diff --git a/dsx/.gitignore b/dsx/.gitignore deleted file mode 100644 index 76fd6986..00000000 --- a/dsx/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -# Created by .ignore support plugin (hsz.mobi) -### Dart template -# See https://www.dartlang.org/guides/libraries/private-files - -# Files and directories created by pub -.dart_tool/ -.packages -.pub/ -build/ -# If you're building an application, you may want to check-in your pubspec.lock -pubspec.lock - -# Directory created by dartdoc -# If you don't generate documentation locally you can remove this line. -doc/api/ - diff --git a/dsx/dsx.iml b/dsx/dsx.iml deleted file mode 100644 index 0854fb6e..00000000 --- a/dsx/dsx.iml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dsx/lib/dsx.dart b/dsx/lib/dsx.dart deleted file mode 100644 index bdf0126d..00000000 --- a/dsx/lib/dsx.dart +++ /dev/null @@ -1,7 +0,0 @@ -class DSX { - final String template; - final String templateUrl; - final bool asDSX; - - DSX({this.template, this.templateUrl, this.asDSX: true}); -} diff --git a/dsx/pubspec.yaml b/dsx/pubspec.yaml deleted file mode 100644 index 42820096..00000000 --- a/dsx/pubspec.yaml +++ /dev/null @@ -1 +0,0 @@ -name: dsx \ No newline at end of file diff --git a/dsx_generator/.gitignore b/dsx_generator/.gitignore deleted file mode 100644 index 76fd6986..00000000 --- a/dsx_generator/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -# Created by .ignore support plugin (hsz.mobi) -### Dart template -# See https://www.dartlang.org/guides/libraries/private-files - -# Files and directories created by pub -.dart_tool/ -.packages -.pub/ -build/ -# If you're building an application, you may want to check-in your pubspec.lock -pubspec.lock - -# Directory created by dartdoc -# If you don't generate documentation locally you can remove this line. -doc/api/ - diff --git a/dsx_generator/dsx_generator.iml b/dsx_generator/dsx_generator.iml deleted file mode 100644 index ae9af975..00000000 --- a/dsx_generator/dsx_generator.iml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/dsx_generator/lib/src/generator.dart b/dsx_generator/lib/src/generator.dart deleted file mode 100644 index bd3fc518..00000000 --- a/dsx_generator/lib/src/generator.dart +++ /dev/null @@ -1,38 +0,0 @@ -import 'dart:async'; -import 'package:analyzer/dart/element/element.dart'; -import 'package:build/build.dart'; -import 'package:build/src/builder/build_step.dart'; -import 'package:code_builder/code_builder.dart'; -import 'package:dsx/dsx.dart'; -import 'package:jael/jael.dart' as jael; -import 'package:path/path.dart' as p; -import 'package:source_gen/source_gen.dart'; - -class DSXGenerator extends GeneratorForAnnotation { - @override - FutureOr generateForAnnotatedElement( - Element element, ConstantReader annotation, BuildStep buildStep) async { - var asset = buildStep.inputId; - var template = annotation.peek('template')?.stringValue, - templateUrl = annotation.peek('templateUrl')?.stringValue; - Library lib; - - if (template != null) { - lib = generateForDocument( - jael.parseDocument(template, sourceUrl: asset.uri), element); - } else if (templateUrl != null) { - var id = - new AssetId(asset.package, p.relative(templateUrl, from: asset.path)); - lib = generateForDocument( - jael.parseDocument(await buildStep.readAsString(id), - sourceUrl: asset.uri), - element); - } else { - throw '@DSX() cannot be called without a `template` or `templateUrl`.'; - } - - return lib.accept(new DartEmitter()).toString(); - } - - Library generateForDocument(jael.Document document, ClassElement clazz) {} -} diff --git a/dsx_generator/lib/src/parser.dart b/dsx_generator/lib/src/parser.dart deleted file mode 100644 index e69de29b..00000000 diff --git a/dsx_generator/pubspec.yaml b/dsx_generator/pubspec.yaml deleted file mode 100644 index b4913554..00000000 --- a/dsx_generator/pubspec.yaml +++ /dev/null @@ -1,10 +0,0 @@ -name: dsx_generator -dependencies: - build_config: ^0.3.0 - code_builder: ^3.0.0 - dsx: - path: ../dsx - jael: ^1.0.0 - recase: ^1.0.0 - string_scanner: ^1.0.0 - source_gen: ^0.8.0 \ No newline at end of file