Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use ylru@2 #2

Merged
merged 1 commit into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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).
35 changes: 19 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
}
Expand All @@ -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"
}
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import mimeTypes from 'mime-types';
import LRU from 'ylru';
import { LRU } from 'ylru';

let typeLRUCache: LRU;

Expand Down
9 changes: 1 addition & 8 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
{
"extends": "@eggjs/tsconfig",
"compilerOptions": {
"strict": true,
"noImplicitAny": true,
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext"
}
"extends": "@eggjs/tsconfig"
}