Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use default named export with plugins (#3529)
* Use default named export with plugins * Simplify named export detection logic to prevent untested case Co-authored-by: Lukas Taegert-Atkinson <lukas.taegert-atkinson@tngtech.com>
- Loading branch information
1 parent
a2b961d
commit e5cf74c
Showing
4 changed files
with
25 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
description: 'CLI --plugin with default export', | ||
skipIfWindows: true, | ||
command: `echo 'console.log(VALUE);' | rollup -p "./my-plugin={VALUE: 'default', ZZZ: 1}"` | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log("default"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
exports.default = function(options) { | ||
if (options === void 0) options = {}; | ||
return { | ||
transform(code) { | ||
// dumb search and replace for test purposes | ||
for (var key in options) { | ||
const rx = new RegExp(key, 'g'); | ||
const value = JSON.stringify(options[key]); | ||
code = code.replace(rx, value); | ||
} | ||
return code; | ||
} | ||
}; | ||
}; |