
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
@goto-bus-stop/common-shake
Advanced tools
This is a fork of indutny/common-shake, pending #3.
See webpack-common-shake for webpack plugin. See common-shakeify for a browserify plugin.
const acorn = require('acorn');
const Analyzer = require('@goto-bus-stop/common-shake').Analyzer;
const a = new Analyzer();
a.run(acorn.parse(`
'use strict';
const lib = require('./a.js');
exports.a = lib.a;
`, { locations: true }), 'index.js');
a.run(acorn.parse(`
'use strict';
exports.a = 42;
`, { locations: true }), 'a.js');
a.resolve('index.js', './a.js', 'a.js');
console.log(a.isSuccess(), a.bailouts);
// true false
console.log(a.getModule('index.js').getInfo());
// { bailouts: false, declarations: [ 'a' ], uses: [] }
console.log(a.getModule('a.js').getInfo());
// { bailouts: false, declarations: [ 'a' ], uses: [ 'a' ] }
const module = a.getModule('a.js');
a.getDeclarations().forEach((decl) => {
console.log(module.isUsed(decl.name) ? 'used' : 'not used');
console.log(decl.name, decl.ast);
});
// If you want to mark all exported values of module as used:
a.getModule('root').forceExport();
For debugging and inspection purposes a graph in dot format may be generated from the modules hierarchy using following API:
const Graph = require('@goto-bus-stop/common-shake').Graph;
const graph = new Graph('/path/to/working/dir');
console.log(graph.generate(analyzer.getModules()));
This software is licensed under the MIT License.
Copyright Fedor Indutny, 2017.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
CommonJS Tree Shake (fork)
The npm package @goto-bus-stop/common-shake receives a total of 19,714 weekly downloads. As such, @goto-bus-stop/common-shake popularity was classified as popular.
We found that @goto-bus-stop/common-shake 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
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.