Rollup plugin to automatically preserve shebangs in entry modules.
by developitLast 12 weeks · 0 commits
1 of 6 standards met
This plugin is missing tests, so I wrote some integration tests that test the plugin with rollup. Changes Adds integration tests in rollup + plugin Adds a github workflow file to run tests in PRs and merge to Adds a status badge to the README Fixed a bug that breaks the build if there is whitespace leading the shebang (and corrects the problem by removing the leading whitespace) Updated the README (including removing mention of unsupported code) Adds a status badge to the README Workflow status Here is proof that the tests are running and passing on my branch: and here is the status badge: WDYT @developit ?
Repository: developit/rollup-plugin-preserve-shebang. Description: Rollup plugin to automatically preserve shebangs in entry modules. Stars: 48, Forks: 5. Primary language: JavaScript. Languages: JavaScript (100%). Homepage: https://npm.im/rollup-plugin-preserve-shebang Topics: hashbang, nodejs, rollup, rollup-plugin, shebang. Latest release: 1.0.1 (5y ago). Open PRs: 2, open issues: 0. Last activity: 1y ago. Community health: 28%. Top contributors: developit, w-k, darahak, jaredpalmer, greenkeeper[bot].
JavaScript
Add support for CommonJS files loaded with . If try to run rollup-plugin-preserve-shebang on a CommonJS file (e.g. one that uses syntax instead of ), @rollup/plugin-commonjs will append to the end of the id. This means that will fail to add the shebang back to the file, since the is different. E.g. in , However, in , . In order to get the original module id, you need to remove .
I updated my Node.js to the latest LTS which is and apparently they unflagged ESM. When I tried using this plugin, I got this error: According to the docs, takes precedence over in , so all people who use a version of Node.js with unflagged ESM will probably get this error. I just changed the paths to include the dot. It worked for me when I monkey patched it in my project.