Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
babel-plugin-source-map-support
Advanced tools
Changelog
2.2.0 - 2022-06-22
Readme
babel-plugin-source-map-support - a Babel plugin which automatically makes stack traces source-map aware
$ npm install source-map-support --save
$ npm install babel-plugin-source-map-support --save-dev
$ cat test.js
import foo from 'foo';
import bar from 'bar';
foo(bar);
$ babel --plugins source-map-support test.js
import 'source-map-support/register';
import foo from 'foo';
import bar from 'bar';
foo(bar);
This is a Babel plugin which prepends the following statement to source files:
import 'source-map-support/register';
In conjunction with the source-map-support module, which must be installed separately, this statement hooks into the v8 stack-trace API to translate call sites in the transpiled code back to their corresponding locations in the original code.
Note: this only works in environments which support the v8 stack-trace API (e.g. Node.js and Chrome), though it's harmless in other environments.
The source-map-support module only needs to be registered in the top-level file(s) of an application, but it no-ops if it has already been loaded, so there's no harm in registering it in every file.
You probably don't want to use this plugin when compiling code for the web
because you probably don't want to bundle source-maps and the
source-map-support module in minified code. An easy way to limit the plugin's
scope to development/test builds is to use Babel's
env
option, e.g.:
{
env: {
development: {
sourceMaps: 'inline',
plugins: ['source-map-support', ...]
}
},
presets: [ ... ]
}
Note that source-maps don't need to be inlined in each file. They can be
externalised by using the { sourceMaps: true }
option. This adds a link to
the bottom of each file which points to its generated source-map, e.g.:
{
env: {
development: {
sourceMaps: true,
plugins: ['source-map-support', ...]
}
},
}
// index.js footer:
//# sourceMappingURL=index.js.map
The following NPM scripts are available:
dist
directorydist
directory and other build artifactstest
script in debug mode, which dumps each transformed test case2.2.0
Copyright © 2015-2022 by chocolateboy.
This module is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.
FAQs
A Babel plugin which automatically makes stack traces source-map aware
The npm package babel-plugin-source-map-support receives a total of 108,189 weekly downloads. As such, babel-plugin-source-map-support popularity was classified as popular.
We found that babel-plugin-source-map-support 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.