Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
babel-plugin-cloudinary
Advanced tools
Compile cloudinary URLs at build time.
You can define the globals for your cloudinary URLs in a cloudinaryrc.json
that should be placed in the root of your project.
{
"native": {
"cloud_name": "trivago",
"secure": true
},
"overrideBaseUrl": true,
"host": "trivago.images.com",
"defaultTransforms": {
"fetch_format": "auto",
"quality": "auto"
}
}
cloudinary-core
upon instantiation, you can use
all the configs in the official cloudinary API.res.cloudinary.com/trivago/image/upload
).option.transforms
of that __buildCloudinaryUrl
call.__buildCloudinaryUrl(assetName, options);
http[s]://host/<transforms>/<prefix><assetName><postfix><resourceExtension>
options
are entirely optional.{height: 250, width: 250}
).
For convince they will keep the same API as the cloudinary-core image transformations, these said you can check the official docs and use the cloudinary-core
API directly.assetName
.assetName
.assetName
, let's suppose that your assetName
is dog-picture
you can
simple pass dog-picture.jpeg
within the assetName
itself. This optional parameter is only here you to give you a more robust API and also the possibility to interpolate the prefix
and postfix
with the assetName
as you can see in the url above URL structure <prefix><assetName><postfix><resourceExtension>
.npm install babel-plugin-cloudinary
{
"plugins": ["babel-plugin-cloudinary"]
}
// gallery.js
function getImageUrl(imageName) {
// compiles into "`${'https://res.cloudinary.com/<cloud_name>/image/upload/'}${imageName}${'.jpeg'}`;"
return __buildCloudinaryUrl(imageName, {
transforms: {
width: 250,
height: 250,
},
resourceExtension: ".jpeg",
});
}
This projects ships together with the plugin a types definition file (index.d.ts
) that will
be automatically recognized by IDEs and text editors with typescript based IntelliSense. In case you have some linting in place it might also be convenient to make __buildCloudinaryUrl
a global. With eslint you can achieve this by adding a simple property to the globals
block just like:
// .eslintrc.js
module.exports = {
// ...
globals: {
// ...
__buildCloudinaryUrl: true,
},
// ...
};
FAQs
Compile cloudinary URLs at build time
The npm package babel-plugin-cloudinary receives a total of 1 weekly downloads. As such, babel-plugin-cloudinary popularity was classified as not popular.
We found that babel-plugin-cloudinary demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.