tree-changes-hook
Advanced tools
Comparing version 0.10.0 to 0.11.0-alpha.0
@@ -1,4 +0,11 @@ | ||
import treeChanges, { Data, KeyType, TreeChanges } from 'tree-changes'; | ||
export default function useTreeChanges<T extends Data>(value: T): TreeChanges<KeyType<T, T>>; | ||
export { treeChanges }; | ||
export * from 'tree-changes'; | ||
import { Data, KeyType, TreeChanges, Value, default as treeChanges } from 'tree-changes'; | ||
declare function useTreeChanges<T extends Data>(value: T): TreeChanges<KeyType<T, T>>; | ||
declare namespace UseTreeChanges { | ||
export { Data, KeyType, TreeChanges, Value, treeChanges }; | ||
export { useTreeChanges as default }; | ||
} | ||
export = UseTreeChanges; |
@@ -20,4 +20,7 @@ "use strict"; | ||
}; | ||
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default")); | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
@@ -38,3 +41,2 @@ mod | ||
var import_tree_changes = __toESM(require("tree-changes")); | ||
__reExport(src_exports, require("tree-changes"), module.exports); | ||
function useTreeChanges(value) { | ||
@@ -60,2 +62,2 @@ const previousValue = (0, import_react.useRef)(value); | ||
}); | ||
//# sourceMappingURL=index.js.map | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "tree-changes-hook", | ||
"version": "0.10.0", | ||
"version": "0.11.0-alpha.0", | ||
"description": "React hook for tree-changes", | ||
@@ -24,4 +24,6 @@ "author": "Gil Barbara <gilbarbara@gmail.com>", | ||
"exports": { | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
".": { | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
} | ||
}, | ||
@@ -32,27 +34,28 @@ "files": [ | ||
], | ||
"types": "dist", | ||
"types": "dist/index.d.ts", | ||
"sideEffects": false, | ||
"peerDependencies": { | ||
"react": "16 - 18" | ||
"react": "16.8 - 18" | ||
}, | ||
"dependencies": { | ||
"@gilbarbara/deep-equal": "^0.1.1", | ||
"tree-changes": "^0.10.0" | ||
"@gilbarbara/deep-equal": "^0.3.1", | ||
"tree-changes": "workspace:*" | ||
}, | ||
"devDependencies": { | ||
"@testing-library/jest-dom": "^5.16.5", | ||
"@testing-library/react": "^13.4.0", | ||
"@types/react": "^18.0.18", | ||
"@types/react-dom": "^18.0.6", | ||
"@testing-library/jest-dom": "^6.1.4", | ||
"@testing-library/react": "^14.0.0", | ||
"@types/react": "^18.2.28", | ||
"@types/react-dom": "^18.2.13", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" | ||
"react-dom": "^18.2.0", | ||
"vitest": "^0.34.6" | ||
}, | ||
"scripts": { | ||
"build": "npm run clean && esbuilder --cjs --esm && npm run build:types", | ||
"build:types": "tsc --emitDeclarationOnly", | ||
"build": "npm run clean && tsup && ts-node scripts/fix-cjs-dts.ts", | ||
"watch": "tsup --watch", | ||
"clean": "del dist/*", | ||
"lint": "eslint src test", | ||
"test": "jest", | ||
"test:coverage": "jest --coverage --bail", | ||
"test:watch": "jest --watchAll --verbose", | ||
"test": "is-ci \"test:coverage\" \"test:watch\"", | ||
"test:coverage": "vitest run --coverage", | ||
"test:watch": "vitest watch", | ||
"typecheck": "tsc --noEmit", | ||
@@ -64,2 +67,14 @@ "format": "prettier \"**/*.{js,jsx,json,yml,yaml,css,less,scss,ts,tsx,md,graphql,mdx}\" --write", | ||
}, | ||
"tsup": { | ||
"dts": true, | ||
"entry": [ | ||
"src/index.ts" | ||
], | ||
"format": [ | ||
"cjs", | ||
"esm" | ||
], | ||
"sourcemap": true, | ||
"splitting": false | ||
}, | ||
"eslintConfig": { | ||
@@ -82,4 +97,3 @@ "extends": [ | ||
} | ||
], | ||
"gitHead": "ab73936e172ad07ccdf8b40006e82902fd175a26" | ||
] | ||
} |
@@ -7,4 +7,6 @@ import { useEffect, useRef } from 'react'; | ||
const previousValue = useRef(value); | ||
const isEqual = equal(previousValue.current, value); | ||
const previousIsEqual = useRef(isEqual); | ||
const instance = useRef<TreeChanges<KeyType<T, typeof previousValue.current>>>( | ||
@@ -28,2 +30,2 @@ treeChanges(previousValue.current, value), | ||
export { treeChanges }; | ||
export * from 'tree-changes'; | ||
export type { Data, KeyType, TreeChanges, Value } from 'tree-changes'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
12537
10
110
7
+ Added@gilbarbara/deep-equal@0.3.1(transitive)
- Removed@gilbarbara/deep-equal@0.1.2(transitive)
- Removedis-lite@0.9.3(transitive)
- Removedtree-changes@0.10.0(transitive)
Updatedtree-changes@workspace:*