Comparing version 2.5.9 to 2.5.10
{ | ||
"name": "dob", | ||
"version": "2.5.9", | ||
"version": "2.5.10", | ||
"description": "", | ||
"main": "built/src/index.js", | ||
"types": "src/index.ts", | ||
"main": "dist/src/index.js", | ||
"types": "src/index.tsx", | ||
"scripts": { | ||
"test": "tsc && nyc --reporter=lcov --reporter=text --reporter=json ava && rm -rf .nyc_output", | ||
"test": "pri test", | ||
"posttest": "codecov -f coverage/*.json -t bc4c34e2-24cb-4b05-8b97-7f30395e642b", | ||
"prepublish": "rm -rf built && tsc && npm run build", | ||
"start": "run-react develop", | ||
"start": "pri dev", | ||
"tslint": "tslint './src/**/*.?(ts|tsx)'", | ||
"build": "run-react production" | ||
"build": "pri build", | ||
"docs": "pri docs", | ||
"bundle": "pri bundle", | ||
"preview": "pri preview", | ||
"analyse": "pri analyse", | ||
"format": "tslint --fix './src/**/*.?(ts|tsx)' && prettier --write './src/**/*.?(ts|tsx)'", | ||
"prepublishOnly": "npm run build", | ||
"release": "npm publish" | ||
}, | ||
"ava": { | ||
"files": [ | ||
"built/**/*.test.js" | ||
] | ||
}, | ||
"repository": { | ||
@@ -24,3 +25,3 @@ "type": "git", | ||
}, | ||
"author": "", | ||
"author": "ascoders", | ||
"license": "ISC", | ||
@@ -32,24 +33,7 @@ "bugs": { | ||
"devDependencies": { | ||
"@types/classnames": "*", | ||
"@types/lodash": "*", | ||
"@types/react": "*", | ||
"@types/react-dom": "*", | ||
"@types/webpack": "*", | ||
"ascoders-tslint-config": "^1.0.2", | ||
"ava": "^0.18.2", | ||
"classnames": "^2.2.5", | ||
"codecov": "^2.3.0", | ||
"css-loader": "^0.28.4", | ||
"nyc": "^11.1.0", | ||
"pre-commit": "^1.2.2", | ||
"react": "^15.6.1", | ||
"react-dom": "^15.5.4", | ||
"run-react": "^2.2.4", | ||
"style-loader": "^0.18.2", | ||
"todomvc-app-css": "^2.1.0", | ||
"tslint": "^5.8.0", | ||
"typescript": "^2.4.1", | ||
"webpack": "^3.3.0" | ||
"pri": "^1.0.0-beta70" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.0.0", | ||
"dependency-inject": "^1.1.5", | ||
@@ -61,27 +45,5 @@ "lodash.clonedeep": "^4.5.0" | ||
], | ||
"run-react": { | ||
"entrys": [ | ||
"demos/reaction" | ||
], | ||
"productionEntrys": [ | ||
"src/index" | ||
], | ||
"rules": [ | ||
{ | ||
"test": ".css$", | ||
"use": [ | ||
"style-loader", | ||
"css-loader" | ||
] | ||
} | ||
], | ||
"dlls": [ | ||
"react", | ||
"react-dom" | ||
], | ||
"production": { | ||
"path": "built", | ||
"filename": "bundle.js" | ||
} | ||
"pri": { | ||
"type": "component" | ||
} | ||
} |
@@ -1,9 +0,7 @@ | ||
# Dob · [](https://travis-ci.org/dobjs/dob) [](https://www.npmjs.com/package/dob) [](https://codecov.io/github/dobjs/dob) | ||
<p align="center"> | ||
<img src="https://avatars1.githubusercontent.com/u/32093464?s=400&u=d360e449a9d59cf7422100349711ab0e0389d06a&v=4" height=100/> | ||
<h3 align="center">dob</h3> | ||
<h2 align="center">Dob</h2> | ||
<p align="center"> | ||
<i> | ||
Dob is a tool for monitoring object changes. Using <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy">Proxy</a>. | ||
Dob is a tool for monitoring object changes. Using <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy">Proxy</a>. <a target="_blank" href="https://dobjs.github.io/dob-docs/">Online Docs</a>. | ||
</i> | ||
@@ -13,3 +11,11 @@ <p> | ||
<i> | ||
<a target="_blank" href="https://dobjs.github.io/dob-docs/">Online Docs</a>. | ||
<a href="https://travis-ci.org/dobjs/dob"> | ||
<img src="https://img.shields.io/travis/dobjs/dob/master.svg?style=flat" alt="CircleCI Status"> | ||
</a> | ||
<a href="https://www.npmjs.com/package/dob"> | ||
<img src="https://img.shields.io/npm/v/dob.svg?style=flat" alt="NPM Version"> | ||
</a> | ||
<a href="https://codecov.io/github/dobjs/dob"> | ||
<img src="https://img.shields.io/codecov/c/github/dobjs/dob/master.svg" alt="Code Coverage"> | ||
</a> | ||
</i> | ||
@@ -16,0 +22,0 @@ </p> |
@@ -48,3 +48,3 @@ import { globalState } from "../global-state" | ||
const oldValue = this.get(key) | ||
const result = native.set.apply(this, arguments) | ||
const result = native.set.apply(this, arguments as any) as any | ||
@@ -62,3 +62,3 @@ globalState.event.emit("set", { target, key, oldValue, value }) | ||
const has = this.has(key) | ||
const result = native.delete.apply(this, arguments) | ||
const result = native.delete.apply(this, arguments as any) as any | ||
@@ -65,0 +65,0 @@ globalState.event.emit("deleteProperty", { target, key }) |
@@ -43,3 +43,3 @@ import { globalState } from "../global-state" | ||
const has = this.has(value) | ||
const result = native.add.apply(this, arguments) | ||
const result = native.add.apply(this, arguments as any) as any | ||
@@ -57,3 +57,3 @@ globalState.event.emit("set", { target, key: null, value, oldValue: null }) | ||
const has = this.has(value) | ||
const result = native.delete.apply(this, arguments) | ||
const result = native.delete.apply(this, arguments as any) as any | ||
@@ -60,0 +60,0 @@ globalState.event.emit("deleteProperty", { target, key: null }) |
@@ -1,3 +0,3 @@ | ||
import { IDebugInfo } from "../global-state" | ||
export declare type EventType = number | string | ||
import { IDebugInfo } from '../global-state'; | ||
export declare type EventType = number | string; | ||
@@ -8,10 +8,10 @@ /** | ||
export interface IEvent { | ||
callback: (context?: any) => void | ||
callback: (context?: any) => void; | ||
} | ||
export type ICallback = (context?: any) => void | ||
export type ICallback = (context?: any) => void; | ||
export class Event { | ||
// 所有事件 | ||
private events: Map<EventType, IEvent[]> = new Map() | ||
private events: Map<EventType, IEvent[]> = new Map(); | ||
@@ -21,31 +21,46 @@ /** | ||
*/ | ||
public on(eventType: "debug", callback: (context?: IDebugInfo) => void): void | ||
public on(eventType: "deleteProperty", callback: (context?: { | ||
target: any | ||
key: PropertyKey | ||
}) => void): void | ||
public on(eventType: "get", callback: (context?: { | ||
target: any | ||
key: PropertyKey | ||
value: any | ||
}) => void): void | ||
public on(eventType: "set", callback: (context?: { | ||
target: any | ||
key: PropertyKey | ||
value: any | ||
oldValue: any | ||
}) => void): void | ||
public on(eventType: "startBatch" | "endBatch", callback: () => void): void | ||
public on(eventType: "runInAction", callback: (debugName?: string) => void): void | ||
public on(eventType: 'debug', callback: (context?: IDebugInfo) => void): void; | ||
public on( | ||
eventType: 'deleteProperty', | ||
callback: ( | ||
context?: { | ||
target: any; | ||
key: PropertyKey; | ||
} | ||
) => void | ||
): void; | ||
public on( | ||
eventType: 'get', | ||
callback: ( | ||
context?: { | ||
target: any; | ||
key: PropertyKey; | ||
value: any; | ||
} | ||
) => void | ||
): void; | ||
public on( | ||
eventType: 'set', | ||
callback: ( | ||
context?: { | ||
target: any; | ||
key: PropertyKey; | ||
value: any; | ||
oldValue: any; | ||
} | ||
) => void | ||
): void; | ||
public on(eventType: 'startBatch' | 'endBatch', callback: () => void): void; | ||
public on(eventType: 'runInAction', callback: (debugName?: string) => void): void; | ||
public on(eventType: EventType, callback: ICallback): void { | ||
const event: IEvent = { | ||
callback | ||
} | ||
}; | ||
if (this.events.get(eventType)) { | ||
// 存在, push 一个事件监听 | ||
this!.events!.get(eventType)!.push(event) | ||
this!.events!.get(eventType)!.push(event); | ||
} else { | ||
// 不存在, 赋值 | ||
this.events.set(eventType, [event]) | ||
this.events.set(eventType, [event]); | ||
} | ||
@@ -59,12 +74,12 @@ } | ||
if (!this.events.get(eventType)) { | ||
return false | ||
return false; | ||
} | ||
const events = this!.events!.get(eventType)!.filter(event => { | ||
return event.callback !== callback | ||
}) | ||
return event.callback !== callback; | ||
}); | ||
this.events.set(eventType, events) | ||
this.events.set(eventType, events); | ||
return true | ||
return true; | ||
} | ||
@@ -77,9 +92,11 @@ | ||
if (!eventType || !this.events.get(eventType)) { | ||
return false | ||
return false; | ||
} | ||
this!.events!.get(eventType)!.forEach(event => { | ||
event.callback(context) | ||
}) | ||
event.callback(context); | ||
}); | ||
return true; | ||
} | ||
} |
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"strict": true, | ||
"emitDecoratorMetadata": true, | ||
"strictNullChecks": false, | ||
"jsx": "react", | ||
"target": "esnext", | ||
"experimentalDecorators": true, | ||
"skipLibCheck": true, | ||
"outDir": "dist", | ||
"rootDir": "./", | ||
"baseUrl": ".", | ||
"lib": [ | ||
@@ -13,9 +20,22 @@ "dom", | ||
], | ||
"target": "es5", | ||
"outDir": "built", | ||
"sourceMap": true | ||
"paths": { | ||
"pri/*": [ | ||
"pri", | ||
".temp/types/*" | ||
], | ||
"@/*": [ | ||
"src/*" | ||
] | ||
} | ||
}, | ||
"include": [ | ||
".temp/**/*", | ||
"src/**/*", | ||
"tests/**/*", | ||
"docs/**/*" | ||
], | ||
"exclude": [ | ||
"node_modules" | ||
"node_modules", | ||
"dist" | ||
] | ||
} | ||
} |
{ | ||
"extends": "ascoders-tslint-config" | ||
} | ||
"extends": [ | ||
"tslint:latest", | ||
"tslint-config-prettier" | ||
], | ||
"defaultSeverity": "error", | ||
"rules": { | ||
"object-literal-sort-keys": false, | ||
"max-classes-per-file": [ | ||
true, | ||
5 | ||
], | ||
"trailing-comma": [ | ||
false | ||
], | ||
"no-string-literal": true, | ||
"arrow-parens": false, | ||
"no-var-requires": true, | ||
"prefer-conditional-expression": false, | ||
"no-implicit-dependencies": false, | ||
"no-object-literal-type-assertion": false, | ||
"no-submodule-imports": false, | ||
"no-empty": true | ||
} | ||
} |
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
2
1
176
142503
3
43
4386
+ Added@babel/runtime@^7.0.0
+ Added@babel/runtime@7.26.9(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)