remove undeveloped pkgs
This commit is contained in:
parent
7322b660c4
commit
b4a63ac701
17 changed files with 2 additions and 310 deletions
|
@ -19,8 +19,8 @@ main() async {
|
||||||
(req, res) =>
|
(req, res) =>
|
||||||
res.render('index', {'title': 'Sample App', 'message': null}));
|
res.render('index', {'title': 'Sample App', 'message': null}));
|
||||||
|
|
||||||
app.post('/', (RequestContext req, res) async {
|
app.post('/', (req, res) async {
|
||||||
var body = await req.parseBody();
|
var body = await req.parseBody().then((_) => req.bodyAsMap);
|
||||||
print('Body: $body');
|
print('Body: $body');
|
||||||
var msg = body['message'] ?? '<unknown>';
|
var msg = body['message'] ?? '<unknown>';
|
||||||
return await res.render('index', {
|
return await res.render('index', {
|
||||||
|
|
16
build_jael/.gitignore
vendored
16
build_jael/.gitignore
vendored
|
@ -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
|
|
|
@ -1,2 +0,0 @@
|
||||||
# 1.0.0
|
|
||||||
* Initial version.
|
|
|
@ -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`.
|
|
|
@ -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"
|
|
|
@ -1,12 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Hello, world!</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Hello!</h1>
|
|
||||||
<script>
|
|
||||||
window.alert('Welcome to Jael!');
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -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<jael.Patcher> patch;
|
|
||||||
|
|
||||||
const JaelBuilder(this.options, {this.patch: const []});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Map<String, List<String>> 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 = <jael.JaelError>[];
|
|
||||||
|
|
||||||
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(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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 <thosakwe@gmail.com>
|
|
||||||
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
|
|
16
dsx/.gitignore
vendored
16
dsx/.gitignore
vendored
|
@ -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/
|
|
||||||
|
|
15
dsx/dsx.iml
15
dsx/dsx.iml
|
@ -1,15 +0,0 @@
|
||||||
<?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$">
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.pub" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
<orderEntry type="library" name="Dart SDK" level="project" />
|
|
||||||
<orderEntry type="library" name="Dart Packages" level="project" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
|
@ -1,7 +0,0 @@
|
||||||
class DSX {
|
|
||||||
final String template;
|
|
||||||
final String templateUrl;
|
|
||||||
final bool asDSX;
|
|
||||||
|
|
||||||
DSX({this.template, this.templateUrl, this.asDSX: true});
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
name: dsx
|
|
16
dsx_generator/.gitignore
vendored
16
dsx_generator/.gitignore
vendored
|
@ -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/
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="JAVA_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
||||||
<exclude-output />
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.pub" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
<orderEntry type="library" name="Dart SDK" level="project" />
|
|
||||||
<orderEntry type="library" name="Dart Packages" level="project" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
|
@ -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<DSX> {
|
|
||||||
@override
|
|
||||||
FutureOr<String> 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) {}
|
|
||||||
}
|
|
|
@ -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
|
|
Loading…
Reference in a new issue