Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More β†’
Socket
Sign inDemoInstall
Socket

react-aptor

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-aptor - npm Package Compare versions

Comparing version 1.3.1 to 2.0.0-alpha.1

esm/index.mjs

4

esm/index.d.ts

@@ -1,3 +0,3 @@

import useAptor from './useAptor';
import { useAptor } from './use-aptor';
export default useAptor;
export * from './useAptor';
export * from './use-aptor';

@@ -1,3 +0,20 @@

import useAptor from './useAptor';
export default useAptor;
export * from './useAptor';
import { useState, useRef, useEffect, useMemo, useImperativeHandle } from 'react';
function useAptor(ref, configuration, deps = []) {
const [instance, setInstance] = useState(null);
const domRef = useRef(null);
const { instantiate, destroy, getAPI, params } = configuration;
useEffect(() => {
const instanceReference = instantiate(domRef.current, params);
setInstance(instanceReference);
return () => {
if (destroy)
destroy(instanceReference, params);
};
}, deps);
const api = useMemo(() => getAPI(instance, params), [instance]);
useImperativeHandle(ref, api, [api]);
return domRef;
}
export { useAptor as default, useAptor };
{
"name": "react-aptor",
"version": "1.3.1",
"version": "2.0.0-alpha.1",
"private": false,
"description": "React API connector",
"main": "lib/index.js",
"module": "esm/index.js",
"sideEffects": false,
"files": [
"lib/",
"esm/",
"src/"
],
"types": "lib/index.d.ts",
"typings": "lib/index.d.ts",
"publishConfig": {
"access": "public"
},
"author": {
"name": "Amir.H Ebrahimi",
"email": "amirhosseinebrahimi77@gmail.com"
},
"keywords": [

@@ -28,74 +11,44 @@ "api",

"aptor",
"apiHandler",
"reactApiHandler",
"thirdParty"
"handler",
"third-party"
],
"license": "MIT",
"homepage": "https://github.com/realamirhe/react-aptor#readme",
"bugs": {
"url": "https://github.com/realamirhe/react-aptor/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/amirHossein-Ebrahimi/react-aptor"
"url": "https://github.com/realamirhe/react-aptor"
},
"bugs": {
"url": "https://github.com/amirHossein-Ebrahimi/react-aptor/issues"
"license": "MIT",
"author": {
"name": "Amir.H Ebrahimi",
"email": "amirhosseinebrahimi77@gmail.com"
},
"homepage": "https://github.com/amirHossein-Ebrahimi/react-aptor#readme",
"scripts": {
"lint": "eslint src/**/*.ts",
"lint:fix": "yarn lint --fix",
"lint:types": "tsc --noEmit",
"prebuild": "yarn clean",
"build:cjs": "tsc",
"build:es": "tsc -m esNext --outDir esm",
"build": "yarn build:cjs && yarn build:es",
"clean": "rimraf lib esm"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"pre-push": "yarn lint && yarn clean && yarn build"
"sideEffects": false,
"exports": {
"./package.json": "./package.json",
".": {
"types": "./index.d.ts",
"module": "./esm/index.js",
"import": "./esm/index.mjs",
"default": "./index.js"
}
},
"lint-staged": {
"src/**/**/*.{ts,tsx}": [
"eslint --fix",
"git add"
]
},
"main": "./index.js",
"types": "./index.d.ts",
"files": [
"**"
],
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0",
"react-dom": "^16.8.0 || ^17.0.0"
"react": ">=16.8"
},
"devDependencies": {
"@babel/core": "7.13.14",
"@babel/plugin-syntax-dynamic-import": "7.8.3",
"@babel/preset-env": "7.13.12",
"@babel/preset-react": "7.13.13",
"@babel/preset-typescript": "7.13.0",
"@types/react": "^17.0.0",
"@typescript-eslint/eslint-plugin": "4.21.0",
"@typescript-eslint/parser": "4.21.0",
"babel-core": "6.26.3",
"babel-eslint": "10.1.0",
"babel-loader": "8.2.2",
"babel-plugin-dynamic-import-node": "2.3.3",
"eslint": "7.23.0",
"eslint-config-prettier": "7.2.0",
"eslint-config-react-app": "6.0.0",
"eslint-plugin-flowtype": "5.6.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-jsx-a11y": "6.4.1",
"eslint-plugin-prettier": "3.3.1",
"eslint-plugin-react": "7.23.1",
"eslint-plugin-react-hooks": "4.2.0",
"fork-ts-checker-webpack-plugin": "6.2.0",
"husky": "6.0.0",
"lint-staged": "10.5.4",
"prettier": "2.2.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"rimraf": "3.0.2",
"ts-loader": "8.1.0",
"ts-node": "9.1.1",
"typescript": "4.1.5"
"peerDependenciesMeta": {
"react": {
"optional": true
}
},
"engines": {
"node": ">=12.7.0"
}
}
<h1 align="center">React Aptor</h1>
<p align="center"><img src="./doc/assets/logo.svg" alt="react aptor logo" width="450"></p>
<p align="center"><img src="https://github.com/realamirhe/react-aptor/raw/master/doc/assets/logo.svg" alt="react aptor logo" width="450"></p>
<p align="center">

@@ -11,3 +11,3 @@ Minimal API Connector for react

<p align="center">
<a href="https://github.com/amirHossein-Ebrahimi/react-aptor/blob/master/license">
<a href="https://github.com/realamirhe/react-aptor/blob/master/license">
<img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="license" />

@@ -21,4 +21,4 @@ </a>

</a>
<a href="https://lgtm.com/projects/g/amirHossein-Ebrahimi/react-aptor/context:javascript">
<img src="https://img.shields.io/lgtm/grade/javascript/g/amirHossein-Ebrahimi/react-aptor.svg?logo=lgtm&logoWidth=18" alt="Language grade: JavaScript" />
<a href="https://lgtm.com/projects/g/realamirhe/react-aptor/context:javascript">
<img src="https://img.shields.io/lgtm/grade/javascript/g/realamirhe/react-aptor.svg?logo=lgtm&logoWidth=18" alt="Language grade: JavaScript" />
</a>

@@ -29,5 +29,4 @@ </p>

English | <a href="./doc/localization/fa.md">Persian</a> | (<a href="https://github.com/amirHossein-Ebrahimi/react-aptor/issues/new">add your langauge</a>)
English | <a href="https://github.com/realamirhe/react-aptor/blob/master/doc/localization/fa.md">Persian</a> | (<a href="https://github.com/realamirhe/react-aptor/issues/new">add your language</a>)
Don’t waste your time by finding react version of your favorite javascript package, keep control of your `API` now.

@@ -37,3 +36,2 @@

## Why

@@ -48,4 +46,4 @@

**Other Concerns**:
**Other Concerns**:
- Finding DOM nodes by ReactDOM.findDOMNode

@@ -302,2 +300,3 @@ - Extensively usage of memorization to improve performance or prevent extra re-renders

You can use something like the follwing:
```ts

@@ -366,11 +365,11 @@ export type APITypes = ReturnType<ReturnType<typeof getAPI>>;

![#c7589e](https://via.placeholder.com/30/c7589e/000000?text=+ "#c7589e")
![#ed5b6e](https://via.placeholder.com/30/ed5b6e/000000?text=+ "#ed5b6e")
![#f9b919](https://via.placeholder.com/30/f9b919/000000?text=+ "#f9b919")
![#26abe2](https://via.placeholder.com/30/26abe2/000000?text=+ "#26abe2")
![#129f4d](https://via.placeholder.com/30/129f4d/000000?text=+ "#129f4d")
![#c7589e](https://via.placeholder.com/30/c7589e/000000?text=+ '#c7589e')
![#ed5b6e](https://via.placeholder.com/30/ed5b6e/000000?text=+ '#ed5b6e')
![#f9b919](https://via.placeholder.com/30/f9b919/000000?text=+ '#f9b919')
![#26abe2](https://via.placeholder.com/30/26abe2/000000?text=+ '#26abe2')
![#129f4d](https://via.placeholder.com/30/129f4d/000000?text=+ '#129f4d')
## Samples
**NOTE**: Add your favorite package to the following list by creating a [new issue](https://github.com/amirHossein-Ebrahimi/react-aptor/issues).
**NOTE**: Add your favorite package to the following list by creating a [new issue](https://github.com/realamirhe/react-aptor/issues).

@@ -384,4 +383,4 @@ <a href="https://codesandbox.io/s/react-aptor--fabric-hp50c" title="codesandbox | fabric.js">

&nbsp;&nbsp;
<a href="https://github.com/amirHossein-Ebrahimi/raptor-howler" title="github | react-howler">
<img src="https://raw.githubusercontent.com/amirHossein-Ebrahimi/raptor-howler/master/doc/assets/logo.svg" width="150">
<a href="https://github.com/realamirhe/raptor-howler" title="github | react-howler">
<img src="https://raw.githubusercontent.com/realamirhe/raptor-howler/master/doc/assets/logo.svg" width="150">
</a>

@@ -388,0 +387,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc