Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for /*#__PURE__*/ comments.
- Loading branch information
1 parent
162c0ac
commit 2c6b99f
Showing
4 changed files
with
69 additions
and
0 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
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,26 @@ | ||
const assert = require('assert'); | ||
|
||
module.exports = { | ||
description: 'functions marked with pure comment do not have effects', | ||
context: { | ||
require(id) { | ||
if (id === 'socks') { | ||
return () => '🧦'; | ||
} | ||
} | ||
}, | ||
code(code) { | ||
assert.ok(code.search(/socks\(\)/) === -1); | ||
}, | ||
warnings: [ | ||
{ | ||
code: 'UNRESOLVED_IMPORT', | ||
importer: 'main.js', | ||
message: | ||
"'socks' is imported by main.js, but could not be resolved – treating it as an external dependency", | ||
source: 'socks', | ||
url: | ||
'https://github.com/rollup/rollup/wiki/Troubleshooting#treating-module-as-external-dependency' | ||
} | ||
] | ||
}; |
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,3 @@ | ||
import socks from 'socks'; | ||
|
||
/*#__PURE__*/ socks(); |