Comparing version 0.7.0 to 0.8.0
@@ -55,8 +55,7 @@ #!/usr/bin/env node | ||
const watcher = chokidar.watch(program.args, { | ||
ignored: /(^|[/\\])\../, // ignore dotfiles | ||
persistent: true | ||
}); | ||
if (opts.watch) { | ||
const watcher = chokidar.watch(program.args, { | ||
ignored: /(^|[/\\])\../, // ignore dotfiles | ||
persistent: true | ||
}); | ||
watcher.on('change', async (filename) => { | ||
@@ -69,14 +68,7 @@ console.log(`File ${filename} changed`); | ||
} else { | ||
await setTimeout(100); | ||
const watchedPaths = watcher.getWatched(); | ||
watcher.close(); | ||
const paths = Object.keys(watchedPaths); | ||
for (const pathKey of paths) { | ||
const points = watchedPaths[pathKey]; | ||
for (const point of points) { | ||
const filename = path.resolve(pathKey, point); | ||
if ((await stat(filename)).isFile()) { | ||
console.log(filename); | ||
await readModifyWrite(filename, opts, graphviz, 10); | ||
} | ||
const filenames = program.args.map(e => path.join(process.cwd(), e)); | ||
for (const filename of filenames) { | ||
if ((await stat(filename)).isFile()) { | ||
console.log(filename); | ||
await readModifyWrite(filename, opts, graphviz, 10); | ||
} | ||
@@ -83,0 +75,0 @@ } |
@@ -5,2 +5,3 @@ 'use strict'; | ||
const fsm = require('@wavedrom/fsm'); | ||
const myRequire = require('./my-require'); | ||
@@ -18,3 +19,3 @@ const extractSVG = (graphviz, cells) => { | ||
}; | ||
const ret = []; | ||
@@ -29,11 +30,7 @@ const $ = {}; | ||
try { /* eslint no-new-func: 1 */ | ||
res = new Function(` | ||
'use strict'; | ||
return (function (lib) { | ||
const {fsm, fin, range, $} = lib; | ||
return (${cell.src}); | ||
})`)()({ | ||
res = new Function(`'use strict'; return (function (lib) { const {fsm, fin, range, require, $} = lib; return (${cell.src}); })`)()({ | ||
fsm: fsmSvg, | ||
fin: undefined, | ||
range: range, | ||
require: myRequire, | ||
$ | ||
@@ -40,0 +37,0 @@ }); |
@@ -6,2 +6,3 @@ 'use strict'; | ||
const extractSVG = require('./extract-svg.js'); | ||
const myRequire = require('./my-require.js'); | ||
@@ -11,2 +12,2 @@ exports.parse = parse; | ||
exports.extractSVG = extractSVG; | ||
exports.require = myRequire; |
@@ -6,2 +6,3 @@ 'use strict'; | ||
const fsm = require('@wavedrom/fsm'); | ||
const myRequire = require('./my-require'); | ||
@@ -15,13 +16,8 @@ const update = (cells, filename) => { | ||
try { /* eslint no-new-func: 1 */ | ||
res = new Function(` | ||
'use strict'; | ||
return (function (lib) { | ||
const {fsm, fin, range, $, require} = lib; | ||
return (${cell.src}); | ||
})`)()({ | ||
res = new Function(`'use strict'; return (function (lib) { const {fsm, fin, range, $, require} = lib; return (${cell.src}); })`)()({ | ||
fsm: fsm.emit.verilog, | ||
fin: undefined, | ||
range, | ||
$, | ||
require: (pat) => require(path.join(path.dirname(filename), pat)) | ||
require: myRequire, | ||
$ | ||
}); | ||
@@ -28,0 +24,0 @@ } catch (err) { |
{ | ||
"name": "autodrom", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "auto verilog from comments", | ||
@@ -5,0 +5,0 @@ "author": "Aliaksei Chapyzhenka", |
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
8953
9
195