diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..859723c --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018-present node-modules and the contributors. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index d653a70..f481acf 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,9 @@ [![Test coverage][codecov-image]][codecov-url] [![Known Vulnerabilities][snyk-image]][snyk-url] [![npm download][download-image]][download-url] +[![Node.js Version](https://img.shields.io/node/v/cache-content-type.svg?style=flat)](https://nodejs.org/en/download/) +[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://makeapullrequest.com) +![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/node-modules/cache-content-type) [npm-image]: https://img.shields.io/npm/v/cache-content-type.svg?style=flat-square [npm-url]: https://npmjs.org/package/cache-content-type @@ -31,3 +34,13 @@ import { getType } from 'cache-content-type'; const contentType = getType('html'); assert.equal(contentType, 'text/html; charset=utf-8'); ``` + +## License + +[MIT](LICENSE) + +## Contributors + +[![Contributors](https://contrib.rocks/image?repo=node-modules/cache-content-type)](https://github.com/node-modules/cache-content-type/graphs/contributors) + +Made with [contributors-img](https://contrib.rocks). diff --git a/package.json b/package.json index 54fbf33..aab95ad 100644 --- a/package.json +++ b/package.json @@ -6,27 +6,31 @@ }, "description": "Create a full Content-Type header given a MIME type or extension and cache the result", "scripts": { - "test": "npm run lint -- --fix && egg-bin test", - "ci": "npm run lint && egg-bin cov && npm run prepublishOnly", + "clean": "tsc --build --clean", + "pretest": "npm run clean && npm run lint -- --fix", + "test": "egg-bin test", + "preci": "npm run clean && npm run lint", + "ci": "egg-bin cov", + "postci": "npm run prepublishOnly && npm run clean", "lint": "eslint src test", "prepublishOnly": "tshy && tshy-after" }, "dependencies": { "mime-types": "^2.1.35", - "ylru": "^1.4.0" + "ylru": "^2.0.0" }, "devDependencies": { - "@eggjs/tsconfig": "^1.3.3", - "@types/mime-types": "^2.1.4", - "@types/mocha": "^10.0.1", - "@types/node": "^20.2.5", - "egg-bin": "6", + "@eggjs/tsconfig": "2", + "@types/mime-types": "2", + "@types/mocha": "10", + "@types/node": "^22", + "@eggjs/bin": "7", "eslint": "8", - "eslint-config-egg": "13", - "mm": "3", - "tshy": "^1.15.1", - "tshy-after": "^1.0.0", - "typescript": "^5.4.5" + "eslint-config-egg": "14", + "mm": "4", + "tshy": "3", + "tshy-after": "1", + "typescript": "5" }, "repository": { "type": "git", @@ -50,12 +54,10 @@ "./package.json": "./package.json", ".": { "import": { - "source": "./src/index.ts", "types": "./dist/esm/index.d.ts", "default": "./dist/esm/index.js" }, "require": { - "source": "./src/index.ts", "types": "./dist/commonjs/index.d.ts", "default": "./dist/commonjs/index.js" } @@ -66,5 +68,6 @@ "src" ], "main": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts" + "types": "./dist/commonjs/index.d.ts", + "module": "./dist/esm/index.js" } diff --git a/src/index.ts b/src/index.ts index 20760be..a6ed206 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,5 @@ import mimeTypes from 'mime-types'; -import LRU from 'ylru'; +import { LRU } from 'ylru'; let typeLRUCache: LRU; diff --git a/tsconfig.json b/tsconfig.json index ff41b73..376b902 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,10 +1,3 @@ { - "extends": "@eggjs/tsconfig", - "compilerOptions": { - "strict": true, - "noImplicitAny": true, - "target": "ES2022", - "module": "NodeNext", - "moduleResolution": "NodeNext" - } + "extends": "@eggjs/tsconfig" }