Publish angel3_route
This commit is contained in:
parent
b0682383da
commit
7c37497860
28 changed files with 161 additions and 93 deletions
11
.gitignore
vendored
11
.gitignore
vendored
|
@ -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
|
||||
|
|
71
packages/.gitignore
vendored
Normal file
71
packages/.gitignore
vendored
Normal 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
|
58
packages/route/.gitignore
vendored
58
packages/route/.gitignore
vendored
|
@ -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
|
|
@ -1,2 +1,12 @@
|
|||
Tobe O <thosakwe@gmail.com>
|
||||
Thomas Hii <thomashii@dukefirehawk.com>
|
||||
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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<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.
|
||||
|
||||
`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.
|
||||
|
||||
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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
library angel_route;
|
||||
library angel3_route;
|
||||
|
||||
export 'src/middleware_pipeline.dart';
|
||||
export 'src/router.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'(^/+)|(/+$)');
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
part of angel_route.src.router;
|
||||
part of angel3_route.src.router;
|
||||
|
||||
class RouteGrammar {
|
||||
static const String notSlashRgx = r'([^/]+)';
|
||||
|
|
|
@ -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<T> {
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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<T> {
|
||||
|
|
|
@ -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].
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
test: ^1.17.4
|
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Reference in a new issue