Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
pegjs-require-import
Advanced tools
A simple require extension for PEG.js that supports importing syntax
If you're using webpack, it's recommended to use pegjs-import-loader
npm install --save-dev pegjs-require-import
parser.pegjs:
{
const str = 'This is just an example string';
function concat(a, b) {
return a.concat(b);
}
}
Expression
= head:Term tail:(_ ("+" / "-") _ Term)* {
return tail.reduce(function(result, element) {
if (element[1] === "+") { return result + element[3]; }
if (element[1] === "-") { return result - element[3]; }
}, head);
}
Factor
= "(" _ expr:Expression _ ")" { return expr; }
/ Integer
@import './base-rules.pegjs'
@import './keywords.pegjs'
Import syntax is the same as in pegjs-import-loader
const pegjs_require = require('pegjs-require-import');
const parser = pegjs_require('./parser.pegjs', {
format: 'commonjs',
dependencies: {
_: 'lodash'
}
});
const result = parser.parse(content);
Type: object
See more about PEG.js options
FAQs
PEG.js Require Extension
We found that pegjs-require-import 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
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.