
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
import-jsx
Advanced tools
Require and transpile JSX on the fly
require()
hooksReact.createElement
) and falls back to h
pragma supported by Preact and others$ npm install --save import-jsx
const importJsx = require('import-jsx');
const reactComponent = importJsx('./react');
const preactComponent = importJsx('./preact');
const customComponent = importJsx('./custom', {pragma: 'x'});
React
const React = require('react');
module.exports = <div />;
Preact
const {h} = require('preact');
module.exports = <div />;
Any JSX pragma
const x = (tagName, attrs, ...children) => {};
module.exports = <div />;
Type: string
Module id.
Type: string
Default: h
Override JSX pragma.
Type: string
Default: Fragment
Override pragma for JSX fragments.
Type: boolean
Default: true
Cache transpiled source code.
Factory method to create a version of importJsx()
with pre-defined options.
Useful when you need a custom pragma, but don't want to pass it along with each importJsx()
call.
Type: object
Options to pass to importJsx()
.
// Before
const importJsx = require('import-jsx');
importJsx('./a', {pragma: 'x'});
importJsx('./b', {pragma: 'x'});
// After
const importJsx = require('import-jsx').create({pragma: 'x'});
importJsx('./a');
importJsx('./b');
FAQs
Require and transpile JSX on the fly
The npm package import-jsx receives a total of 25,217 weekly downloads. As such, import-jsx popularity was classified as popular.
We found that import-jsx 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.