@dr.pogodin/babel-plugin-transform-assets
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -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); | ||
} | ||
} | ||
}; | ||
} |
{ | ||
"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" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70
6889
+ Addedloader-utils@3.3.1(transitive)
- Removedbig.js@5.2.2(transitive)
- Removedemojis-list@3.0.0(transitive)
- Removedjson5@2.2.3(transitive)
- Removedloader-utils@2.0.4(transitive)
Updatedloader-utils@^3.2.0