Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
export-helper
Advanced tools
Nodejs utility to help compile TS modules into sweet es5 & es6 exports
Pretentious name for a tiny nodejs module that edits the last line of a file.
It basically turns export = myModule;
into export { myModule };
between tsc compilations (both ways supported)
Use it to compile into the syntax of Old (require()
, NOT require().default
) and a valid es6 module, in a single build command.
node >= 10
npm install --save-dev export-helper
npx export-helper es5 index.ts
npx export-helper es6 testFile.ts verbose
# npmjs/export-helper: "export = constant;" has successfully been replaced by "export { constant };" (testFile.ts)
Javascript file helper.js
:
const exportHelper = require("export-helper");
exportHelper({ mode: "es6", path: "testFile.ts" }).then((res) => res);
In terminal:
$ node helper.js
$ npmjs/export-helper: "export = constant;" has successfully been replaced by "export { constant };" (testFile.ts)
This function accepts an option object :
const options = {
mode: "es6", // needed. Available options: "es5", "es6". Untested options: "es5:withbrackets", "es6:default", "es6asDefault"
path: "testFile.ts", // needed. Path to file (./ is optional)
silent: false, // default to false; set to true to remove the log
linesToTrim: 1 /* default to 1.
You usually don't need this, but in case your IDE insert
an extra blank line between your module export and EOF,
incrementing that value should do the trick.
*/,
};
This script in my package.json :
{
...
"npm run build": "node rebuild.js && npx export-helper es5 src/index.ts && tsc -p tsconfig-cjs.json && px export-helper es6 src/index.ts && tsc -p tsconfig.json"
}
tsc -p tsconfig-cjs.json
: I'm calling tsc with this config filemodule.exports
, I call npx export-helper es6 src/index.ts
to change the source code once more.FAQs
Nodejs utility to help compile TS modules into sweet es5 & es6 exports
The npm package export-helper receives a total of 4 weekly downloads. As such, export-helper popularity was classified as not popular.
We found that export-helper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.