-
Notifications
You must be signed in to change notification settings - Fork 0
feat: support cjs and esm both #1
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
Conversation
BREAKING CHANGE: drop Node.js < 18 support eggjs/egg#5257
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: npm/egg-bin@4.20.0, npm/egg-ci@1.19.1, npm/eslint-config-egg@7.5.1, npm/eslint@5.16.0, npm/mm@2.5.0 |
🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎ To accept the risk, merge this PR and you will not be notified again.
Next stepsWhat is an install script?Install scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts. Packages should not be running non-essential scripts during install and there are often solutions to problems people solve with install scripts that can be run at publish time instead. What is protestware?This package is a joke, parody, or includes undocumented or hidden behavior unrelated to its primary function. Consider that consuming this package my come along with functionality unrelated to its primary purpose. Take a deeper look at the dependencyTake a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev. Remove the packageIf you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency. Mark a package as acceptable riskTo ignore an alert, reply with a comment starting with
|
WalkthroughThe project underwent significant updates, including enhanced ESLint configurations for TypeScript and Node.js, the addition of CI/CD workflows for testing and releasing with GitHub Actions, and expanded Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (9)
- .eslintrc (1 hunks)
- .github/workflows/nodejs.yml (1 hunks)
- .github/workflows/release.yml (1 hunks)
- .gitignore (1 hunks)
- README.md (1 hunks)
- package.json (2 hunks)
- src/index.ts (1 hunks)
- test/index.test.ts (1 hunks)
- tsconfig.json (1 hunks)
Files skipped from review due to trivial changes (5)
- .github/workflows/nodejs.yml
- .github/workflows/release.yml
- .gitignore
- test/index.test.ts
- tsconfig.json
Additional context used
LanguageTool
README.md
[style] ~3-~3: Using many exclamation marks might seem excessive (in this case: 3 exclamation marks for a text that’s 454 characters long) (EN_EXCESSIVE_EXCLAMATION)
Context: ...e [![NPM version][npm-image]][npm-url][![Test coverage][codecov-image]][codecov-url] [![Known Vulnerabilities][snyk-image]][sny...
Additional comments not posted (3)
.eslintrc (1)
2-5
: Updated ESLint configuration to support TypeScript and enforce node prefix rules.README.md (1)
1-32
: Updated README with new badges and ES module installation instructions.Tools
LanguageTool
[style] ~3-~3: Using many exclamation marks might seem excessive (in this case: 3 exclamation marks for a text that’s 454 characters long) (EN_EXCESSIVE_EXCLAMATION)
Context: ...e [![NPM version][npm-image]][npm-url][![Test coverage][codecov-image]][codecov-url] [![Known Vulnerabilities][snyk-image]][sny...
package.json (1)
Line range hint
4-69
: Updatedpackage.json
to support new Node.js engine, enhance scripts, and update dependencies.
export function getType(type: string): string | false { | ||
if (!typeLRUCache) { | ||
typeLRUCache = new LRU(100); | ||
} | ||
let mimeType = typeLRUCache.get<string | false>(type); | ||
if (mimeType === undefined) { | ||
mimeType = mimeTypes.contentType(type); | ||
typeLRUCache.set(type, mimeType); | ||
} | ||
return mimeType; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure typeLRUCache
is initialized before use to prevent runtime errors.
- let typeLRUCache: LRU;
+ let typeLRUCache: LRU = new LRU(100);
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
export function getType(type: string): string | false { | |
if (!typeLRUCache) { | |
typeLRUCache = new LRU(100); | |
} | |
let mimeType = typeLRUCache.get<string | false>(type); | |
if (mimeType === undefined) { | |
mimeType = mimeTypes.contentType(type); | |
typeLRUCache.set(type, mimeType); | |
} | |
return mimeType; | |
} | |
export function getType(type: string): string | false { | |
let typeLRUCache: LRU = new LRU(100); | |
let mimeType = typeLRUCache.get<string | false>(type); | |
if (mimeType === undefined) { | |
mimeType = mimeTypes.contentType(type); | |
typeLRUCache.set(type, mimeType); | |
} | |
return mimeType; | |
} |
[skip ci] ## [2.0.0](v1.0.1...v2.0.0) (2024-06-08) ### ⚠ BREAKING CHANGES * drop Node.js < 18 support eggjs/egg#5257 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced Node.js CI workflow for automated testing and releases. - Added TypeScript support and enforced node prefix rules in ESLint configuration. - **Documentation** - Updated README with new badges and revised installation/usage instructions. - **Chores** - Updated `.gitignore` to include `dist` directory and `.tshy*` files. - Updated `package.json` with new dependencies, scripts, and metadata. - **Tests** - Added tests for caching content types functionality. <!-- end of auto-generated comment: release notes by coderabbit.ai --> ### Features * support cjs and esm both ([#1](#1)) ([2683290](2683290))
BREAKING CHANGE: drop Node.js < 18 support
eggjs/egg#5257
Summary by CodeRabbit
New Features
Documentation
Chores
.gitignore
to includedist
directory and.tshy*
files.package.json
with new dependencies, scripts, and metadata.Tests