react-jsx-parser
Advanced tools
Comparing version 2.2.0 to 2.2.1
@@ -1,22 +0,50 @@ | ||
import React, { ComponentType, ExoticComponent } from 'react'; | ||
import React from 'react'; | ||
/** | ||
* Props for the JsxParser component | ||
*/ | ||
export type TProps = { | ||
/** Whether to allow rendering of unrecognized HTML elements. Defaults to true. */ | ||
allowUnknownElements?: boolean; | ||
/** | ||
* Whether to auto-close void elements like <img>, <br>, <hr> etc. in HTML style. | ||
* Defaults to false. | ||
*/ | ||
autoCloseVoidElements?: boolean; | ||
/** Object containing values that can be referenced in the JSX string */ | ||
bindings?: { | ||
[key: string]: unknown; | ||
}; | ||
/** | ||
* Array of attribute names or RegExp patterns to blacklist. | ||
* By default removes 'on*' attributes | ||
*/ | ||
blacklistedAttrs?: Array<string | RegExp>; | ||
/** | ||
* Array of HTML tag names to blacklist. | ||
* By default removes 'script' tags | ||
*/ | ||
blacklistedTags?: string[]; | ||
/** CSS class name(s) to add to the wrapper div */ | ||
className?: string; | ||
components?: Record<string, ComponentType | ExoticComponent>; | ||
/** Map of component names to their React component definitions */ | ||
components?: Record<string, React.ComponentType | React.ExoticComponent | (() => React.ReactNode)>; | ||
/** If true, only renders custom components defined in the components prop */ | ||
componentsOnly?: boolean; | ||
/** If true, disables usage of React.Fragment. May affect whitespace handling */ | ||
disableFragments?: boolean; | ||
/** If true, disables automatic generation of key props */ | ||
disableKeyGeneration?: boolean; | ||
/** The JSX string to parse and render */ | ||
jsx?: string; | ||
/** Callback function when parsing/rendering errors occur */ | ||
onError?: (error: Error) => void; | ||
/** If true, shows parsing/rendering warnings in console */ | ||
showWarnings?: boolean; | ||
/** Custom error renderer function */ | ||
renderError?: (props: { | ||
error: string; | ||
}) => React.ReactNode | null; | ||
/** Whether to wrap output in a div. If false, renders children directly */ | ||
renderInWrapper?: boolean; | ||
/** Custom renderer for unrecognized elements */ | ||
renderUnrecognized?: (tagName: string) => React.ReactNode | null; | ||
@@ -28,4 +56,9 @@ }; | ||
static defaultProps: TProps; | ||
/** Stores the parsed React elements */ | ||
private ParsedChildren; | ||
/** | ||
* Renders the parsed JSX content | ||
* @returns The rendered React elements wrapped in a div (if renderInWrapper is true) | ||
*/ | ||
render(): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined; | ||
} |
@@ -13,15 +13,15 @@ { | ||
"devDependencies": { | ||
"@happy-dom/global-registrator": "^14.12.3", | ||
"@types/acorn": "^4.0.6", | ||
"@happy-dom/global-registrator": "^15.7.4", | ||
"@types/acorn": "^6.0.0", | ||
"@types/bun": "^1.1.6", | ||
"@typescript-eslint/eslint-plugin": "^7.15.0", | ||
"@typescript-eslint/parser": "^7.15.0", | ||
"basis": "TroyAlford/basis", | ||
"concurrently": "^8.2.2", | ||
"@typescript-eslint/eslint-plugin": "^8.0.0", | ||
"@typescript-eslint/parser": "^8.0.0", | ||
"basis": "github:TroyAlford/basis#v1.1.0", | ||
"concurrently": "^9.0.1", | ||
"cross-env": "^7.0.3", | ||
"eslint": "^8.57.0", | ||
"eslint": "8.57.1", | ||
"eslint-config-airbnb": "^19.0.4", | ||
"eslint-plugin-import": "^2.29.1", | ||
"eslint-plugin-import": "2.31.0", | ||
"eslint-plugin-jsx-a11y": "^6.9.0", | ||
"eslint-plugin-react": "^7.34.3", | ||
"eslint-plugin-react": "7.37.2", | ||
"mkdirp": "^3.0.1", | ||
@@ -59,12 +59,12 @@ "react": "^18.3.1", | ||
"build": "bun build:types && bun build:code", | ||
"build:code": "bun build --target=browser --outfile=./dist/react-jsx-parser.min.js ./source/index.ts", | ||
"build:types": "bun run tsc -p ./tsconfig.json -d --emitDeclarationOnly", | ||
"build:code": "bun build --target=browser --outfile=./dist/react-jsx-parser.min.js ./source/index.ts --external react --external react-dom", | ||
"build:types": "bun run tsc -p ./tsconfig.json -d --emitDeclarationOnly --preserveWatchOutput", | ||
"develop": "NODE_ENV=production concurrently -n build,ts,demo -c green,cyan,yellow \"bun build:code --watch\" \"bun build:types --watch\" \"bun serve\"", | ||
"lint": "bun eslint --ext .js,.ts,.tsx source/", | ||
"prebuild": "mkdirp ./dist && rm -rf ./dist/*", | ||
"serve": "bun serve --port=8080 --open", | ||
"serve": "bun ./demo/server.ts", | ||
"test": "bun lint && bun test" | ||
}, | ||
"types": "dist/index.d.ts", | ||
"version": "2.2.0" | ||
"version": "2.2.1" | ||
} |
Sorry, the diff of this file is too big to display
High entropy strings
Supply chain riskContains high entropy strings. This could be a sign of encrypted data, leaked secrets or obfuscated code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
444265
11552
7