@fastify/caching 7.0.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,50 +1,17 @@
1
1
  name: CI
2
- 'on':
2
+
3
+ on:
3
4
  push:
4
5
  paths-ignore:
5
- - docs/**
6
+ - 'docs/**'
6
7
  - '*.md'
7
8
  pull_request:
8
9
  paths-ignore:
9
- - docs/**
10
+ - 'docs/**'
10
11
  - '*.md'
12
+
11
13
  jobs:
12
14
  test:
13
- runs-on: ${{ matrix.os }}
14
- strategy:
15
- matrix:
16
- node-version:
17
- - 10
18
- - 12
19
- - 14
20
- - 16
21
- - 17
22
- os:
23
- - macos-latest
24
- - ubuntu-latest
25
- - windows-latest
26
- steps:
27
- - uses: actions/checkout@v3
28
- - name: Use Node.js
29
- uses: actions/setup-node@v3
30
- with:
31
- node-version: ${{ matrix.node-version }}
32
- - name: Install Dependencies
33
- run: |
34
- npm install --ignore-scripts
35
- - name: Lint
36
- run: |
37
- npm run lint:ci
38
- - name: Run Tests
39
- run: |
40
- npm test
41
- automerge:
42
- needs: test
43
- runs-on: ubuntu-latest
44
- permissions:
45
- pull-requests: write
46
- contents: write
47
- steps:
48
- - uses: fastify/github-action-merge-dependabot@v3
49
- with:
50
- github-token: ${{ secrets.GITHUB_TOKEN }}
15
+ uses: fastify/workflows/.github/workflows/plugins-ci.yml@v3
16
+ with:
17
+ lint: true
package/Readme.md CHANGED
@@ -1,11 +1,10 @@
1
- # fastify-caching
1
+ # @fastify/caching
2
2
 
3
3
  ![CI](https://github.com/fastify/fastify-caching/workflows/CI/badge.svg)
4
- [![NPM version](https://img.shields.io/npm/v/fastify-caching.svg?style=flat)](https://www.npmjs.com/package/fastify-caching)
5
- [![Known Vulnerabilities](https://snyk.io/test/github/fastify/fastify-caching/badge.svg)](https://snyk.io/test/github/fastify/fastify-caching)
4
+ [![NPM version](https://img.shields.io/npm/v/@fastify/caching.svg?style=flat)](https://www.npmjs.com/package/@fastify/caching)
6
5
  [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://standardjs.com/)
7
6
 
8
- *fastify-caching* is a plugin for the [Fastify](http://fastify.io/) framework
7
+ *@fastify/caching* is a plugin for the [Fastify](http://fastify.io/) framework
9
8
  that provides mechanisms for manipulating HTTP cache headers according to
10
9
  [RFC 2616 §14.9](https://tools.ietf.org/html/rfc2616#section-14.9).
11
10
 
@@ -33,7 +32,7 @@ routes.
33
32
  ```js
34
33
  const http = require('http')
35
34
  const fastify = require('fastify')()
36
- const fastifyCaching = require('fastify-caching')
35
+ const fastifyCaching = require('@fastify/caching')
37
36
 
38
37
  fastify.register(
39
38
  fastifyCaching,
@@ -45,7 +44,7 @@ fastify.get('/', (req, reply) => {
45
44
  reply.send({hello: 'world'})
46
45
  })
47
46
 
48
- fastify.listen(3000, (err) => {
47
+ fastify.listen({ port: 3000 }, (err) => {
49
48
  if (err) throw err
50
49
 
51
50
  http.get('http://127.0.0.1:3000/', (res) => {
@@ -72,8 +71,8 @@ const abcache = require('abstract-cache')({
72
71
 
73
72
  const fastify = require('fastify')()
74
73
  fastify
75
- .register(require('fastify-redis'), {client: redis})
76
- .register(require('fastify-caching'), {cache: abcache})
74
+ .register(require('@fastify/redis'), {client: redis})
75
+ .register(require('@fastify/caching'), {cache: abcache})
77
76
 
78
77
  fastify.get('/', (req, reply) => {
79
78
  fastify.cache.set('hello', {hello: 'world'}, 10000, (err) => {
@@ -82,7 +81,7 @@ fastify.get('/', (req, reply) => {
82
81
  })
83
82
  })
84
83
 
85
- fastify.listen(3000, (err) => {
84
+ fastify.listen({ port: 3000 }, (err) => {
86
85
  if (err) throw err
87
86
  })
88
87
  ```
@@ -91,7 +90,7 @@ fastify.listen(3000, (err) => {
91
90
 
92
91
  ### Options
93
92
 
94
- *fastify-caching* accepts the options object:
93
+ *@fastify/caching* accepts the options object:
95
94
 
96
95
  ```js
97
96
  {
@@ -111,7 +110,7 @@ then `', max-age=<value>'` will be appended to the `cache-control` header.
111
110
  protocol compliant cache object. Note: the plugin requires a cache instance to
112
111
  properly support the ETag mechanism. Therefore, if a falsy value is supplied
113
112
  the default will be used.
114
- + `cacheSegment` (Default: `'fastify-caching'`): segment identifier to use when
113
+ + `cacheSegment` (Default: `'@fastify/caching'`): segment identifier to use when
115
114
  communicating with the cache.
116
115
  + `serverExpiresIn` (Default: `undefined`): a value, in seconds, for the length of time the resource is fresh and may be held in a shared cache (e.g. a CDN). Shared caches will ignore max-age when this is specified, though browsers will continue to use max-age. Should be used with expiresIn, not in place of it. When this is set, and `privacy` is set to `public`, then `', s-maxage=<value>'` will be appended to the `cache-control` header.
117
116
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fastify/caching",
3
- "version": "7.0.0",
3
+ "version": "8.0.0",
4
4
  "description": "A plugin for Fastify to enable management of cache control headers",
5
5
  "main": "plugin.js",
6
6
  "types": "plugin.d.ts",
@@ -34,7 +34,7 @@
34
34
  "homepage": "https://github.com/fastify/fastify-caching#readme",
35
35
  "devDependencies": {
36
36
  "@types/node": "^17.0.21",
37
- "fastify": "^3.27.2",
37
+ "fastify": "^4.0.0-rc.2",
38
38
  "pre-commit": "^1.2.2",
39
39
  "snazzy": "^9.0.0",
40
40
  "standard": "^17.0.0",
package/plugin.js CHANGED
@@ -93,8 +93,8 @@ function fastifyCachingPlugin (instance, options, next) {
93
93
  }
94
94
 
95
95
  module.exports = fp(fastifyCachingPlugin, {
96
- fastify: '^3.0.0',
97
- name: 'fastify-caching'
96
+ fastify: '^4.0.0',
97
+ name: '@fastify/caching'
98
98
  })
99
99
 
100
100
  module.exports.privacy = {