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.
babel-timing
Advanced tools
Measure Babel compilation time file by file, plugin by plugin. See screenshot.
Get Babel transpilation insights when your application or your tests take ages to build.
Note: this tool is in version 0, any minor release might introduce breaking changes.
Can be installed both as global or local dependency.
npm i babel-timing
yarn add babel-timing
babel-timing path/to/file-1.js path/to/file-2.js
babel-timing path/to/file-*.js
babel-timing path/to/entrypoint.js --follow-imports
const babelTiming = require('babel-timing').babelTiming;
const results = await babelTiming(['path/to/file.js'], options);
Hook babel-timing
into your actual Webpack bundling process.
babel-timing/webpack/plugin
to Webpack configuration:const BabelTimingPlugin = require('babel-timing/webpack/plugin');
customize
option to the existing babel-loader
configuration:use: {
loader: 'babel-loader',
+ options: {
+ customize: require.resolve('babel-timing/webpack/babel-loader-customize')
+ },
}
babel-timing/webpack/plugin
plugin (accepts output
and outputPath
options):plugins: [
// ...
+ new BabelTimingPlugin(),
]
babelConfig
/ --babel-config
Type: string | false
Default: undefined
Path to a custom babel configuration file. By default Babel will try to load any existing valid configuration file.
followImports
/ --follow-imports
(experimental)Type: bool
Default: false
Follow imported files/modules and run babel-timing
against them.
include
/ --include
Type: string[]
(cli accepts a string containing a comma-separated list)
Default: ['**']
Include paths (imported ones also) according to the provided glob patterns.
exclude
/ --exclude
Type: string[]
(cli accepts a string containing a comma-separated list)
Default: ['**/modules/**']
Exclude paths (imported ones also) according to the provided glob patterns.
resolveMainFields
/ --resolve-main-fields
Type: string[]
(cli accepts a string containing a comma-separated list)
Default: ['browser', 'module', 'main']
Determine which fields in imported modules's package.json
are checked.
expandPackages
/ --expand-packages
Type: bool
Default: false
Expand results relative to node_modules
packages file by file.
output
/ --output
Type: string
Default: "return"
("console"
when called via CLI/Webpack)
Options: "return"
, "console"
, "json"
Make babel-timing
results available as:
"return"
return results' object"console"
render results in console"json"
save results as babel-timing-results.json
outputPath
/ --output-path
Type: string
Default: "./babel-timing-results.json"
Path of output file in case output
option is set to "json"
.
verbose
/ --verbose
Type: bool
Default: false
Log warnings.
Compile files with Babel 7 and get collect compilation info through wrapPluginVisitorMethod
Babel config option.
Compilation info are extracted into the following data structure:
type Results = {
name: string,
totalTime: number,
plugins: {
plugin: string,
timePerVisit: number,
time: number,
visits: number,
}[]
}[]
This tool started as an attempt of measuring the time taken by Babel while running transpiled tests and compiling Webpack applications.
The main difficulty of monitoring Babel while running the aforementioned tools, consists of relating the wrapPluginVisitorMethod
calls to the files actually being compiled.
Any further idea/contribution to get to a better Babel monitoring solution is welcome.
node cli.js __fixtures__/file-1.js
node cli.js __fixtures__/file-1.js __fixtures__/file-2.js
node cli.js __fixtures__/*.js
node cli.js __fixtures__/entry.js --follow-imports
csv
output optionwrapPluginVisitorMethod
babel-timing
from other tools like jest
, rollup
, etc..webpack
integrationfollowImports
more reliable0.3.0
babel-timing/webpack/plugin
and babel-timing/webpack/babel-loader-customize
outputPath
optionFAQs
Measure Babel compilation time
The npm package babel-timing receives a total of 4,177 weekly downloads. As such, babel-timing popularity was classified as popular.
We found that babel-timing 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.
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.