Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@a-la/detect-jsx
Advanced tools
@a-la/detect-jsx
Detects Position Of JSX Tag In JavaScript File.
yarn add -E @a-la/detect-jsx
The package is available by importing its default function:
import detectJsx from '@a-la/detect-jsx'
detectJsx(
string: string,
): number
Returns the position of the first JSX tag by evaluating the code using Node's vm
package: since JSX reference will throw an error, this error can be caught and used to find out the index of the opening <
symbol in JSX.
For example, given the following JSX component:
const Component = ({ example }) => (
<div class="Test" id={example}></div>
)
It is possible to detect where JSX
starts:
/* yarn example/ */
import read from '@wrote/read'
import detectJSX from '@a-la/detect-jsx'
(async () => {
const code = await read('example/Component.jsx')
const res = detectJSX(code)
console.log(res)
})()
39
(c) À La Mode 2019
1.0.2
FAQs
Detects Position Of JSX Tag In JavaScript File.
The npm package @a-la/detect-jsx receives a total of 40 weekly downloads. As such, @a-la/detect-jsx popularity was classified as not popular.
We found that @a-la/detect-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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.