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-transform-dynamic-imports-to-static-imports
Advanced tools
Changelog
[1.0.0][] - 2021-03-31
Readme
A transform to translate dynamic imports to static imports
npm install babel-plugin-transform-dynamic-imports-to-static-imports
with configuration file:
{
"plugins": ["babel-plugin-transform-dynamic-imports-to-static-imports"]
}
Via CLI
babel --plugins babel-plugin-transform-dynamic-imports-to-static-imports script.js
via node API
require("@babel/core").transform("code", {
plugins: ["babel-plugin-transform-dynamic-imports-to-static-imports"],
});
input:
import * as zero from "./zero";
import "./one";
async function test() {
import("./two");
await import("./three");
import("./four")
.then((test) => {
/* do something */
})
.then();
await import("./five").then((test) => {
/* do something */
});
}
output:
import * as $$1 from "./five";
import * as $$0 from "./four";
import "./three";
import "./two";
import * as zero from "./zero";
import "./one";
async function test() {
Promise.resolve($$0)
.then((test) => {
/* do something */
})
.then();
await Promise.resolve($$1).then((test) => {
/* do something */
});
}
for more examples see test.js
dynamic imports with dynamic paths do not have a static equivalent.
async function test() {
import(`dynamic${test}`);
await import(`dynamic${test}`);
import(`dynamic${test}`)
.then((test) => {
/* do something */
})
.then();
await import(`dynamic${test}`).then((test) => {
/* do something */
});
}
will output:
async function test() {
import(`dynamic${test}`);
await import(`dynamic${test}`);
import(`dynamic${test}`)
.then((test) => {
/* do something */
})
.then();
await import(`dynamic${test}`).then((test) => {
/* do something */
});
}
for more examples see test.js
FAQs
transform dynamic import to static imports
The npm package babel-plugin-transform-dynamic-imports-to-static-imports receives a total of 1,236 weekly downloads. As such, babel-plugin-transform-dynamic-imports-to-static-imports popularity was classified as popular.
We found that babel-plugin-transform-dynamic-imports-to-static-imports demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.