Skip to content

Commit

Permalink
Fix rollup plugin defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
davestewart committed Oct 30, 2021
1 parent 182cffa commit 8659ccf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alias-hq",
"version": "5.1.6",
"version": "5.1.7",
"description": "The end-to-end solution for configuring, refactoring, maintaining and using path aliases",
"main": "src/index.js",
"bin": "bin/alias-hq",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/rollup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const defaults = {

// @see https://github.com/rollup/plugins/tree/master/packages/alias
function callback (name, config, options) {
options = { ...defaults, ...options }
const { rootUrl, baseUrl } = config
name = name
.replace(/\/\*$/, '')
Expand All @@ -26,6 +25,7 @@ function callback (name, config, options) {
}

module.exports = function (config, options) {
options = { ...defaults, ...options }
return options.format === 'object'
? toObject(callback, config, options)
: toArray(callback, config, options)
Expand Down
25 changes: 16 additions & 9 deletions src/plugins/rollup/tests.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
const { abs } = require('../../utils')

const expected = {
'@': abs(''),
'@packages': abs('../packages'),
'@classes': abs('classes'),
'@app': abs('app'),
'@data': abs('app/data'),
'@services': abs('app/services'),
'@views': abs('app/views'),
}

module.exports = [
function () {
const label = 'default'
const options = {}
return { label, options, expected }
},

function () {
const label = 'object'
const options = {
format: 'object'
}
const expected = {
'@': abs(''),
'@packages': abs('../packages'),
'@classes': abs('classes'),
'@app': abs('app'),
'@data': abs('app/data'),
'@services': abs('app/services'),
'@views': abs('app/views'),
}
return { label, options, expected }
},

Expand Down

0 comments on commit 8659ccf

Please sign in to comment.