New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More →
Socket
Sign inDemoInstall
Socket

@bazzite/nuxt-optimized-images

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bazzite/nuxt-optimized-images - npm Package Compare versions

Comparing version 0.1.0-beta.2 to 0.1.0

CHANGELOG.md

54

lib/index.js

@@ -8,4 +8,2 @@ /**

const consola = require('consola')
const { defaultConfig } = require('./config')

@@ -17,6 +15,3 @@ const {

} = require('./loaders')
const {
missingOptimizePackages,
imageOptimizationInDevMode
} = require('./warning')
const logger = require('./logger')

@@ -29,3 +24,3 @@ function nuxtOptimizedImages (moduleOptions) {

if (dev && options.optimizeImagesInDev) {
imageOptimizationInDevMode()
logger.imageOptimizationInDevMode()
}

@@ -35,3 +30,3 @@

const detectedLoaders = detectLoaders()
consola.debug('Detected Loaders', detectedLoaders)
logger.debug('Detected Loaders', detectedLoaders)

@@ -44,25 +39,34 @@ // check if it should optimize images in the current state

if (options.optimizeImages && getNumOptimizationLoadersInstalled(detectedLoaders) === 0 && optimizeInCurrentState) {
missingOptimizePackages()
logger.missingOptimizePackages()
}
this.extendBuild((config) => {
const testsRules = [
// nuxt >= 2 & nuxt <= 2.3.4
'/\\.(png|jpe?g|gif|svg|webp)$/',
// nuxt >= 2.4.0
'/\\.(png|jpe?g|gif|svg|webp)$/i'
]
const oldConfig = Object.assign({}, config)
testsRules.forEach(t => {
const rule = config.module.rules.find(r => r.test.toString() === t)
try {
const testsRules = [
// nuxt >= 2 & nuxt <= 2.3.4
'/\\.(png|jpe?g|gif|svg|webp)$/',
// nuxt >= 2.4.0
'/\\.(png|jpe?g|gif|svg|webp)$/i'
]
if (rule) {
config.module.rules.splice(config.module.rules.indexOf(rule), 1)
} else {
consola.debug(`Test Rule couldn't be found: ${t}`)
}
})
testsRules.forEach(t => {
const rule = config.module.rules.find(r => r.test.toString() === t)
// append loaders
return appendLoaders(config, options, detectedLoaders, optimizeInCurrentState)
if (rule) {
config.module.rules.splice(config.module.rules.indexOf(rule), 1)
} else {
logger.debug(`Test Rule couldn't be found: ${t}`)
}
})
// append loaders
config = appendLoaders(config, options, detectedLoaders, optimizeInCurrentState)
} catch (error) {
logger.error(error)
config = oldConfig
}
return config
})

@@ -69,0 +73,0 @@ }

{
"name": "@bazzite/nuxt-optimized-images",
"version": "0.1.0-beta.2",
"version": "0.1.0",
"description": "Automatically optimizes images used in Nuxt.js projects (jpeg, png, svg, webp and gif).",

@@ -25,3 +25,2 @@ "main": "lib/index.js",

"dependencies": {
"chalk": "^2.4.2",
"consola": "^2.5.6",

@@ -37,7 +36,7 @@ "imagemin": "^6.1.0",

"conventional-changelog-cli": "^2.0.12",
"eslint": "^5.14.1",
"eslint": "^5.15.1",
"eslint-config-dev": "^2.0.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jest": "^22.3.0",
"eslint-plugin-jest": "^22.3.2",
"eslint-plugin-node": "^8.0.1",

@@ -52,3 +51,3 @@ "eslint-plugin-promise": "^4.0.1",

"imagemin-svgo": "^7.0.0",
"jest": "^24.1.0",
"jest": "^24.5.0",
"jimp": "^0.6.0",

@@ -61,3 +60,3 @@ "loader-utils": "^1.2.3",

"sharp": "^0.21.3",
"upath": "^1.1.0",
"upath": "^1.1.2",
"webp-loader": "^0.4.0"

@@ -64,0 +63,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc