react-live
Advanced tools
Comparing version 4.0.1 to 4.1.0
@@ -1,9 +0,119 @@ | ||
import Editor from "./components/Editor"; | ||
import LiveProvider from "./components/Live/LiveProvider"; | ||
import LiveEditor from "./components/Live/LiveEditor"; | ||
import LiveError from "./components/Live/LiveError"; | ||
import LivePreview from "./components/Live/LivePreview"; | ||
import LiveContext from "./components/Live/LiveContext"; | ||
import withLive from "./hoc/withLive"; | ||
export * from "./utils/transpile"; | ||
export { Editor, LiveProvider, LiveEditor, LiveError, LivePreview, LiveContext, withLive, }; | ||
import { Prism, themes } from 'prism-react-renderer'; | ||
import * as React from 'react'; | ||
import React__default, { CSSProperties, PropsWithChildren, ComponentType } from 'react'; | ||
type Props$3 = { | ||
className?: string; | ||
code: string; | ||
disabled?: boolean; | ||
language: string; | ||
prism?: typeof Prism; | ||
style?: CSSProperties; | ||
tabMode?: "focus" | "indentation"; | ||
theme?: typeof themes.nightOwl; | ||
onChange?(value: string): void; | ||
}; | ||
declare const CodeEditor: { | ||
(props: Props$3): JSX.Element; | ||
defaultProps: Pick<Props$3, "tabMode">; | ||
}; | ||
type Props$2 = { | ||
code?: string; | ||
disabled?: boolean; | ||
enableTypeScript?: boolean; | ||
language?: string; | ||
noInline?: boolean; | ||
scope?: Record<string, unknown>; | ||
theme?: typeof themes.nightOwl; | ||
transformCode?(code: string): void; | ||
}; | ||
declare function LiveProvider({ children, code, language, theme, enableTypeScript, disabled, scope, transformCode, noInline, }: PropsWithChildren<Props$2>): JSX.Element; | ||
declare function LiveEditor(props: Partial<Props$3>): JSX.Element; | ||
declare function LiveError<T extends Record<string, unknown>>(props: T): JSX.Element | null; | ||
type Props$1<T extends React__default.ElementType = React__default.ElementType> = { | ||
Component?: T; | ||
} & React__default.ComponentPropsWithoutRef<T>; | ||
declare function LivePreview<T extends keyof JSX.IntrinsicElements>(props: Props$1<T>): JSX.Element; | ||
declare function LivePreview<T extends React__default.ElementType>(props: Props$1<T>): JSX.Element; | ||
type ContextValue = { | ||
error?: string; | ||
element?: ComponentType | null; | ||
code: string; | ||
disabled: boolean; | ||
language: string; | ||
theme?: typeof themes.nightOwl; | ||
onError(error: Error): void; | ||
onChange(value: string): void; | ||
}; | ||
declare const LiveContext: React.Context<ContextValue>; | ||
type Props = { | ||
live: Record<string, unknown>; | ||
}; | ||
declare function withLive<T>(WrappedComponent: ComponentType<T & Props>): { | ||
(props: T): JSX.Element; | ||
displayName: string; | ||
}; | ||
type GenerateOptions = { | ||
code: string; | ||
scope?: Record<string, unknown>; | ||
enableTypeScript: boolean; | ||
}; | ||
declare const generateElement: ({ code, scope, enableTypeScript }: GenerateOptions, errorCallback: (error: Error) => void) => { | ||
new (props: {} | Readonly<{}>): { | ||
componentDidCatch(error: Error): void; | ||
render(): JSX.Element | null; | ||
context: unknown; | ||
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void; | ||
forceUpdate(callback?: (() => void) | undefined): void; | ||
readonly props: Readonly<{}>; | ||
state: Readonly<{}>; | ||
refs: { | ||
[key: string]: React__default.ReactInstance; | ||
}; | ||
componentDidMount?(): void; | ||
shouldComponentUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): boolean; | ||
componentWillUnmount?(): void; | ||
getSnapshotBeforeUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>): any; | ||
componentDidUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>, snapshot?: any): void; | ||
componentWillMount?(): void; | ||
UNSAFE_componentWillMount?(): void; | ||
componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void; | ||
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void; | ||
componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void; | ||
UNSAFE_componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void; | ||
}; | ||
new (props: {}, context: any): { | ||
componentDidCatch(error: Error): void; | ||
render(): JSX.Element | null; | ||
context: unknown; | ||
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void; | ||
forceUpdate(callback?: (() => void) | undefined): void; | ||
readonly props: Readonly<{}>; | ||
state: Readonly<{}>; | ||
refs: { | ||
[key: string]: React__default.ReactInstance; | ||
}; | ||
componentDidMount?(): void; | ||
shouldComponentUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): boolean; | ||
componentWillUnmount?(): void; | ||
getSnapshotBeforeUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>): any; | ||
componentDidUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>, snapshot?: any): void; | ||
componentWillMount?(): void; | ||
UNSAFE_componentWillMount?(): void; | ||
componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void; | ||
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void; | ||
componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void; | ||
UNSAFE_componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void; | ||
}; | ||
contextType?: React__default.Context<any> | undefined; | ||
}; | ||
declare const renderElementAsync: ({ code, scope, enableTypeScript }: GenerateOptions, resultCallback: (sender: ComponentType) => void, errorCallback: (error: Error) => void) => void; | ||
export { CodeEditor as Editor, LiveContext, LiveEditor, LiveError, LivePreview, LiveProvider, generateElement, renderElementAsync, withLive }; |
{ | ||
"name": "react-live", | ||
"version": "4.0.1", | ||
"version": "4.1.0", | ||
"description": "A production-focused playground for live editing React code", | ||
"main": "dist/react-live.cjs.js", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"jsnext:main": "dist/react-live.es.js", | ||
"module": "dist/react-live.es.js", | ||
"jsnext:main": "dist/index.mjs", | ||
"module": "dist/index.mjs", | ||
"license": "MIT", | ||
"scripts": { | ||
"storybook": "start-storybook -p 9001", | ||
"storybook:build": "build-storybook -o .out", | ||
"prebuild:lib": "rm -rf lib/*", | ||
"prebuild": "yarn lint", | ||
"build": "rollup -c", | ||
"prepublishOnly": "npm run build", | ||
"test": "jest", | ||
"test:typings": "typings-tester --dir typings", | ||
"typecheck": "tsc --noEmit", | ||
"lint": "eslint --config .eslintrc \"./src/**/*.js\"", | ||
"install:docs": "yarn --cwd website install", | ||
"start:docs": "yarn --cwd website start", | ||
"build:docs": "yarn --cwd website build", | ||
"format:docs": "prettier --write docs", | ||
"changeset": "changeset", | ||
"version": "yarn changeset version" | ||
}, | ||
"dependencies": { | ||
"prism-react-renderer": "^1.3.1", | ||
"prism-react-renderer": "*", | ||
"sucrase": "^3.31.0", | ||
@@ -34,4 +16,4 @@ "use-editable": "^2.3.3" | ||
"devDependencies": { | ||
"shx": "^0.3.4", | ||
"@babel/core": "^7.15.0", | ||
"@babel/eslint-parser": "^7.15.0", | ||
"@babel/plugin-proposal-class-properties": "^7.14.5", | ||
@@ -43,8 +25,2 @@ "@babel/plugin-proposal-object-rest-spread": "^7.14.7", | ||
"@babel/preset-typescript": "^7.21.0", | ||
"@changesets/cli": "^2.26.1", | ||
"@rollup/plugin-babel": "^5.3.0", | ||
"@rollup/plugin-commonjs": "^20.0.0", | ||
"@rollup/plugin-node-resolve": "^13.0.4", | ||
"@rollup/plugin-replace": "^3.0.0", | ||
"@rollup/plugin-typescript": "^11.0.0", | ||
"@storybook/addon-controls": "^6.4.13", | ||
@@ -54,8 +30,5 @@ "@storybook/builder-webpack5": "^6.5.16", | ||
"@storybook/react": "^6.4.13", | ||
"@svitejs/changesets-changelog-github-compact": "^1.1.0", | ||
"@types/prismjs": "^1.26.0", | ||
"@types/react": "^18.0.31", | ||
"@types/styled-components": "^5.1.26", | ||
"@typescript-eslint/eslint-plugin": "^5.57.0", | ||
"@typescript-eslint/parser": "^5.57.0", | ||
"babel-jest": "^27.0.6", | ||
@@ -65,9 +38,3 @@ "babel-loader": "^8.2.2", | ||
"babel-plugin-transform-react-remove-prop-types": "^0.4.24", | ||
"eslint": "^8.7.0", | ||
"eslint-plugin-filenames": "^1.3.2", | ||
"eslint-plugin-import": "^2.25.4", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"eslint-plugin-react": "^7.28.0", | ||
"jest": "^27.0.6", | ||
"prettier": "^2.5.1", | ||
"prismjs": "^1.26.0", | ||
@@ -79,7 +46,4 @@ "prop-types": "^15.7.2", | ||
"react-test-renderer": "^17.0.2", | ||
"rollup": "^2.55.1", | ||
"rollup-plugin-filesize": "^9.1.1", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup-plugin-visualizer": "^5.5.4", | ||
"styled-components": "^4.0.0-beta.8", | ||
"tsup": "^6.7.0", | ||
"typescript": "^4.9", | ||
@@ -93,3 +57,3 @@ "typings-tester": "^0.3.1", | ||
"files": [ | ||
"src", | ||
"packages/react-live/src", | ||
"lib", | ||
@@ -125,3 +89,14 @@ "dist", | ||
}, | ||
"sideEffects": false | ||
} | ||
"sideEffects": false, | ||
"scripts": { | ||
"storybook": "start-storybook -p 9001", | ||
"storybook:build": "build-storybook -o .out", | ||
"build": "tsup", | ||
"build:watch": "tsup --watch", | ||
"test": "jest", | ||
"test:typings": "typings-tester --dir typings", | ||
"typecheck": "tsc --noEmit", | ||
"lint": "eslint --ext .js,.ts,.tsx src", | ||
"lint:fix": "eslint --ext .js,.ts,.tsx src --fix" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
31
1
3
73299
8
793
1
+ Added@types/prismjs@1.26.5(transitive)
+ Addedclsx@2.1.1(transitive)
+ Addedprism-react-renderer@2.4.0(transitive)
- Removedprism-react-renderer@1.3.5(transitive)
Updatedprism-react-renderer@*