@fastify/static 5.0.0 → 5.0.1

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.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # fastify-static
1
+ # @fastify/static
2
2
 
3
3
  ![CI](https://github.com/fastify/fastify-static/workflows/CI/badge.svg)
4
- [![NPM version](https://img.shields.io/npm/v/fastify-static.svg?style=flat)](https://www.npmjs.com/package/fastify-static)
4
+ [![NPM version](https://img.shields.io/npm/v/@fastify/static.svg?style=flat)](https://www.npmjs.com/package/@fastify/static)
5
5
  [![Known Vulnerabilities](https://snyk.io/test/github/fastify/fastify-static/badge.svg)](https://snyk.io/test/github/fastify/fastify-static)
6
6
  [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://standardjs.com/)
7
7
 
@@ -12,7 +12,7 @@ Please refer to [this branch](https://github.com/fastify/fastify-static/tree/1.x
12
12
 
13
13
  ## Install
14
14
 
15
- `npm install --save fastify-static`
15
+ `npm install --save @fastify/static`
16
16
 
17
17
  ## Usage
18
18
 
@@ -20,7 +20,7 @@ Please refer to [this branch](https://github.com/fastify/fastify-static/tree/1.x
20
20
  const fastify = require('fastify')()
21
21
  const path = require('path')
22
22
 
23
- fastify.register(require('fastify-static'), {
23
+ fastify.register(require('@fastify/static'), {
24
24
  root: path.join(__dirname, 'public'),
25
25
  prefix: '/public/', // optional: default '/'
26
26
  })
@@ -42,7 +42,7 @@ fastify.get('/another/path', function (req, reply) {
42
42
 
43
43
  ```js
44
44
  const fastify = require('fastify')()
45
- const fastifyStatic = require('fastify-static')
45
+ const fastifyStatic = require('@fastify/static')
46
46
  const path = require('path')
47
47
  // first plugin
48
48
  fastify.register(fastifyStatic, {
@@ -64,7 +64,7 @@ fastify.register(fastifyStatic, {
64
64
  const fastify = require('fastify')()
65
65
  const path = require('path')
66
66
 
67
- fastify.register(require('fastify-static'), {
67
+ fastify.register(require('@fastify/static'), {
68
68
  root: path.join(__dirname, 'public'),
69
69
  prefix: '/public/', // optional: default '/'
70
70
  })
@@ -145,7 +145,7 @@ You're able to alter this options when calling `reply.download('filename.html',
145
145
 
146
146
  Default: `false`
147
147
 
148
- If set to `true`, `fastify-static` redirects to the directory with a trailing slash.
148
+ If set to `true`, `@fastify/static` redirects to the directory with a trailing slash.
149
149
 
150
150
  This option cannot be set to `true` with `wildcard` set to `false` on a server
151
151
  with `ignoreTrailingSlash` set to `true`.
@@ -157,8 +157,8 @@ slash will trigger your app's 404 handler using `reply.callNotFound()`.
157
157
 
158
158
  Default: `true`
159
159
 
160
- If set to `true`, `fastify-static` adds a wildcard route to serve files.
161
- If set to `false`, `fastify-static` globs the filesystem for all defined
160
+ If set to `true`, `@fastify/static` adds a wildcard route to serve files.
161
+ If set to `false`, `@fastify/static` globs the filesystem for all defined
162
162
  files in the served folder (`${root}/**/*`), and just creates the routes needed for
163
163
  those and it will not serve the newly added file on the filesystem.
164
164
 
@@ -196,7 +196,7 @@ Note: Multi-root is not supported within the `list` option.
196
196
  **Example:**
197
197
 
198
198
  ```js
199
- fastify.register(require('fastify-static'), {
199
+ fastify.register(require('@fastify/static'), {
200
200
  root: path.join(__dirname, 'public'),
201
201
  prefix: '/public/',
202
202
  index: false
@@ -235,7 +235,7 @@ will return the response as json independent of `list.format`.
235
235
  **Example:**
236
236
 
237
237
  ```js
238
- fastify.register(require('fastify-static'), {
238
+ fastify.register(require('@fastify/static'), {
239
239
  root: path.join(__dirname, 'public'),
240
240
  prefix: '/public/',
241
241
  list: {
@@ -290,7 +290,7 @@ Note: if a file with the same name exists, the actual file is sent.
290
290
  **Example:**
291
291
 
292
292
  ```js
293
- fastify.register(require('fastify-static'), {
293
+ fastify.register(require('@fastify/static'), {
294
294
  root: path.join(__dirname, '/static'),
295
295
  prefix: '/public',
296
296
  prefixAvoidTrailingSlash: true,
@@ -408,7 +408,7 @@ If you would just like to use the reply decorator and not serve whole directorie
408
408
  #### Disabling reply decorator
409
409
 
410
410
  The reply object is decorated with a `sendFile` function by default. If you want to
411
- disable this, pass the option `{ decorateReply: false }`. If fastify-static is
411
+ disable this, pass the option `{ decorateReply: false }`. If @fastify/static is
412
412
  registered to multiple prefixes in the same route only one can initialize reply
413
413
  decorators.
414
414
 
@@ -5,7 +5,7 @@ const fastify = require('fastify')({ logger: { level: 'trace' } })
5
5
 
6
6
  fastify
7
7
  // Compress everything.
8
- .register(require('fastify-compress'), { threshold: 0 })
8
+ .register(require('@fastify/compress'), { threshold: 0 })
9
9
  .register(require('../'), {
10
10
  // An absolute path containing static files to serve.
11
11
  root: path.join(__dirname, '/public')
package/index.d.ts CHANGED
@@ -93,6 +93,6 @@ export interface FastifyStaticOptions extends SendOptions {
93
93
  maxAge?: string | number;
94
94
  }
95
95
 
96
- declare const fastifyStatic: FastifyPluginCallback<FastifyStaticOptions>
96
+ export declare const fastifyStatic: FastifyPluginCallback<FastifyStaticOptions>
97
97
 
98
98
  export default fastifyStatic;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fastify/static",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "Plugin for serving static files as fast as possible.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -38,6 +38,7 @@
38
38
  "send": "^0.17.1"
39
39
  },
40
40
  "devDependencies": {
41
+ "@fastify/compress": "^5.0.0",
41
42
  "@types/node": "^17.0.0",
42
43
  "@typescript-eslint/eslint-plugin": "^2.29.0",
43
44
  "@typescript-eslint/parser": "^2.29.0",
@@ -45,7 +46,6 @@
45
46
  "coveralls": "^3.0.4",
46
47
  "eslint-plugin-typescript": "^0.14.0",
47
48
  "fastify": "^3.7.0",
48
- "fastify-compress": "^4.0.0",
49
49
  "handlebars": "^4.7.6",
50
50
  "pre-commit": "^1.2.2",
51
51
  "proxyquire": "^2.1.0",
@@ -10,7 +10,7 @@ const t = require('tap')
10
10
  const simple = require('simple-get')
11
11
  const Fastify = require('fastify')
12
12
  const { kErrorHandler } = require('fastify/lib/symbols')
13
- const compress = require('fastify-compress')
13
+ const compress = require('@fastify/compress')
14
14
  const concat = require('concat-stream')
15
15
  const pino = require('pino')
16
16
  const proxyquire = require('proxyquire')