diff --git a/.gitignore b/.gitignore index 979f87c8..ec44b7fe 100644 --- a/.gitignore +++ b/.gitignore @@ -80,11 +80,12 @@ crashlytics-build.properties fabric.properties ### VSCode template -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json +.vscode/ +#.vscode/* +#!.vscode/settings.json +#!.vscode/tasks.json +#!.vscode/launch.json +#!.vscode/extensions.json logs/ *.pem diff --git a/packages/.gitignore b/packages/.gitignore new file mode 100644 index 00000000..24d68312 --- /dev/null +++ b/packages/.gitignore @@ -0,0 +1,71 @@ +# See https://www.dartlang.org/tools/private-files.html + +# 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/ + +### Dart template +# See https://www.dartlang.org/tools/private-files.html + +# Files and directories created by pub + +# SDK 1.20 and later (no longer creates packages directories) + +# Older SDK versions +# (Include if the minimum SDK version specified in pubsepc.yaml is earlier than 1.20) +.project +.buildlog +**/packages/ + + +# Files created by dart2js +# (Most Dart developers will use pub build to compile Dart, use/modify these +# rules if you intend to use dart2js directly +# Convention is to use extension '.dart.js' for Dart compiled to Javascript to +# differentiate from explicit Javascript files) +*.dart.js +*.part.js +*.js.deps +*.js.map +*.info.json + +# Directory created by dartdoc + +# Don't commit pubspec lock file +# (Library packages only! Remove pattern if developing an application package) +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff: + +## VsCode +.vscode/ + +## File-based project format: +*.iws + +## Plugin-specific files: + +# IntelliJ +.idea/ +/out/ +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties diff --git a/packages/route/.gitignore b/packages/route/.gitignore index 718b4b01..24d68312 100644 --- a/packages/route/.gitignore +++ b/packages/route/.gitignore @@ -1,15 +1,34 @@ # See https://www.dartlang.org/tools/private-files.html # Files and directories created by pub -.buildlog +.dart_tool .packages -.project .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 template +# See https://www.dartlang.org/tools/private-files.html + +# Files and directories created by pub + +# SDK 1.20 and later (no longer creates packages directories) + +# Older SDK versions +# (Include if the minimum SDK version specified in pubsepc.yaml is earlier than 1.20) +.project +.buildlog **/packages/ + # Files created by dart2js -# (Most Dart developers will use pub build to compile Dart, use/modify these +# (Most Dart developers will use pub build to compile Dart, use/modify these # rules if you intend to use dart2js directly # Convention is to use extension '.dart.js' for Dart compiled to Javascript to # differentiate from explicit Javascript files) @@ -20,36 +39,17 @@ build/ *.info.json # Directory created by dartdoc -doc/api/ -# Don't commit pubspec lock file +# Don't commit pubspec lock file # (Library packages only! Remove pattern if developing an application package) -pubspec.lock ### JetBrains template # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 # User-specific stuff: -.idea/workspace.xml -.idea/tasks.xml -.idea/dictionaries -.idea/vcs.xml -.idea/jsLibraryMappings.xml -# Sensitive or high-churn files: -.idea/dataSources.ids -.idea/dataSources.xml -.idea/dataSources.local.xml -.idea/sqlDataSources.xml -.idea/dynamic.xml -.idea/uiDesigner.xml - -# Gradle: -.idea/gradle.xml -.idea/libraries - -# Mongo Explorer plugin: -.idea/mongoSettings.xml +## VsCode +.vscode/ ## File-based project format: *.iws @@ -57,9 +57,8 @@ pubspec.lock ## Plugin-specific files: # IntelliJ +.idea/ /out/ - -# mpeltonen/sbt-idea plugin .idea_modules/ # JIRA plugin @@ -70,8 +69,3 @@ com_crashlytics_export_strings.xml crashlytics.properties crashlytics-build.properties fabric.properties - - -.idea -.dart_tool -*.iml \ No newline at end of file diff --git a/packages/route/AUTHORS.md b/packages/route/AUTHORS.md index 2a973de6..ac95ab58 100644 --- a/packages/route/AUTHORS.md +++ b/packages/route/AUTHORS.md @@ -1,2 +1,12 @@ -Tobe O -Thomas Hii \ No newline at end of file +Primary Authors +=============== + +* __[Thomas Hii](dukefirehawk.apps@gmail.com)__ + + Thomas is the current maintainer of the code base. He has refactored and migrated the + code base to support NNBD. + +* __[Tobe O](thosakwe@gmail.com)__ + + Tobe has written much of the original code prior to NNBD migration. He has moved on and + is no longer involved with the project. diff --git a/packages/route/LICENSE b/packages/route/LICENSE index 15fe44bd..b593ac86 100644 --- a/packages/route/LICENSE +++ b/packages/route/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2016 The Angel Framework +Copyright (c) 2021 dukefirehawk.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/route/README.md b/packages/route/README.md index 881e4448..c9364e08 100644 --- a/packages/route/README.md +++ b/packages/route/README.md @@ -1,19 +1,18 @@ -# angel_route +# angel3_route +[![version](https://img.shields.io/badge/pub-v2.12.4-brightgreen)](https://pub.dartlang.org/packages/angel3_route) +[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) + +[![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/angel3/route) -[![Pub](https://img.shields.io/pub/v/angel_route.svg)](https://pub.dartlang.org/packages/angel_route) -[![build status](https://travis-ci.org/angel-dart/route.svg)](https://travis-ci.org/angel-dart/route) A powerful, isomorphic routing library for Dart. -This API is a huge improvement over the original [Angel](https://github.com/angel-dart/angel) -routing system, and thus deserves to be its own individual project. - -`angel_route` exposes a routing system that takes the shape of a tree. This tree structure +`angel3_route` exposes a routing system that takes the shape of a tree. This tree structure can be easily navigated, in a fashion somewhat similar to a filesystem. The `Router` API is a very straightforward interface that allows for your code to take a shape similar to the route tree. Users of Laravel and Express will be very happy. -`angel_route` does not require the use of [Angel](https://github.com/angel-dart/angel), +`angel3_route` does not require the use of [Angel](https://github.com/dukefirehawk/angel), and has minimal dependencies. Thus, it can be used in any application, regardless of framework. This includes Web apps, Flutter apps, CLI apps, and smaller servers which do not need all the features of the Angel framework. @@ -30,7 +29,7 @@ not need all the features of the Angel framework. # Examples ## Routing -If you use [Angel](https://github.com/angel-dart/angel), every `Angel` instance is +If you use [Angel](https://github.com/dukefirehawk/angel), every `Angel` instance is a `Router` in itself. ```dart @@ -103,10 +102,10 @@ See [the tests](test/route/no_params.dart) for good examples. # In the Browser Supports both hashed routes and pushState. The `BrowserRouter` interface exposes -a `Stream onRoute`, which can be listened to for changes. It will fire `null` +a `Stream onRoute`, which can be listened to for changes. It will fire `"NULL"` whenever no route is matched. -`angel_route` will also automatically intercept `` elements and redirect them to +`angel3_route` will also automatically intercept `` elements and redirect them to your routes. To prevent this for a given anchor, do any of the following: @@ -135,8 +134,7 @@ For applications where you need to access a chain of handlers, consider using # Route Parameters Routes can have parameters, as seen in the above examples. -Use [allParams](https://www.dartdocs.org/documentation/angel_route/1.0.3/angel_route/RoutingResult-class.html) -in a `RoutingResult` to get them as a nice `Map`: +Use `allParams` in a `RoutingResult` to get them as a nice `Map`: ```dart var router = Router(); diff --git a/packages/route/example/main.dart b/packages/route/example/main.dart index 891dd750..0645dfa2 100644 --- a/packages/route/example/main.dart +++ b/packages/route/example/main.dart @@ -1,6 +1,6 @@ import 'dart:math'; -import 'package:angel_route/angel_route.dart'; +import 'package:angel3_route/angel3_route.dart'; void main() { final router = Router(); diff --git a/packages/route/lib/angel_route.dart b/packages/route/lib/angel3_route.dart similarity index 82% rename from packages/route/lib/angel_route.dart rename to packages/route/lib/angel3_route.dart index 838e6525..fcfc092b 100644 --- a/packages/route/lib/angel_route.dart +++ b/packages/route/lib/angel3_route.dart @@ -1,4 +1,4 @@ -library angel_route; +library angel3_route; export 'src/middleware_pipeline.dart'; export 'src/router.dart'; diff --git a/packages/route/lib/browser.dart b/packages/route/lib/browser.dart index 2ba3844d..d3893867 100644 --- a/packages/route/lib/browser.dart +++ b/packages/route/lib/browser.dart @@ -1,9 +1,8 @@ import 'dart:async' show Stream, StreamController; import 'dart:html'; - import 'package:path/path.dart' as p; -import 'angel_route.dart'; +import 'angel3_route.dart'; final RegExp _hash = RegExp(r'^#/'); final RegExp _straySlashes = RegExp(r'(^/+)|(/+$)'); diff --git a/packages/route/lib/src/grammar.dart b/packages/route/lib/src/grammar.dart index 05c59149..f9c818e3 100644 --- a/packages/route/lib/src/grammar.dart +++ b/packages/route/lib/src/grammar.dart @@ -1,4 +1,4 @@ -part of angel_route.src.router; +part of angel3_route.src.router; class RouteGrammar { static const String notSlashRgx = r'([^/]+)'; diff --git a/packages/route/lib/src/route.dart b/packages/route/lib/src/route.dart index ad014205..225bd479 100644 --- a/packages/route/lib/src/route.dart +++ b/packages/route/lib/src/route.dart @@ -1,4 +1,4 @@ -part of angel_route.src.router; +part of angel3_route.src.router; /// Represents a virtual location within an application. class Route { diff --git a/packages/route/lib/src/router.dart b/packages/route/lib/src/router.dart index a14cbabd..3d38d4c1 100644 --- a/packages/route/lib/src/router.dart +++ b/packages/route/lib/src/router.dart @@ -1,7 +1,7 @@ -library angel_route.src.router; +library angel3_route.src.router; import 'dart:async'; -import 'package:combinator/combinator.dart'; +import 'package:angel3_combinator/angel3_combinator.dart'; import 'package:string_scanner/string_scanner.dart'; import '../string_util.dart'; diff --git a/packages/route/lib/src/routing_result.dart b/packages/route/lib/src/routing_result.dart index 351d235b..7bb7b830 100644 --- a/packages/route/lib/src/routing_result.dart +++ b/packages/route/lib/src/routing_result.dart @@ -1,4 +1,4 @@ -part of angel_route.src.router; +part of angel3_route.src.router; /// Represents a complex result of navigating to a path. class RoutingResult { diff --git a/packages/route/lib/src/symlink_route.dart b/packages/route/lib/src/symlink_route.dart index a52d12de..2ee87201 100644 --- a/packages/route/lib/src/symlink_route.dart +++ b/packages/route/lib/src/symlink_route.dart @@ -1,4 +1,4 @@ -part of angel_route.src.router; +part of angel3_route.src.router; /// Placeholder [Route] to serve as a symbolic link /// to a mounted [Router]. diff --git a/packages/route/lib/string_util.dart b/packages/route/lib/string_util.dart index d09266ad..d8eb2282 100644 --- a/packages/route/lib/string_util.dart +++ b/packages/route/lib/string_util.dart @@ -1,5 +1,5 @@ /// Helper functions to performantly transform strings, without `RegExp`. -library angel_route.string_util; +library angel3_route.string_util; /// Removes leading and trailing occurrences of a pattern from a string. String stripStray(String haystack, String needle) { diff --git a/packages/route/pubspec.yaml b/packages/route/pubspec.yaml index a88b7be6..0f55c7c5 100644 --- a/packages/route/pubspec.yaml +++ b/packages/route/pubspec.yaml @@ -1,21 +1,16 @@ -name: angel_route -description: A powerful, isomorphic routing library for Dart. It is mainly used in the Angel framework, but can be used in Flutter and on the Web. +name: angel3_route version: 5.0.0 -homepage: https://github.com/dukefirehawk/angel -publish_to: none +description: A powerful, isomorphic routing library for Dart. It is mainly used in the Angel framework, but can be used in Flutter and on the Web. +homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/route environment: sdk: '>=2.12.0 <3.0.0' dependencies: - combinator: -# path: ../combinator - git: - url: https://github.com/dukefirehawk/angel.git - ref: sdk-2.12.x_nnbd - path: packages/combinator - string_scanner: ^1.0.0 + angel3_combinator: ^2.0.0 + string_scanner: ^1.1.0 + path: ^1.8.0 dev_dependencies: - build_runner: ^1.11.5 - build_web_compilers: ^2.16.4 - http: ^0.13.0 + build_runner: ^1.12.2 + build_web_compilers: ^2.16.5 + http: ^0.13.3 pedantic: ^1.11.0 - test: ^1.17.3 \ No newline at end of file + test: ^1.17.4 \ No newline at end of file diff --git a/packages/route/test/chain_nest_test.dart b/packages/route/test/chain_nest_test.dart index b4a62ee7..66f2fbad 100644 --- a/packages/route/test/chain_nest_test.dart +++ b/packages/route/test/chain_nest_test.dart @@ -1,4 +1,4 @@ -import 'package:angel_route/angel_route.dart'; +import 'package:angel3_route/angel3_route.dart'; import 'package:test/test.dart'; void main() { diff --git a/packages/route/test/navigate_test.dart b/packages/route/test/navigate_test.dart index 37e29e74..6c321e65 100644 --- a/packages/route/test/navigate_test.dart +++ b/packages/route/test/navigate_test.dart @@ -1,4 +1,4 @@ -import 'package:angel_route/angel_route.dart'; +import 'package:angel3_route/angel3_route.dart'; import 'package:test/test.dart'; void main() { diff --git a/packages/route/test/params_test.dart b/packages/route/test/params_test.dart index d12e80d4..34783de8 100644 --- a/packages/route/test/params_test.dart +++ b/packages/route/test/params_test.dart @@ -1,4 +1,4 @@ -import 'package:angel_route/angel_route.dart'; +import 'package:angel3_route/angel3_route.dart'; import 'package:test/test.dart'; void main() { diff --git a/packages/route/test/parse_test.dart b/packages/route/test/parse_test.dart index baec7da9..12913d14 100644 --- a/packages/route/test/parse_test.dart +++ b/packages/route/test/parse_test.dart @@ -1,4 +1,4 @@ -import 'package:angel_route/angel_route.dart'; +import 'package:angel3_route/angel3_route.dart'; import 'package:test/test.dart'; void main() { diff --git a/packages/route/test/root_test.dart b/packages/route/test/root_test.dart index 96f198ba..e1def74f 100644 --- a/packages/route/test/root_test.dart +++ b/packages/route/test/root_test.dart @@ -1,4 +1,4 @@ -import 'package:angel_route/angel_route.dart'; +import 'package:angel3_route/angel3_route.dart'; import 'package:test/test.dart'; void main() { diff --git a/packages/route/test/server_test.dart b/packages/route/test/server_test.dart index 0a55419d..4588cf43 100644 --- a/packages/route/test/server_test.dart +++ b/packages/route/test/server_test.dart @@ -1,6 +1,6 @@ import 'dart:convert'; import 'dart:io'; -import 'package:angel_route/angel_route.dart'; +import 'package:angel3_route/angel3_route.dart'; import 'package:http/http.dart' as http; import 'package:test/test.dart'; diff --git a/packages/route/test/strip_test.dart b/packages/route/test/strip_test.dart index ad2c058d..7d7c1e71 100644 --- a/packages/route/test/strip_test.dart +++ b/packages/route/test/strip_test.dart @@ -1,4 +1,4 @@ -import 'package:angel_route/string_util.dart'; +import 'package:angel3_route/string_util.dart'; import 'package:test/test.dart'; void main() { diff --git a/packages/route/test/uri_decode_test.dart b/packages/route/test/uri_decode_test.dart index 1e3638e5..e973230a 100644 --- a/packages/route/test/uri_decode_test.dart +++ b/packages/route/test/uri_decode_test.dart @@ -1,4 +1,4 @@ -import 'package:angel_route/angel_route.dart'; +import 'package:angel3_route/angel3_route.dart'; import 'package:test/test.dart'; void main() { diff --git a/packages/route/test/wildcard_test.dart b/packages/route/test/wildcard_test.dart index a49cfcf1..07869c9f 100644 --- a/packages/route/test/wildcard_test.dart +++ b/packages/route/test/wildcard_test.dart @@ -1,4 +1,4 @@ -import 'package:angel_route/angel_route.dart'; +import 'package:angel3_route/angel3_route.dart'; import 'package:test/test.dart'; void main() { diff --git a/packages/route/web/hash/basic.dart b/packages/route/web/hash/basic.dart index c02261de..6d52c9a1 100644 --- a/packages/route/web/hash/basic.dart +++ b/packages/route/web/hash/basic.dart @@ -1,4 +1,4 @@ -import 'package:angel_route/browser.dart'; +import 'package:angel3_route/browser.dart'; import '../shared/basic.dart'; -main() => basic(BrowserRouter(hash: true)); +void main() => basic(BrowserRouter(hash: true)); diff --git a/packages/route/web/push_state/basic.dart b/packages/route/web/push_state/basic.dart index 4f56c6e5..ca2bfca4 100644 --- a/packages/route/web/push_state/basic.dart +++ b/packages/route/web/push_state/basic.dart @@ -1,4 +1,4 @@ -import 'package:angel_route/browser.dart'; +import 'package:angel3_route/browser.dart'; import '../shared/basic.dart'; -main() => basic(BrowserRouter()); +void main() => basic(BrowserRouter()); diff --git a/packages/route/web/shared/basic.dart b/packages/route/web/shared/basic.dart index ff3bbebb..6cb4e174 100644 --- a/packages/route/web/shared/basic.dart +++ b/packages/route/web/shared/basic.dart @@ -1,5 +1,5 @@ import 'dart:html'; -import 'package:angel_route/browser.dart'; +import 'package:angel3_route/browser.dart'; void basic(BrowserRouter router) { final $h1 = window.document.querySelector('h1');