This repository has been archived by the owner on Jun 9, 2024. 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.
* feat!: migrate to fastify org * update devDepenencies * disable package-lock generation * move types into types foler * ues gitignore from skeleton * rename dependabod.yaml to dependabot.yaml * add pre-commit and stream line npm scripts * move http2 to http2.test.js * sync types with code * fix typo in warning * rename parameters to be more self explaining * improve http2 test * extract formatEntry, write tests * fix linting * add benchmarks for formatEntry simplify formatEntry improve typings * remove unreachable code * add newline * improve performance of formatEntry * add pre-commit * improve performance, add warn option * revert socket write only mode add example.js * add stresstest * improve testing Co-authored-by: uzlopak <aras.abbasi@googlemail.com>
- Loading branch information
Showing
20 changed files
with
675 additions
and
164 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" | ||
open-pull-requests-limit: 10 | ||
|
||
- package-ecosystem: "npm" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
open-pull-requests-limit: 10 |
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,18 @@ | ||
name: CI workflow | ||
on: [push, pull_request] | ||
name: CI | ||
|
||
on: | ||
push: | ||
paths-ignore: | ||
- 'docs/**' | ||
- '*.md' | ||
pull_request: | ||
paths-ignore: | ||
- 'docs/**' | ||
- '*.md' | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [10.x, 12.x, 13.x, 14.x] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Install Dependencies | ||
run: npm install --ignore-scripts | ||
- name: Test | ||
run: npm test | ||
uses: fastify/workflows/.github/workflows/plugins-ci.yml@v3 | ||
with: | ||
lint: true | ||
license-check: true |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
package-lock=false |
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,5 +1,7 @@ | ||
esm: false | ||
ts: false | ||
jsx: false | ||
coverage: true | ||
flow: true | ||
flow: true | ||
|
||
files: | ||
- test/**/*.test.js |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict' | ||
|
||
const benchmark = require('benchmark') | ||
const formatEntry = require('../lib/formatEntry') | ||
|
||
const earlyHintString = 'Link: </style.css>; rel=preload; as=style' | ||
const earlyHintObject = { href: '/', rel: 'preconnect', cors: 'anonymous', as: 'script' } | ||
|
||
new benchmark.Suite() | ||
.add('formatEntry: object', function () { formatEntry(earlyHintObject) }, { minSamples: 100 }) | ||
.add('formatEntry: string', function () { formatEntry(earlyHintString) }, { minSamples: 100 }) | ||
.on('cycle', function onCycle (event) { console.log(String(event.target)) }) | ||
.run() |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const Fastify = require('fastify') | ||
const eh = require('../index') | ||
|
||
const fastify = Fastify({ logger: false }) | ||
fastify.register(eh) | ||
|
||
fastify.get('/', async (request, reply) => { | ||
await reply.eh.add([ | ||
'Link: </style.css>; rel=preload; as=style', | ||
'Link: </script.js>; rel=preload; as=script' | ||
]) | ||
return { hello: 'world' } | ||
}) | ||
|
||
fastify.get('/style.css', async (request, reply) => { | ||
return 'body { }' | ||
}) | ||
fastify.get('/script.js', async (request, reply) => { | ||
return 'var v = 0xbadc0ffee' | ||
}) | ||
|
||
const start = async () => { | ||
try { | ||
await fastify.listen({ port: 3000 }) | ||
fastify.log.info(`server listening on ${fastify.server.address().port}`) | ||
} catch (err) { | ||
fastify.log.error(err) | ||
process.exit(1) | ||
} | ||
} | ||
|
||
start() |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.