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.
@tokey/imports-parser
Advanced tools
Parser for esm
like import syntax with support for "functional" tagged imports
import Name1, { Name2, Name3 as Name4, Tag(Name5) } from "request";
The output of parsing an import is represented with the following type:
interface ImportValue {
star: boolean;
defaultName: string | undefined;
named: Record<string, string> | undefined;
tagged: Record<string, Record<string, string>> | undefined;
from: string | undefined;
errors: string[];
start: number;
end: number;
}
Notice that this parser can parse broken/incomplete syntax and all the errors will be available in the "error" field.
The parser parses multiple imports and the result is an
ImportValue[]
import { parseImports, ImportValue } from "@tokey/imports-parser";
const code = `
import { a } from "request/a";
import "request/b";
`;
const startNamedBlock = '{'; // default
const endNamedBlock = '}'; // default
const shouldParseTags = false // default
const results: ImportValue[] = parseImports(code, startNamedBlock, endNamedBlock, shouldParseTags);
const firstImport = results[0];
firstImport.from === 'request/a'; // true
firstImport.named['a'] === 'a'; // true
FAQs
parser for esm like imports
The npm package @tokey/imports-parser receives a total of 1,364 weekly downloads. As such, @tokey/imports-parser popularity was classified as popular.
We found that @tokey/imports-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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
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.