Publish angel3_route

This commit is contained in:
thomashii@dukefirehawk.com 2021-05-14 15:02:50 +08:00
parent b0682383da
commit 7c37497860
28 changed files with 161 additions and 93 deletions

11
.gitignore vendored
View file

@ -80,11 +80,12 @@ crashlytics-build.properties
fabric.properties fabric.properties
### VSCode template ### VSCode template
.vscode/* .vscode/
!.vscode/settings.json #.vscode/*
!.vscode/tasks.json #!.vscode/settings.json
!.vscode/launch.json #!.vscode/tasks.json
!.vscode/extensions.json #!.vscode/launch.json
#!.vscode/extensions.json
logs/ logs/
*.pem *.pem

71
packages/.gitignore vendored Normal file
View file

@ -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

View file

@ -1,13 +1,32 @@
# See https://www.dartlang.org/tools/private-files.html # See https://www.dartlang.org/tools/private-files.html
# Files and directories created by pub # Files and directories created by pub
.buildlog .dart_tool
.packages .packages
.project
.pub/ .pub/
build/ 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/ **/packages/
# Files created by dart2js # 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 # rules if you intend to use dart2js directly
@ -20,36 +39,17 @@ build/
*.info.json *.info.json
# Directory created by dartdoc # 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) # (Library packages only! Remove pattern if developing an application package)
pubspec.lock
### JetBrains template ### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff: # User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml
# Sensitive or high-churn files: ## VsCode
.idea/dataSources.ids .vscode/
.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
## File-based project format: ## File-based project format:
*.iws *.iws
@ -57,9 +57,8 @@ pubspec.lock
## Plugin-specific files: ## Plugin-specific files:
# IntelliJ # IntelliJ
.idea/
/out/ /out/
# mpeltonen/sbt-idea plugin
.idea_modules/ .idea_modules/
# JIRA plugin # JIRA plugin
@ -70,8 +69,3 @@ com_crashlytics_export_strings.xml
crashlytics.properties crashlytics.properties
crashlytics-build.properties crashlytics-build.properties
fabric.properties fabric.properties
.idea
.dart_tool
*.iml

View file

@ -1,2 +1,12 @@
Tobe O <thosakwe@gmail.com> Primary Authors
Thomas Hii <thomashii@dukefirehawk.com> ===============
* __[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.

View file

@ -1,6 +1,6 @@
MIT License 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 Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View file

@ -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. A powerful, isomorphic routing library for Dart.
This API is a huge improvement over the original [Angel](https://github.com/angel-dart/angel) `angel3_route` exposes a routing system that takes the shape of a tree. This tree structure
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
can be easily navigated, in a fashion somewhat similar to a filesystem. The `Router` API 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 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. 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 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 framework. This includes Web apps, Flutter apps, CLI apps, and smaller servers which do
not need all the features of the Angel framework. not need all the features of the Angel framework.
@ -30,7 +29,7 @@ not need all the features of the Angel framework.
# Examples # Examples
## Routing ## 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. a `Router` in itself.
```dart ```dart
@ -103,10 +102,10 @@ See [the tests](test/route/no_params.dart) for good examples.
# In the Browser # In the Browser
Supports both hashed routes and pushState. The `BrowserRouter` interface exposes Supports both hashed routes and pushState. The `BrowserRouter` interface exposes
a `Stream<RoutingResult> onRoute`, which can be listened to for changes. It will fire `null` a `Stream<RoutingResult> onRoute`, which can be listened to for changes. It will fire `"NULL"`
whenever no route is matched. whenever no route is matched.
`angel_route` will also automatically intercept `<a>` elements and redirect them to `angel3_route` will also automatically intercept `<a>` elements and redirect them to
your routes. your routes.
To prevent this for a given anchor, do any of the following: 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 # Route Parameters
Routes can have parameters, as seen in the above examples. 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) Use `allParams` in a `RoutingResult` to get them as a nice `Map`:
in a `RoutingResult` to get them as a nice `Map`:
```dart ```dart
var router = Router(); var router = Router();

View file

@ -1,6 +1,6 @@
import 'dart:math'; import 'dart:math';
import 'package:angel_route/angel_route.dart'; import 'package:angel3_route/angel3_route.dart';
void main() { void main() {
final router = Router(); final router = Router();

View file

@ -1,4 +1,4 @@
library angel_route; library angel3_route;
export 'src/middleware_pipeline.dart'; export 'src/middleware_pipeline.dart';
export 'src/router.dart'; export 'src/router.dart';

View file

@ -1,9 +1,8 @@
import 'dart:async' show Stream, StreamController; import 'dart:async' show Stream, StreamController;
import 'dart:html'; import 'dart:html';
import 'package:path/path.dart' as p; import 'package:path/path.dart' as p;
import 'angel_route.dart'; import 'angel3_route.dart';
final RegExp _hash = RegExp(r'^#/'); final RegExp _hash = RegExp(r'^#/');
final RegExp _straySlashes = RegExp(r'(^/+)|(/+$)'); final RegExp _straySlashes = RegExp(r'(^/+)|(/+$)');

View file

@ -1,4 +1,4 @@
part of angel_route.src.router; part of angel3_route.src.router;
class RouteGrammar { class RouteGrammar {
static const String notSlashRgx = r'([^/]+)'; static const String notSlashRgx = r'([^/]+)';

View file

@ -1,4 +1,4 @@
part of angel_route.src.router; part of angel3_route.src.router;
/// Represents a virtual location within an application. /// Represents a virtual location within an application.
class Route<T> { class Route<T> {

View file

@ -1,7 +1,7 @@
library angel_route.src.router; library angel3_route.src.router;
import 'dart:async'; import 'dart:async';
import 'package:combinator/combinator.dart'; import 'package:angel3_combinator/angel3_combinator.dart';
import 'package:string_scanner/string_scanner.dart'; import 'package:string_scanner/string_scanner.dart';
import '../string_util.dart'; import '../string_util.dart';

View file

@ -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. /// Represents a complex result of navigating to a path.
class RoutingResult<T> { class RoutingResult<T> {

View file

@ -1,4 +1,4 @@
part of angel_route.src.router; part of angel3_route.src.router;
/// Placeholder [Route] to serve as a symbolic link /// Placeholder [Route] to serve as a symbolic link
/// to a mounted [Router]. /// to a mounted [Router].

View file

@ -1,5 +1,5 @@
/// Helper functions to performantly transform strings, without `RegExp`. /// 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. /// Removes leading and trailing occurrences of a pattern from a string.
String stripStray(String haystack, String needle) { String stripStray(String haystack, String needle) {

View file

@ -1,21 +1,16 @@
name: angel_route name: angel3_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.
version: 5.0.0 version: 5.0.0
homepage: https://github.com/dukefirehawk/angel 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.
publish_to: none homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/route
environment: environment:
sdk: '>=2.12.0 <3.0.0' sdk: '>=2.12.0 <3.0.0'
dependencies: dependencies:
combinator: angel3_combinator: ^2.0.0
# path: ../combinator string_scanner: ^1.1.0
git: path: ^1.8.0
url: https://github.com/dukefirehawk/angel.git
ref: sdk-2.12.x_nnbd
path: packages/combinator
string_scanner: ^1.0.0
dev_dependencies: dev_dependencies:
build_runner: ^1.11.5 build_runner: ^1.12.2
build_web_compilers: ^2.16.4 build_web_compilers: ^2.16.5
http: ^0.13.0 http: ^0.13.3
pedantic: ^1.11.0 pedantic: ^1.11.0
test: ^1.17.3 test: ^1.17.4

View file

@ -1,4 +1,4 @@
import 'package:angel_route/angel_route.dart'; import 'package:angel3_route/angel3_route.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
void main() { void main() {

View file

@ -1,4 +1,4 @@
import 'package:angel_route/angel_route.dart'; import 'package:angel3_route/angel3_route.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
void main() { void main() {

View file

@ -1,4 +1,4 @@
import 'package:angel_route/angel_route.dart'; import 'package:angel3_route/angel3_route.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
void main() { void main() {

View file

@ -1,4 +1,4 @@
import 'package:angel_route/angel_route.dart'; import 'package:angel3_route/angel3_route.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
void main() { void main() {

View file

@ -1,4 +1,4 @@
import 'package:angel_route/angel_route.dart'; import 'package:angel3_route/angel3_route.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
void main() { void main() {

View file

@ -1,6 +1,6 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; 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:http/http.dart' as http;
import 'package:test/test.dart'; import 'package:test/test.dart';

View file

@ -1,4 +1,4 @@
import 'package:angel_route/string_util.dart'; import 'package:angel3_route/string_util.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
void main() { void main() {

View file

@ -1,4 +1,4 @@
import 'package:angel_route/angel_route.dart'; import 'package:angel3_route/angel3_route.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
void main() { void main() {

View file

@ -1,4 +1,4 @@
import 'package:angel_route/angel_route.dart'; import 'package:angel3_route/angel3_route.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
void main() { void main() {

View file

@ -1,4 +1,4 @@
import 'package:angel_route/browser.dart'; import 'package:angel3_route/browser.dart';
import '../shared/basic.dart'; import '../shared/basic.dart';
main() => basic(BrowserRouter(hash: true)); void main() => basic(BrowserRouter(hash: true));

View file

@ -1,4 +1,4 @@
import 'package:angel_route/browser.dart'; import 'package:angel3_route/browser.dart';
import '../shared/basic.dart'; import '../shared/basic.dart';
main() => basic(BrowserRouter()); void main() => basic(BrowserRouter());

View file

@ -1,5 +1,5 @@
import 'dart:html'; import 'dart:html';
import 'package:angel_route/browser.dart'; import 'package:angel3_route/browser.dart';
void basic(BrowserRouter router) { void basic(BrowserRouter router) {
final $h1 = window.document.querySelector('h1'); final $h1 = window.document.querySelector('h1');