This repository has been archived by the owner on Nov 18, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2fe5743
commit 39767d0
Showing
14 changed files
with
8,560 additions
and
8,765 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
version: 2 | ||
jobs: | ||
build_12.18.2: | ||
build_14.15.4: | ||
docker: | ||
- image: 'circleci/node:12.18.2' | ||
- image: circleci/node:14.15.4 | ||
working_directory: ~/app | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- 'v1-dependencies-{{ checksum "package.json" }}' | ||
- v1-dependencies-{{ checksum "package.json" }} | ||
- v1-dependencies- | ||
- run: npm install | ||
- save_cache: | ||
paths: | ||
- node_modules | ||
key: 'v1-dependencies-{{ checksum "package.json" }}' | ||
key: v1-dependencies-{{ checksum "package.json" }} | ||
- run: npm test | ||
build_latest: | ||
docker: | ||
- image: 'circleci/node:latest' | ||
- image: circleci/node:latest | ||
working_directory: ~/app | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- 'v1-dependencies-{{ checksum "package.json" }}' | ||
- v1-dependencies-{{ checksum "package.json" }} | ||
- v1-dependencies- | ||
- run: npm install | ||
- save_cache: | ||
paths: | ||
- node_modules | ||
key: 'v1-dependencies-{{ checksum "package.json" }}' | ||
key: v1-dependencies-{{ checksum "package.json" }} | ||
- run: npm test | ||
workflows: | ||
version: 2 | ||
workflow: | ||
jobs: | ||
- build_12.18.2 | ||
- build_14.15.4 | ||
- build_latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,10 @@ | |
], | ||
"rules": { | ||
"prettier/prettier": [ | ||
"error" | ||
"error", | ||
{ | ||
"endOfLine": "auto" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,10 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"semi": false, | ||
"singleQuote": true, | ||
"useTabs": true, | ||
"quoteProps": "consistent", | ||
"bracketSpacing": true, | ||
"arrowParens": "always", | ||
"printWidth": 100, | ||
"overrides": [ | ||
{ | ||
"files": "*.md", | ||
"options": { | ||
"useTabs": false | ||
} | ||
} | ||
] | ||
"trailingComma": "es5", | ||
"semi": false, | ||
"singleQuote": true, | ||
"useTabs": false, | ||
"quoteProps": "consistent", | ||
"bracketSpacing": true, | ||
"arrowParens": "always", | ||
"printWidth": 100 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
;(async function () { | ||
const Middleware = require('..').Middleware | ||
const Middleware = require('..').Middleware | ||
|
||
class Middleware1 { | ||
async handle(ctx, next) { | ||
ctx.stack.push('fn1') | ||
await next() | ||
} | ||
} | ||
class Middleware1 { | ||
async handle(ctx, next) { | ||
ctx.stack.push('fn1') | ||
await next() | ||
} | ||
} | ||
|
||
class Middleware2 { | ||
async handle(ctx, next) { | ||
ctx.stack.push('fn2') | ||
await next() | ||
} | ||
} | ||
class Middleware2 { | ||
async handle(ctx, next) { | ||
ctx.stack.push('fn2') | ||
await next() | ||
} | ||
} | ||
|
||
const middleware = new Middleware() | ||
const ctx = { | ||
stack: [], | ||
} | ||
const middleware = new Middleware() | ||
const ctx = { | ||
stack: [], | ||
} | ||
|
||
middleware.register([Middleware1, Middleware2]) | ||
middleware.register([Middleware1, Middleware2]) | ||
|
||
await middleware | ||
.runner() | ||
.executor(async function (MiddlewareClass, params) { | ||
const instance = new MiddlewareClass() | ||
await instance.handle(...params) | ||
}) | ||
.run([ctx]) | ||
await middleware | ||
.runner() | ||
.executor(async function (MiddlewareClass, params) { | ||
const instance = new MiddlewareClass() | ||
await instance.handle(...params) | ||
}) | ||
.run([ctx]) | ||
|
||
console.log(ctx) | ||
console.log(ctx) | ||
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.