Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dr.pogodin/babel-plugin-transform-assets

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dr.pogodin/babel-plugin-transform-assets - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

19

build/index.js

@@ -7,15 +7,9 @@ "use strict";

exports.default = transformAssets;
var _fs = _interopRequireDefault(require("fs"));
var _path = require("path");
var _loaderUtils = require("loader-utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const defaultOptions = {
name: '[name].[ext]?[sha512:hash:base64:7]'
};
function transformAssets({

@@ -26,14 +20,10 @@ types: t

const dir = (0, _path.dirname)(filename);
if ((0, _path.isAbsolute)(dir)) {
return dir;
}
if (process.env.PWD) {
return (0, _path.resolve)(process.env.PWD, dir);
}
return (0, _path.resolve)(dir);
}
return {

@@ -45,10 +35,9 @@ visitor: {

}) {
const currentConfig = { ...defaultOptions,
const currentConfig = {
...defaultOptions,
...opts
};
if (typeof currentConfig.name !== 'string') {
return;
}
currentConfig.extensions = currentConfig.extensions || [];

@@ -61,7 +50,5 @@ const {

} = path.node;
if (calleeName !== 'require' || !args.length || !t.isStringLiteral(args[0])) {
return;
}
if (currentConfig.extensions.find(ext => args[0].value.endsWith(ext))) {

@@ -71,3 +58,2 @@ const [{

}] = args;
if (!t.isExpressionStatement(path.parent)) {

@@ -89,5 +75,4 @@ const from = resolveModulePath(file.opts.filename);

}
}
};
}

26

package.json
{
"name": "@dr.pogodin/babel-plugin-transform-assets",
"version": "1.1.1",
"version": "1.2.0",
"description": "Transforms importing of asset files at compile time using Babel",

@@ -46,19 +46,19 @@ "main": "build/index.js",

"dependencies": {
"loader-utils": "^2.0.0"
"loader-utils": "^3.2.0"
},
"devDependencies": {
"@babel/cli": "^7.12.1",
"@babel/core": "^7.12.3",
"@babel/preset-env": "^7.12.1",
"@babel/register": "^7.12.1",
"@babel/cli": "^7.19.3",
"@babel/core": "^7.19.6",
"@babel/preset-env": "^7.19.4",
"@babel/register": "^7.18.9",
"babel-eslint": "^10.1.0",
"chai": "^4.2.0",
"eslint": "^7.12.1",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.22.1",
"chai": "^4.3.6",
"eslint": "^8.25.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.26.0",
"gulp-babel": "^8.0.0-beta.2",
"gulp-util": "^3.0.7",
"mocha": "^8.2.1",
"rimraf": "^3.0.2"
"mocha": "^10.1.0",
"rimraf": "^3.0.2",
"vinyl": "^3.0.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