From 4a352796892a23fee521a1a63dbc3a66542f9f2e Mon Sep 17 00:00:00 2001 From: Craig Morten <46491566+asos-craigmorten@users.noreply.github.com> Date: Tue, 16 Jun 2020 17:34:25 +0100 Subject: [PATCH] [NO-ISSUE] master -> main (#9) * feat: master -> main --- .github/API/application.md | 12 +- .github/API/middlewares.md | 8 +- .github/API/opine.md | 4 +- .github/API/request.md | 4 +- .github/API/router.md | 4 +- .github/CHANGELOG.md | 4 + .github/CONTRIBUTING.md | 6 +- .github/workflows/benchmark.yml | 4 +- .github/workflows/test.yml | 4 +- README.md | 16 +- docs/classes/_response_.response.html | 84 +++++----- docs/index.html | 22 +-- docs/interfaces/_types_.application.html | 124 +++++++-------- docs/interfaces/_types_.byterange.html | 4 +- docs/interfaces/_types_.handler.html | 2 +- docs/interfaces/_types_.iroute.html | 54 +++---- docs/interfaces/_types_.irouter.html | 74 ++++----- docs/interfaces/_types_.irouterhandler.html | 4 +- docs/interfaces/_types_.iroutermatcher.html | 6 +- docs/interfaces/_types_.mediatype.html | 8 +- docs/interfaces/_types_.nextfunction.html | 4 +- docs/interfaces/_types_.opine.html | 128 +++++++-------- docs/interfaces/_types_.request.html | 148 +++++++++--------- docs/interfaces/_types_.requesthandler.html | 2 +- docs/interfaces/_types_.response.html | 112 ++++++------- docs/interfaces/_types_.router.html | 76 ++++----- .../interfaces/_types_.routerconstructor.html | 78 ++++----- docs/interfaces/_types_.routeroptions.html | 6 +- docs/modules/_application_.html | 8 +- docs/modules/_methods_.html | 2 +- .../_middleware_bodyparser_getcharset_.html | 2 +- .../modules/_middleware_bodyparser_json_.html | 10 +- docs/modules/_middleware_bodyparser_raw_.html | 2 +- .../modules/_middleware_bodyparser_read_.html | 6 +- .../modules/_middleware_bodyparser_text_.html | 2 +- .../_middleware_bodyparser_typechecker_.html | 2 +- .../_middleware_bodyparser_urlencoded_.html | 2 +- docs/modules/_middleware_init_.html | 6 +- docs/modules/_middleware_query_.html | 2 +- docs/modules/_middleware_servestatic_.html | 10 +- docs/modules/_opine_.html | 4 +- docs/modules/_request_.html | 2 +- docs/modules/_router_index_.html | 22 +-- docs/modules/_router_layer_.html | 4 +- docs/modules/_router_route_.html | 2 +- docs/modules/_types_.html | 24 +-- docs/modules/_utils_compileetag_.html | 8 +- docs/modules/_utils_contentdisposition_.html | 2 +- docs/modules/_utils_definegetter_.html | 2 +- docs/modules/_utils_etag_.html | 8 +- docs/modules/_utils_finalhandler_.html | 22 +-- docs/modules/_utils_fresh_.html | 8 +- docs/modules/_utils_merge_.html | 2 +- docs/modules/_utils_mergedescriptors_.html | 4 +- docs/modules/_utils_normalizetype_.html | 6 +- docs/modules/_utils_parseurl_.html | 8 +- docs/modules/_utils_pathtoregex_.html | 10 +- docs/modules/_utils_stringify_.html | 2 +- examples/assigned-port/README.md | 2 +- examples/assigned-port/index.ts | 2 +- examples/content-negotiation/README.md | 2 +- examples/content-negotiation/index.ts | 2 +- examples/downloads/README.md | 2 +- examples/downloads/index.ts | 2 +- examples/error/README.md | 2 +- examples/error/index.ts | 2 +- examples/hello-world/README.md | 2 +- examples/hello-world/index.ts | 2 +- examples/json/README.md | 2 +- examples/json/index.ts | 2 +- examples/location/README.md | 2 +- examples/location/index.ts | 2 +- examples/multi-router/README.md | 2 +- examples/multi-router/index.ts | 2 +- examples/proxy/README.md | 2 +- examples/proxy/index.ts | 2 +- examples/raw/README.md | 2 +- examples/raw/index.ts | 2 +- examples/static-files/README.md | 2 +- examples/static-files/index.ts | 2 +- examples/text/README.md | 2 +- examples/text/index.ts | 2 +- examples/urlencoded/README.md | 2 +- examples/urlencoded/index.ts | 2 +- version.ts | 2 +- 85 files changed, 627 insertions(+), 623 deletions(-) diff --git a/.github/API/application.md b/.github/API/application.md index 0bb20c6f..585aaddf 100644 --- a/.github/API/application.md +++ b/.github/API/application.md @@ -7,7 +7,7 @@ Adapted from the [ExpressJS API Docs](https://expressjs.com/en/4x/api.html). The `app` object conventionally denotes the Opine application. Create it by calling the top-level `opine()` function exported by the Opine module: ```ts -import opine from "https://deno.land/x/opine@master/mod.ts"; +import opine from "https://deno.land/x/opine@main/mod.ts"; const app = opine(); @@ -57,7 +57,7 @@ The `app.mountpath` property contains one or more path patterns on which a sub-a > A sub-app is an instance of `opine` that may be used for handling the request to a route. ```ts -import opine from "https://deno.land/x/opine@master/mod.ts"; +import opine from "https://deno.land/x/opine@main/mod.ts"; const app = opine(); // the main app const admin = opine(); // the sub app @@ -429,7 +429,7 @@ app.get("/", function (req, res) { Binds and listens for connections on the specified address. This method is nearly identical to Deno's [http.listenAndServe()](https://doc.deno.land/https/deno.land/std/http/server.ts#listenAndServe). An optional callback can be provided which will be executed after the server starts listening for requests - this is provided for legacy reasons to aid in transitions from Express on Node. ```ts -import opine from "https://deno.land/x/opine@master/mod.ts"; +import opine from "https://deno.land/x/opine@main/mod.ts"; const app = opine(); @@ -459,7 +459,7 @@ Binds and listens for connections on the specified numerical port. If no port is This method is supported for legacy reasons to aid in transitions from Express on Node. ```ts -import opine from "https://deno.land/x/opine@master/mod.ts"; +import opine from "https://deno.land/x/opine@main/mod.ts"; const app = opine(); const PORT = 3000; @@ -472,7 +472,7 @@ app.listen(PORT, () => console.log(`Server started on port ${PORT}`)); Binds and listens for connections using the specified [http.HTTPOptions](https://doc.deno.land/https/deno.land/std/http/server.ts#HTTPOptions). This method is nearly identical to Deno's [http.listenAndServe()](https://doc.deno.land/https/deno.land/std/http/server.ts#listenAndServe). An optional callback can be provided which will be executed after the server starts listening for requests - this is provided for legacy reasons to aid in transitions from Express on Node. ```ts -import opine from "https://deno.land/x/opine@master/mod.ts"; +import opine from "https://deno.land/x/opine@main/mod.ts"; const app = opine(); @@ -484,7 +484,7 @@ app.listen({ port: 3000 }); Binds and listens for connections using the specified [http.HTTPSOptions](https://doc.deno.land/https/deno.land/std/http/server.ts#HTTPSOptions). This method is nearly identical to Deno's [http.listenAndServeTLS()](https://doc.deno.land/https/deno.land/std/http/server.ts#listenAndServeTLS). An optional callback can be provided which will be executed after the server starts listening for requests - this is provided for legacy reasons to aid in transitions from Express on Node. ```ts -import opine from "https://deno.land/x/opine@master/mod.ts"; +import opine from "https://deno.land/x/opine@main/mod.ts"; const app = opine(); diff --git a/.github/API/middlewares.md b/.github/API/middlewares.md index 2795f139..51fdc1d3 100644 --- a/.github/API/middlewares.md +++ b/.github/API/middlewares.md @@ -13,7 +13,7 @@ A new `parsedBody` object containing the parsed data is populated on the `reques > As `req.parsedBody`'s shape is based on user-controlled input, all properties and values in this object are untrusted and should be validated before trusting. For example, `req.parsedBody.foo.toString()` may fail in multiple ways, for example `foo` may not be there or may not be a string, and `toString` may not be a function and instead a string or other user-input. ```ts -import { opine, json } from "https://deno.land/x/opine@master/mod.ts"; +import { opine, json } from "https://deno.land/x/opine@main/mod.ts"; const app = opine(); @@ -46,7 +46,7 @@ A new `parsedBody` `Buffer` containing the parsed data is populated on the `requ > As `req.parsedBody`'s shape is based on user-controlled input, all properties and values in this object are untrusted and should be validated before trusting. For example, `req.parsedBody.toString()` may fail in multiple ways, for example stacking multiple parsers `req.parsedBody` may be from a different parser. Testing that `req.parsedBody` is a `Buffer` before calling buffer methods is recommended. ```ts -import { opine, raw } from "https://deno.land/x/opine@master/mod.ts"; +import { opine, raw } from "https://deno.land/x/opine@main/mod.ts"; const app = opine(); @@ -142,7 +142,7 @@ A new `parsedBody` string containing the parsed data is populated on the `reques > As `req.parsedBody`'s shape is based on user-controlled input, all properties and values in this object are untrusted and should be validated before trusting. For example, `req.parsedBody.trim()` may fail in multiple ways, for example stacking multiple parsers `req.parsedBody` may be from a different parser. Testing that `req.parsedBody` is a string before calling string methods is recommended. ```ts -import { opine, text } from "https://deno.land/x/opine@master/mod.ts"; +import { opine, text } from "https://deno.land/x/opine@main/mod.ts"; const app = opine(); @@ -173,7 +173,7 @@ A new `parsedBody` object containing the parsed data is populated on the `reques > As `req.parsedBody`'s shape is based on user-controlled input, all properties and values in this object are untrusted and should be validated before trusting. For example, `req.parsedBody.foo.toString()` may fail in multiple ways, for example `foo` may not be there or may not be a string, and `toString` may not be a function and instead a string or other user-input. ```ts -import { opine, urlencoded } from "https://deno.land/x/opine@master/mod.ts"; +import { opine, urlencoded } from "https://deno.land/x/opine@main/mod.ts"; const app = opine(); diff --git a/.github/API/opine.md b/.github/API/opine.md index a5ed1a6a..b81bc442 100644 --- a/.github/API/opine.md +++ b/.github/API/opine.md @@ -7,7 +7,7 @@ Adapted from the [ExpressJS API Docs](https://expressjs.com/en/4x/api.html). Creates an Opine application. The `opine()` function is a top-level function exported by the Opine module: ```ts -import opine from "https://deno.land/x/opine@master/mod.ts"; +import opine from "https://deno.land/x/opine@main/mod.ts"; const app = opine(); ``` @@ -15,7 +15,7 @@ const app = opine(); The `opine()` function is also exported as a named export: ```ts -import { opine } from "https://deno.land/x/opine@master/mod.ts"; +import { opine } from "https://deno.land/x/opine@main/mod.ts"; const app = opine(); ``` diff --git a/.github/API/request.md b/.github/API/request.md index c7725f3e..e2a501a5 100644 --- a/.github/API/request.md +++ b/.github/API/request.md @@ -84,7 +84,7 @@ import { opine, json, urlencoded, -} from "https://deno.land/x/opine@master/mod.ts"; +} from "https://deno.land/x/opine@main/mod.ts"; const app = opine(); @@ -100,7 +100,7 @@ app.post("/profile", function (req, res, next) { The following example shows how to implement your own simple body-parsing middleware to transform `req.parsedBody` into a raw string: ```ts -import opine from "https://deno.land/x/opine@master/mod.ts"; +import opine from "https://deno.land/x/opine@main/mod.ts"; const app = opine(); diff --git a/.github/API/router.md b/.github/API/router.md index eed3d057..d446dd2a 100644 --- a/.github/API/router.md +++ b/.github/API/router.md @@ -11,7 +11,7 @@ A router behaves like middleware itself, so you can use it as an argument to [ap Opine has a top-level named function export `Router()` that creates a new `router` object. ```ts -import { Router } from "https://deno.land/x/opine@master/mod.ts"; +import { Router } from "https://deno.land/x/opine@main/mod.ts"; const router = Router(options); ``` @@ -149,7 +149,7 @@ This method is similar to [app.use()](./application#appusepath-callback--callbac Middleware is like a plumbing pipe: requests start at the first middleware function defined and work their way "down" the middleware stack processing for each path they match. ```ts -import opine, { Router } from "https://deno.land/x/opine@master/mod.ts"; +import opine, { Router } from "https://deno.land/x/opine@main/mod.ts"; const app = opine(); const router = Router(); diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 0c6e2fd1..824c70ec 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -1,5 +1,9 @@ # ChangeLog +## [0.10.0] - 16-06-2020 + +- feat: move to "main" branch + ## [0.9.0] - 16-06-2020 - fix: lockfile dependencies. diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index d058fe3b..ae9fcf7a 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -21,9 +21,9 @@ Be sure to check for existing issues before raising your own! ### Branching -On this project we follow mainline development (or trunk based development), and our default branch is `master`. +On this project we follow mainline development (or trunk based development), and our default branch is `main`. -Therefore you need to branch from `master` and merge into `master`. +Therefore you need to branch from `main` and merge into `main`. We use the following convention for branch names `feat/issue-#-short-description`, where the the `#` should be replaced with the GitHub issue number, and the short description should provide an idea of what the branch is for. @@ -93,7 +93,7 @@ make test ## Opening a PR -Once you're confident your branch is ready to review, open a PR against `master` on this repo. +Once you're confident your branch is ready to review, open a PR against `main` on this repo. Please make sure you fill the PR template correctly. diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 60718e3c..46613d67 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -2,9 +2,9 @@ name: Test on: push: - branches: [master] + branches: [main] pull_request: - branches: [master] + branches: [main] jobs: benchmark: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a79b5353..980ef27f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,9 +2,9 @@ name: Test on: push: - branches: [master] + branches: [main] pull_request: - branches: [master] + branches: [main] jobs: build: diff --git a/README.md b/README.md index e6453011..f29993c3 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Fast, minimalist web framework for [Deno](https://deno.land/) ported from [Expre ![](https://img.shields.io/github/stars/asos-craigmorten/opine) ![](https://img.shields.io/github/forks/asos-craigmorten/opine) ![](https://img.shields.io/github/license/asos-craigmorten/opine) [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/asos-craigmorten/opine/graphs/commit-activity) [![HitCount](http://hits.dwyl.com/asos-craigmorten/opine.svg)](http://hits.dwyl.com/asos-craigmorten/opine) ```ts -import opine from "https://deno.land/x/opine@master/mod.ts"; +import opine from "https://deno.land/x/opine@main/mod.ts"; const app = opine(); @@ -26,7 +26,7 @@ Before importing, [download and install Deno](https://deno.land/#installation). You can then import Opine straight into your project: ```ts -import opine from "https://deno.land/x/opine@master/mod.ts"; +import opine from "https://deno.land/x/opine@main/mod.ts"; ``` If you want to use a specific version of Opine, just modify the import url to contain the version: @@ -52,13 +52,13 @@ And more to come as we achieve feature parity with [ExpressJS](https://github.co ## Docs -- [Opine Docs](https://github.com/asos-craigmorten/opine/blob/master/.github/API/api.md) - usually the best place when getting started ✨ +- [Opine Docs](https://github.com/asos-craigmorten/opine/blob/main/.github/API/api.md) - usually the best place when getting started ✨ - [Opine Type Docs](https://asos-craigmorten.github.io/opine/) - [Opine Deno Docs](https://doc.deno.land/https/deno.land/x/opine/mod.ts) - [ExpressJS API Docs](https://expressjs.com/en/4x/api.html) -- [License](https://github.com/asos-craigmorten/opine/blob/master/LICENSE.md) -- [ExpressJS License](https://github.com/asos-craigmorten/opine/blob/master/EXPRESS_LICENSE.md) -- [Changelog](https://github.com/asos-craigmorten/opine/blob/master/.github/CHANGELOG.md) +- [License](https://github.com/asos-craigmorten/opine/blob/main/LICENSE.md) +- [ExpressJS License](https://github.com/asos-craigmorten/opine/blob/main/EXPRESS_LICENSE.md) +- [Changelog](https://github.com/asos-craigmorten/opine/blob/main/.github/CHANGELOG.md) ## Philosophy @@ -75,7 +75,7 @@ To run the [examples](./examples), you have two choices: 1. Run the example using Deno directly from GitHub, for example: ```bash - deno run --allow-net --allow-read https://raw.githubusercontent.com/asos-craigmorten/opine/master/examples/hello-world/index.ts + deno run --allow-net --allow-read https://raw.githubusercontent.com/asos-craigmorten/opine/main/examples/hello-world/index.ts ``` 1. Clone the Opine repo locally: @@ -95,7 +95,7 @@ All the [examples](./examples) contain example commands in their READMEs to help ## Contributing -[Contributing guide](https://github.com/asos-craigmorten/opine/blob/master/.github/CONTRIBUTING.md) +[Contributing guide](https://github.com/asos-craigmorten/opine/blob/main/.github/CONTRIBUTING.md) --- diff --git a/docs/classes/_response_.response.html b/docs/classes/_response_.response.html index 3839b7a0..dc3adec7 100644 --- a/docs/classes/_response_.response.html +++ b/docs/classes/_response_.response.html @@ -140,7 +140,7 @@

app

app: Application
@@ -150,7 +150,7 @@

body

body: DenoResponseBody
@@ -160,7 +160,7 @@

headers

headers: Headers = new Headers()
@@ -170,7 +170,7 @@

locals

locals: any
@@ -180,7 +180,7 @@

req

req: Request
@@ -190,7 +190,7 @@

status

status: Status = 200
@@ -207,7 +207,7 @@

append

  • @@ -242,7 +242,7 @@

    attachment

  • @@ -271,7 +271,7 @@

    clearCookie

  • @@ -300,7 +300,7 @@

    cookie

  • @@ -332,7 +332,7 @@

    download

  • @@ -368,7 +368,7 @@

    end

  • @@ -396,7 +396,7 @@

    etag

  • @@ -425,7 +425,7 @@

    format

  • @@ -446,12 +446,12 @@

    format

    'text/plain': function(){ res.send('hey'); },

    -
     'text/html': function(){
    -   res.send('<p>hey</p>');
    +								
     'text/html': function(){
    +   res.send('<p>hey</p>');
      },
     
    - 'application/json': function(){
    -   res.send({ message: 'hey' });
    + 'application/json': function(){
    +   res.send({ message: 'hey' });
      }

    });

    In addition to canonicalized MIME types you may also use extnames mapped to these types:

    @@ -460,11 +460,11 @@

    format

    res.send('hey'); },

     html: function(){
    -   res.send('<p>hey</p>');
    +   res.send('<p>hey</p>');
      },
     
      json: function(){
    -   res.send({ message: 'hey' });
    +   res.send({ message: 'hey' });
      }

    });

    By default Express passes an Error with a .status of 406 to next(err) @@ -493,7 +493,7 @@

    get

  • @@ -522,7 +522,7 @@

    json

  • @@ -531,7 +531,7 @@

    json

    Examples:

    res.json(null);
    -res.json({ user: 'tj' });
    +res.json({ user: 'tj' });
  • Parameters