@fastify/static
Advanced tools
Comparing version 6.11.2 to 6.12.0
{ | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"standard" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": ["@typescript-eslint"], | ||
"env": { "node": true }, | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"sourceType": "module", | ||
"project": "./tsconfig.eslint.json", | ||
"createDefaultProgram": true | ||
}, | ||
"rules": { | ||
"no-console": "off", | ||
"@typescript-eslint/indent": ["error", 2], | ||
"semi": ["error", "never"], | ||
"import/export": "off" // this errors on multiple exports (overload interfaces) | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": ["*.d.ts","*.test-d.ts"], | ||
"rules": { | ||
"no-use-before-define": "off", | ||
"no-redeclare": "off", | ||
"@typescript-eslint/no-explicit-any": "off" | ||
} | ||
"plugins": ["@typescript-eslint"], | ||
"extends": ["eslint:recommended", "standard"], | ||
"overrides": [ | ||
{ | ||
"files": ["types/*.test-d.ts", "types/*.d.ts"], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": ["./tsconfig.eslint.json"] | ||
}, | ||
{ | ||
"files": ["*.test-d.ts"], | ||
"rules": { | ||
"@typescript-eslint/no-var-requires": "off", | ||
"no-unused-vars": "off", | ||
"n/handle-callback-err": "off", | ||
"@typescript-eslint/no-empty-function": "off", | ||
"@typescript-eslint/explicit-function-return-type": "off", | ||
"@typescript-eslint/no-unused-vars": "off", | ||
"@typescript-eslint/no-non-null-assertion": "off", | ||
"@typescript-eslint/no-misused-promises": ["error", { | ||
"checksVoidReturn": false | ||
}] | ||
}, | ||
"globals": { | ||
"NodeJS": "readonly" | ||
} | ||
"extends": [ | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@typescript-eslint/recommended-requiring-type-checking" | ||
], | ||
"rules": { | ||
"no-use-before-define": "off", | ||
"@typescript-eslint/no-var-requires": "off", | ||
"@typescript-eslint/no-unused-vars": "off", | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"@typescript-eslint/no-floating-promises": "off", | ||
"@typescript-eslint/no-unsafe-assignment": "off", | ||
"@typescript-eslint/no-unsafe-argument": "off", | ||
"@typescript-eslint/no-unsafe-member-access": "off", | ||
"@typescript-eslint/no-unsafe-call": "off", | ||
"@typescript-eslint/no-misused-promises": ["error", { | ||
"checksVoidReturn": false | ||
}] | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} |
18
index.js
@@ -17,8 +17,8 @@ 'use strict' | ||
const winSeparatorRegex = new RegExp(`\\${path.win32.sep}`, 'g') | ||
const backslashRegex = /\\/g | ||
const startForwardSlashRegex = /^\// | ||
const endForwardSlashRegex = /\/$/ | ||
const doubleForwardSlashRegex = /\/\//g | ||
const asteriskRegex = /\*/g | ||
const winSeparatorRegex = new RegExp(`\\${path.win32.sep}`, 'gu') | ||
const backslashRegex = /\\/gu | ||
const startForwardSlashRegex = /^\//u | ||
const endForwardSlashRegex = /\/$/u | ||
const doubleForwardSlashRegex = /\/\//gu | ||
const asteriskRegex = /\*/gu | ||
@@ -440,3 +440,3 @@ const supportedEncodings = ['br', 'gzip', 'deflate'] | ||
if ([...new Set(rootPath)].length !== rootPath.length) { | ||
if (new Set(rootPath).size !== rootPath.length) { | ||
throw new Error( | ||
@@ -503,3 +503,3 @@ '"root" option array contains one or more duplicate paths' | ||
return !stats.isDirectory() | ||
} catch (e) { | ||
} catch { | ||
return false | ||
@@ -548,3 +548,3 @@ } | ||
return parsedPathname + (parsedPathname[parsedPathname.length - 1] !== '/' ? '/' : '') + (parsed.search || '') | ||
} catch (error) { | ||
} catch { | ||
// the try-catch here is actually unreachable, but we keep it for safety and prevent DoS attack | ||
@@ -551,0 +551,0 @@ /* istanbul ignore next */ |
@@ -30,3 +30,3 @@ 'use strict' | ||
stats = await fs.stat(path.join(dir, filename)) | ||
} catch (error) { | ||
} catch { | ||
return | ||
@@ -62,3 +62,3 @@ } | ||
stats = await fs.stat(filePath) | ||
} catch (error) { | ||
} catch { | ||
return | ||
@@ -117,3 +117,3 @@ } | ||
entries = await dirList.list(dir, options, dotfiles) | ||
} catch (error) { | ||
} catch { | ||
return reply.callNotFound() | ||
@@ -152,3 +152,3 @@ } | ||
return { | ||
href: path.join(prefix, route, entry.name).replace(/\\/g, '/'), | ||
href: path.join(prefix, route, entry.name).replace(/\\/gu, '/'), | ||
name: entry.name, | ||
@@ -155,0 +155,0 @@ stats: entry.stats, |
{ | ||
"name": "@fastify/static", | ||
"version": "6.11.2", | ||
"version": "6.12.0", | ||
"description": "Plugin for serving static files as fast as possible.", | ||
"main": "index.js", | ||
"type": "commonjs", | ||
"types": "types/index.d.ts", | ||
@@ -7,0 +8,0 @@ "scripts": { |
{ | ||
"compilerOptions": { | ||
"target": "es6", | ||
"lib": [ "es2015" ], | ||
"module": "commonjs", | ||
"noEmit": true, | ||
"strict": true | ||
}, | ||
"include": [ | ||
"types/*.test-d.ts", | ||
"types/*.d.ts" | ||
] | ||
} | ||
"compilerOptions": { | ||
"target": "es6", | ||
"lib": ["ES2018"], | ||
"module": "commonjs", | ||
"noEmit": true, | ||
"strict": true | ||
}, | ||
"include": ["types/*.test-d.ts", "types/*.d.ts"] | ||
} |
Sorry, the diff of this file is too big to display
410538
5296