@fastify/static 8.0.3 → 8.0.4

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/types/index.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  /// <reference types="node" />
4
4
 
5
5
  import { FastifyPluginAsync, FastifyReply, FastifyRequest, RouteOptions } from 'fastify'
6
- import { Stats } from 'fs'
6
+ import { Stats } from 'node:fs'
7
7
 
8
8
  declare module 'fastify' {
9
9
  interface FastifyReply {
@@ -1,6 +1,6 @@
1
1
  import fastify, { FastifyInstance, FastifyPluginAsync, FastifyRequest, FastifyReply } from 'fastify'
2
- import { Server } from 'http'
3
- import { Stats } from 'fs'
2
+ import { Server } from 'node:http'
3
+ import { Stats } from 'node:fs'
4
4
  import { expectAssignable, expectError, expectType } from 'tsd'
5
5
  import * as fastifyStaticStar from '..'
6
6
  import fastifyStatic, {
@@ -62,7 +62,7 @@ const options: FastifyStaticOptions = {
62
62
  expectType<Stats>(stat)
63
63
  },
64
64
  preCompressed: false,
65
- allowedPath: (pathName: string, root: string, request: FastifyRequest) => {
65
+ allowedPath: (_pathName: string, _root: string, _request: FastifyRequest) => {
66
66
  return true
67
67
  },
68
68
  constraints: {
@@ -121,7 +121,7 @@ expectAssignable<FastifyStaticOptions>({
121
121
  appWithImplicitHttp
122
122
  .register(fastifyStatic, options)
123
123
  .after(() => {
124
- appWithImplicitHttp.get('/', (request, reply) => {
124
+ appWithImplicitHttp.get('/', (_request, reply) => {
125
125
  reply.sendFile('some-file-name')
126
126
  })
127
127
  })
@@ -131,23 +131,23 @@ const appWithHttp2 = fastify({ http2: true })
131
131
  appWithHttp2
132
132
  .register(fastifyStatic, options)
133
133
  .after(() => {
134
- appWithHttp2.get('/', (request, reply) => {
134
+ appWithHttp2.get('/', (_request, reply) => {
135
135
  reply.sendFile('some-file-name')
136
136
  })
137
137
 
138
- appWithHttp2.get('/download', (request, reply) => {
138
+ appWithHttp2.get('/download', (_request, reply) => {
139
139
  reply.download('some-file-name')
140
140
  })
141
141
 
142
- appWithHttp2.get('/download/1', (request, reply) => {
142
+ appWithHttp2.get('/download/1', (_request, reply) => {
143
143
  reply.download('some-file-name', { maxAge: '2 days' })
144
144
  })
145
145
 
146
- appWithHttp2.get('/download/2', (request, reply) => {
146
+ appWithHttp2.get('/download/2', (_request, reply) => {
147
147
  reply.download('some-file-name', 'some-filename', { cacheControl: false, acceptRanges: true })
148
148
  })
149
149
 
150
- appWithHttp2.get('/download/3', (request, reply) => {
150
+ appWithHttp2.get('/download/3', (_request, reply) => {
151
151
  reply.download('some-file-name', 'some-filename', { contentType: false })
152
152
  })
153
153
  })
@@ -158,35 +158,35 @@ options.root = ['']
158
158
  multiRootAppWithImplicitHttp
159
159
  .register(fastifyStatic, options)
160
160
  .after(() => {
161
- multiRootAppWithImplicitHttp.get('/', (request, reply) => {
161
+ multiRootAppWithImplicitHttp.get('/', (_request, reply) => {
162
162
  reply.sendFile('some-file-name')
163
163
  })
164
164
 
165
- multiRootAppWithImplicitHttp.get('/', (request, reply) => {
165
+ multiRootAppWithImplicitHttp.get('/', (_request, reply) => {
166
166
  reply.sendFile('some-file-name', { cacheControl: false, acceptRanges: true })
167
167
  })
168
168
 
169
- multiRootAppWithImplicitHttp.get('/', (request, reply) => {
169
+ multiRootAppWithImplicitHttp.get('/', (_request, reply) => {
170
170
  reply.sendFile('some-file-name', 'some-root-name', { cacheControl: false, acceptRanges: true })
171
171
  })
172
172
 
173
- multiRootAppWithImplicitHttp.get('/', (request, reply) => {
173
+ multiRootAppWithImplicitHttp.get('/', (_request, reply) => {
174
174
  reply.sendFile('some-file-name', 'some-root-name-2', { contentType: false })
175
175
  })
176
176
 
177
- multiRootAppWithImplicitHttp.get('/download', (request, reply) => {
177
+ multiRootAppWithImplicitHttp.get('/download', (_request, reply) => {
178
178
  reply.download('some-file-name')
179
179
  })
180
180
 
181
- multiRootAppWithImplicitHttp.get('/download/1', (request, reply) => {
181
+ multiRootAppWithImplicitHttp.get('/download/1', (_request, reply) => {
182
182
  reply.download('some-file-name', { maxAge: '2 days' })
183
183
  })
184
184
 
185
- multiRootAppWithImplicitHttp.get('/download/2', (request, reply) => {
185
+ multiRootAppWithImplicitHttp.get('/download/2', (_request, reply) => {
186
186
  reply.download('some-file-name', 'some-filename', { cacheControl: false, acceptRanges: true })
187
187
  })
188
188
 
189
- multiRootAppWithImplicitHttp.get('/download/3', (request, reply) => {
189
+ multiRootAppWithImplicitHttp.get('/download/3', (_request, reply) => {
190
190
  reply.download('some-file-name', 'some-filename', { contentType: false })
191
191
  })
192
192
  })
@@ -198,7 +198,7 @@ options.index = false
198
198
  noIndexApp
199
199
  .register(fastifyStatic, options)
200
200
  .after(() => {
201
- noIndexApp.get('/', (request, reply) => {
201
+ noIndexApp.get('/', (_request, reply) => {
202
202
  reply.send('<h1>fastify-static</h1>')
203
203
  })
204
204
  })
@@ -208,7 +208,7 @@ options.root = new URL('')
208
208
  const URLRootApp = fastify()
209
209
  URLRootApp.register(fastifyStatic, options)
210
210
  .after(() => {
211
- URLRootApp.get('/', (request, reply) => {
211
+ URLRootApp.get('/', (_request, reply) => {
212
212
  reply.send('<h1>fastify-static</h1>')
213
213
  })
214
214
  })
@@ -219,7 +219,7 @@ options.index = 'index.html'
219
219
  defaultIndexApp
220
220
  .register(fastifyStatic, options)
221
221
  .after(() => {
222
- defaultIndexApp.get('/', (request, reply) => {
222
+ defaultIndexApp.get('/', (_request, reply) => {
223
223
  reply.send('<h1>fastify-static</h1>')
224
224
  })
225
225
  })
package/.eslintrc.json DELETED
@@ -1,31 +0,0 @@
1
- {
2
- "plugins": ["@typescript-eslint"],
3
- "extends": ["eslint:recommended", "standard"],
4
- "overrides": [
5
- {
6
- "files": ["types/*.test-d.ts", "types/*.d.ts"],
7
- "parser": "@typescript-eslint/parser",
8
- "parserOptions": {
9
- "project": ["./tsconfig.eslint.json"]
10
- },
11
- "extends": [
12
- "plugin:@typescript-eslint/recommended",
13
- "plugin:@typescript-eslint/recommended-requiring-type-checking"
14
- ],
15
- "rules": {
16
- "no-use-before-define": "off",
17
- "@typescript-eslint/no-var-requires": "off",
18
- "@typescript-eslint/no-unused-vars": "off",
19
- "@typescript-eslint/no-explicit-any": "off",
20
- "@typescript-eslint/no-floating-promises": "off",
21
- "@typescript-eslint/no-unsafe-assignment": "off",
22
- "@typescript-eslint/no-unsafe-argument": "off",
23
- "@typescript-eslint/no-unsafe-member-access": "off",
24
- "@typescript-eslint/no-unsafe-call": "off",
25
- "@typescript-eslint/no-misused-promises": ["error", {
26
- "checksVoidReturn": false
27
- }]
28
- }
29
- }
30
- ]
31
- }
package/.taprc DELETED
@@ -1,2 +0,0 @@
1
- files:
2
- - test/**/*.test.js