Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
esbuild-ifdef-next
Advanced tools
This is fork of the [esbuild-ifdef](https://github.com/zziger/esbuild-ifdef) plugin with the latest version of esbuild. This esbuild plugin allows you to include/exclude code from your bundle conditionally on compile time using `/// #if` comments.
This is fork of the esbuild-ifdef plugin with the latest version of esbuild.
This esbuild plugin allows you to include/exclude code from your bundle conditionally on compile time using /// #if
comments.
# npm
npm install esbuild-ifdef-next
Example:
/// #if NODE_ENV === "production"
console.log('production specific code');
/// #elif NODE_ENV === "debug"
console.log('debug specific code');
/// #else
/// #warning Unknown NODE_ENV
console.log('something else');
/// #endif
All directives accept any valid javascript expressions. If blocks can be nested.
/// #if expression
/// #elseif expression
, /// #elif expression
/// #else
/// #endif
/// #warning text
, /// #warn text
- shows up a warning at compile time/// #error text
, /// #err text
- throws an error at compile timeesbuild.build({
entryPoints: ['./index.js'],
bundle: true,
target: 'es6',
outfile: './out.js',
plugins: [
ifdefPlugin({
variables: {
VARIABLE_NAME: 'variable value',
},
// ... plugin config
}),
],
});
Name | Type | Default | Description |
---|---|---|---|
verbose | boolean | false | Enabled logging of the included strings and expression results |
fillWithSpaces | boolean | false | Fill removed lines with spaces instead of commenting out |
requireTripleSlash | boolean | true | Require usage of /// before directives |
filePath | RegExp | /\.[jt]sx?/ | File matching RegExp. |
regExp | RegExp | - | Custom parsing RegExp. Overrides requireTripleSlash option. RegExp should have one group named token and one group named expression . Default RegExp for parsing triple slash directives is /\/\/\/[\s]*#(?<token>.*?)(?:[\s]+(?<expression>.*?))?[\s]*$/ |
variables | Record<string, any> | process.env | Variables for the expressions |
MIT
FAQs
This is fork of the [esbuild-ifdef](https://github.com/zziger/esbuild-ifdef) plugin with the latest version of esbuild. This esbuild plugin allows you to include/exclude code from your bundle conditionally on compile time using `/// #if` comments.
The npm package esbuild-ifdef-next receives a total of 3 weekly downloads. As such, esbuild-ifdef-next popularity was classified as not popular.
We found that esbuild-ifdef-next demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.