-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(sdk): force usage of mime v3 throughout repo (#4590)
We were already depending on `mime`, so this does not increase our dependency closure. The version of `mime` that `express` depends on (via the `send` package) is very old and can easily conflict with other dependencies we may want to add. This forces our packages to always use v3 of `mime`, and patches `mime` v3 to expose the previously removed functions. *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
- Loading branch information
1 parent
0b3ece4
commit fc9ba04
Showing
7 changed files
with
65 additions
and
17 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,6 +71,7 @@ const project = new cdk.JsiiProject({ | |
"@aws-sdk/[email protected]", | ||
"@aws-sdk/[email protected]", | ||
"mime-types", | ||
"mime@^3.0.0", | ||
// azure client dependencies | ||
"@azure/[email protected]", | ||
"@azure/[email protected]", | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,14 +23,18 @@ | |
"pnpm": "8.6.5" | ||
}, | ||
"pnpm": { | ||
"overrides": { | ||
"mime": "^3.0.0" | ||
}, | ||
"patchedDependencies": { | ||
"[email protected]": "patches/[email protected]", | ||
"@aws-sdk/[email protected]": "patches/@[email protected]", | ||
"@aws-sdk/[email protected]": "patches/@[email protected]", | ||
"[email protected]": "patches/[email protected]", | ||
"@aws-sdk/[email protected]": "patches/@[email protected]", | ||
"@aws-sdk/[email protected]": "patches/@[email protected]", | ||
"[email protected]": "patches/[email protected]" | ||
"[email protected]": "patches/[email protected]", | ||
"[email protected]": "patches/[email protected]" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
diff --git a/CHANGELOG.md b/CHANGELOG.md | ||
deleted file mode 100644 | ||
index cdf9be581e413715fefc1d72d146e35b98cd10ef..0000000000000000000000000000000000000000 | ||
diff --git a/Mime.js b/Mime.js | ||
index 969a66e41fbb6d7265562a657cb24b4e761969ee..63a8891041f07745af0f74d64941c3225f12951b 100644 | ||
--- a/Mime.js | ||
+++ b/Mime.js | ||
@@ -15,6 +15,8 @@ function Mime() { | ||
this.define = this.define.bind(this); | ||
this.getType = this.getType.bind(this); | ||
this.getExtension = this.getExtension.bind(this); | ||
+ this.lookup = this.lookup.bind(this); | ||
+ this.charsets.lookup = this.charsets.lookup.bind(this); | ||
} | ||
|
||
/** | ||
@@ -86,6 +88,15 @@ Mime.prototype.getType = function(path) { | ||
return (hasDot || !hasPath) && this._types[ext] || null; | ||
}; | ||
|
||
+ | ||
+Mime.prototype.lookup = Mime.prototype.getType; | ||
+Mime.prototype.charsets = { | ||
+ lookup: function(mimeType, fallback) { | ||
+ // Assume text types are utf8 | ||
+ return (/^text\/|^application\/(javascript|json)/).test(mimeType) ? 'UTF-8' : fallback; | ||
+ } | ||
+}; | ||
+ | ||
/** | ||
* Return file extension associated with a mime type | ||
*/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.