+4
-0
| # Changelog | ||
| ## 0.3.7 (2021-05-20) | ||
| - Mark method return types as `void` where appropriate. This is not a breaking change, since these YAOB methods were already returning `void` at run-time, but the types were just wrong. | ||
| ## 0.3.6 (2020-01-02) | ||
@@ -4,0 +8,0 @@ |
+10
-15
@@ -30,2 +30,3 @@ 'use strict'; | ||
| */ | ||
| // An object is bridgeable if it has this key: | ||
| var MAGIC_KEY = '_yaob'; | ||
@@ -473,3 +474,3 @@ /** | ||
| // No user-supplied value will ever be identical to this. | ||
| var dirtyValue = {}; | ||
| var dirtyValue$1 = {}; | ||
| /** | ||
@@ -581,3 +582,3 @@ * Subscribes to an event on a bridgeable object. | ||
| if (name != null && magic.watchers[name] != null) { | ||
| magic.watchers[name].data = dirtyValue; | ||
| magic.watchers[name].data = dirtyValue$1; | ||
| } // Call watcher callbacks: | ||
@@ -627,3 +628,3 @@ | ||
| // No user-supplied value will ever be identical to this. | ||
| var dirtyValue$1 = {}; | ||
| var dirtyValue = {}; | ||
| /** | ||
@@ -666,3 +667,3 @@ * Examines a bridgeable object and prepares it for sending of the wire. | ||
| } catch (e) { | ||
| cache[n] = dirtyValue$1; | ||
| cache[n] = dirtyValue; | ||
| props[n] = packThrow(state, e); | ||
@@ -705,3 +706,3 @@ } | ||
| props[n] = packThrow(state, e); | ||
| cache[n] = dirtyValue$1; | ||
| cache[n] = dirtyValue; | ||
| } | ||
@@ -786,5 +787,3 @@ } | ||
| var BridgeState = | ||
| /*#__PURE__*/ | ||
| function () { | ||
| var BridgeState = /*#__PURE__*/function () { | ||
| // Objects: | ||
@@ -880,3 +879,3 @@ // Outgoing method calls: | ||
| var cache = this.caches[localId]; | ||
| if (name != null && name in cache) cache[name] = dirtyValue$1; | ||
| if (name != null && name in cache) cache[name] = dirtyValue; | ||
| this.dirty[localId] = { | ||
@@ -1176,5 +1175,3 @@ cache: cache, | ||
| */ | ||
| var Bridge = | ||
| /*#__PURE__*/ | ||
| function () { | ||
| var Bridge = /*#__PURE__*/function () { | ||
| function Bridge(opts) { | ||
@@ -1269,5 +1266,3 @@ var _this = this; | ||
| var Bridgeable = | ||
| /*#__PURE__*/ | ||
| function () { | ||
| var Bridgeable = /*#__PURE__*/function () { | ||
| function Bridgeable() {} | ||
@@ -1274,0 +1269,0 @@ |
+10
-15
@@ -26,2 +26,3 @@ import { base64 } from 'rfc4648'; | ||
| */ | ||
| // An object is bridgeable if it has this key: | ||
| var MAGIC_KEY = '_yaob'; | ||
@@ -469,3 +470,3 @@ /** | ||
| // No user-supplied value will ever be identical to this. | ||
| var dirtyValue = {}; | ||
| var dirtyValue$1 = {}; | ||
| /** | ||
@@ -577,3 +578,3 @@ * Subscribes to an event on a bridgeable object. | ||
| if (name != null && magic.watchers[name] != null) { | ||
| magic.watchers[name].data = dirtyValue; | ||
| magic.watchers[name].data = dirtyValue$1; | ||
| } // Call watcher callbacks: | ||
@@ -623,3 +624,3 @@ | ||
| // No user-supplied value will ever be identical to this. | ||
| var dirtyValue$1 = {}; | ||
| var dirtyValue = {}; | ||
| /** | ||
@@ -662,3 +663,3 @@ * Examines a bridgeable object and prepares it for sending of the wire. | ||
| } catch (e) { | ||
| cache[n] = dirtyValue$1; | ||
| cache[n] = dirtyValue; | ||
| props[n] = packThrow(state, e); | ||
@@ -701,3 +702,3 @@ } | ||
| props[n] = packThrow(state, e); | ||
| cache[n] = dirtyValue$1; | ||
| cache[n] = dirtyValue; | ||
| } | ||
@@ -782,5 +783,3 @@ } | ||
| var BridgeState = | ||
| /*#__PURE__*/ | ||
| function () { | ||
| var BridgeState = /*#__PURE__*/function () { | ||
| // Objects: | ||
@@ -876,3 +875,3 @@ // Outgoing method calls: | ||
| var cache = this.caches[localId]; | ||
| if (name != null && name in cache) cache[name] = dirtyValue$1; | ||
| if (name != null && name in cache) cache[name] = dirtyValue; | ||
| this.dirty[localId] = { | ||
@@ -1172,5 +1171,3 @@ cache: cache, | ||
| */ | ||
| var Bridge = | ||
| /*#__PURE__*/ | ||
| function () { | ||
| var Bridge = /*#__PURE__*/function () { | ||
| function Bridge(opts) { | ||
@@ -1265,5 +1262,3 @@ var _this = this; | ||
| var Bridgeable = | ||
| /*#__PURE__*/ | ||
| function () { | ||
| var Bridgeable = /*#__PURE__*/function () { | ||
| function Bridgeable() {} | ||
@@ -1270,0 +1265,0 @@ |
+31
-32
| { | ||
| "name": "yaob", | ||
| "version": "0.3.6", | ||
| "version": "0.3.7", | ||
| "description": "Bridges an object-oriented API across a messaging layer", | ||
@@ -10,2 +10,5 @@ "repository": { | ||
| "license": "MIT", | ||
| "main": "lib/yaob.cjs.js", | ||
| "module": "lib/yaob.js", | ||
| "types": "src/index.d.ts", | ||
| "files": [ | ||
@@ -19,5 +22,2 @@ "CHANGELOG.md", | ||
| ], | ||
| "main": "lib/yaob.cjs.js", | ||
| "module": "lib/yaob.js", | ||
| "types": "src/index.d.ts", | ||
| "scripts": { | ||
@@ -46,32 +46,31 @@ "build": "rimraf lib && rollup -c", | ||
| "devDependencies": { | ||
| "@babel/core": "^7.0.0", | ||
| "@babel/plugin-transform-object-assign": "^7.0.0", | ||
| "@babel/preset-env": "^7.0.0", | ||
| "@babel/preset-flow": "^7.0.0", | ||
| "@typescript-eslint/eslint-plugin": ">=2.0.0", | ||
| "@typescript-eslint/parser": "^2.0.0", | ||
| "assert-log": "^0.2.1", | ||
| "babel-eslint": ">=10.0.0", | ||
| "chai": "^4.1.2", | ||
| "eslint": ">=6.2.2", | ||
| "eslint-config-standard-kit": ">=0.14.2", | ||
| "eslint-plugin-flowtype": ">=4.3.0", | ||
| "eslint-plugin-import": ">=2.18.0", | ||
| "eslint-plugin-prettier": ">=3.0.0", | ||
| "eslint-plugin-promise": ">=4.2.1", | ||
| "eslint-plugin-simple-import-sort": ">=4.0.0", | ||
| "eslint-plugin-standard": ">=4.0.0", | ||
| "@babel/core": "^7.14.3", | ||
| "@babel/plugin-transform-object-assign": "^7.12.13", | ||
| "@babel/preset-env": "^7.14.2", | ||
| "@babel/preset-flow": "^7.13.13", | ||
| "@rollup/plugin-babel": "^5.3.0", | ||
| "@typescript-eslint/eslint-plugin": "^4.8.2", | ||
| "@typescript-eslint/parser": "^4.8.2", | ||
| "assert-log": "^0.2.2", | ||
| "babel-eslint": "^10.1.0", | ||
| "chai": "^4.3.4", | ||
| "eslint": "^7.14.0", | ||
| "eslint-config-standard-kit": "0.15.1", | ||
| "eslint-plugin-flowtype": "^5.2.0", | ||
| "eslint-plugin-import": "^2.22.1", | ||
| "eslint-plugin-prettier": "^3.1.4", | ||
| "eslint-plugin-promise": "^4.2.1", | ||
| "eslint-plugin-simple-import-sort": "^6.0.1", | ||
| "flow-bin": "^0.105.2", | ||
| "husky": ">=3.0.0", | ||
| "lint-staged": ">=9.0.0", | ||
| "mocha": "^6.2.1", | ||
| "prettier": ">=1.0.0", | ||
| "rimraf": "^2.6.2", | ||
| "rollup": "^1.0.0", | ||
| "rollup-plugin-babel": "^4.3.3", | ||
| "rollup-plugin-filesize": "^6.2.0", | ||
| "rollup-plugin-flow-entry": "^0.3.3", | ||
| "source-map-support": "^0.5.6", | ||
| "typescript": "^3.7.2" | ||
| "husky": "^4.3.0", | ||
| "lint-staged": "^10.5.3", | ||
| "mocha": "^8.4.0", | ||
| "prettier": "^2.2.0", | ||
| "rimraf": "^3.0.2", | ||
| "rollup": "^2.48.0", | ||
| "rollup-plugin-filesize": "^9.1.1", | ||
| "rollup-plugin-flow-entry": "^0.3.5", | ||
| "source-map-support": "^0.5.19", | ||
| "typescript": "^4.1.2" | ||
| } | ||
| } |
+4
-4
@@ -43,15 +43,15 @@ // @flow | ||
| handleMessage(message: Message): mixed { | ||
| handleMessage(message: Message): void { | ||
| this._state.handleMessage(message) | ||
| } | ||
| getRoot() { | ||
| getRoot(): Promise<any> { | ||
| return this._rootPromise | ||
| } | ||
| sendRoot(root: Object) { | ||
| sendRoot(root: Object): void { | ||
| this._state.emitEvent(0, 'root', root) | ||
| } | ||
| close(error: Error) { | ||
| close(error: Error): void { | ||
| this._state.close(error) | ||
@@ -58,0 +58,0 @@ } |
+3
-3
@@ -29,3 +29,3 @@ // @flow | ||
| | { +[name: string]: DataMap } | ||
| | Array<DataMap> | ||
| | DataMap[] | ||
| | '' // No change | ||
@@ -46,3 +46,3 @@ | '?' // Invalid value | ||
| | { +[name: string]: JsonValue } | ||
| | Array<JsonValue> | ||
| | JsonValue[] | ||
| | false | ||
@@ -132,3 +132,3 @@ | null | ||
| if (Array.isArray(data)) { | ||
| let out: Array<DataMap> | '' = '' | ||
| let out: DataMap[] | '' = '' | ||
| for (let i = 0; i < data.length; ++i) { | ||
@@ -135,0 +135,0 @@ const map = mapData(table, data[i]) |
+5
-5
@@ -14,3 +14,3 @@ /** | ||
| constructor(opts: BridgeOptions) | ||
| handleMessage(message: object): unknown | ||
| handleMessage(message: object): void | ||
| getRoot(): Promise<any> | ||
@@ -39,3 +39,3 @@ sendRoot(root: object): void | ||
| */ | ||
| export type CallbackRemover = () => unknown | ||
| export type CallbackRemover = () => void | ||
@@ -78,4 +78,4 @@ /** | ||
| export declare function close(o: object): unknown | ||
| export declare function emit(o: object, name: string, payload: unknown): unknown | ||
| export declare function update<T extends object>(o: T, name?: keyof T): unknown | ||
| export declare function close(o: object): void | ||
| export declare function emit(o: object, name: string, payload: unknown): void | ||
| export declare function update<T extends object>(o: T, name?: keyof T): void |
+3
-3
@@ -29,9 +29,9 @@ // @flow | ||
| // Bridges subscribed to this object: | ||
| bridges: Array<BridgeState>, | ||
| bridges: BridgeState[], | ||
| // Event listeners subscribed to this object: | ||
| listeners: { [name: string]: Array<Function> }, | ||
| listeners: { [name: string]: Function[] }, | ||
| // Property watchers subscribed to this object: | ||
| watchers: { [name: string]: { data: mixed, fs: Array<Function> } } | ||
| watchers: { [name: string]: { data: mixed, fs: Function[] } } | ||
| } | ||
@@ -38,0 +38,0 @@ |
+4
-4
@@ -12,3 +12,3 @@ // @flow | ||
| */ | ||
| export type CallbackRemover = () => mixed | ||
| export type CallbackRemover = () => void | ||
@@ -72,3 +72,3 @@ /** | ||
| */ | ||
| export function close(o: Object): mixed { | ||
| export function close(o: Object): void { | ||
| const magic = getInstanceMagic(o) | ||
@@ -96,3 +96,3 @@ | ||
| */ | ||
| export function emit(o: Object, name: string, payload: mixed): mixed { | ||
| export function emit(o: Object, name: string, payload: mixed): void { | ||
| const magic = getInstanceMagic(o) | ||
@@ -118,3 +118,3 @@ if (magic.closed) throw new Error('Cannot emit event on closed object') | ||
| */ | ||
| export function update<T: {}>(o: T, name?: $Keys<T>): mixed { | ||
| export function update<T: {}>(o: T, name?: $Keys<T>): void { | ||
| const magic = getInstanceMagic(o) | ||
@@ -121,0 +121,0 @@ if (magic.closed) throw new Error('Cannot update closed object') |
+1
-1
@@ -48,3 +48,3 @@ // @flow | ||
| const cache: ValueCache = {} | ||
| const methods: Array<string> = [] | ||
| const methods: string[] = [] | ||
| const props: PackedProps = {} | ||
@@ -51,0 +51,0 @@ for (const n in allNames) { |
+7
-7
@@ -32,3 +32,3 @@ // @flow | ||
| localId: number, | ||
| methods: Array<string>, | ||
| methods: string[], | ||
| props: PackedProps | ||
@@ -57,8 +57,8 @@ } | ||
| export type Message = { | ||
| calls?: Array<CallMessage>, | ||
| changed?: Array<ChangeMessage>, | ||
| closed?: Array<number>, | ||
| created?: Array<CreateMessage>, | ||
| events?: Array<EventMessage>, | ||
| returns?: Array<ReturnMessage> | ||
| calls?: CallMessage[], | ||
| changed?: ChangeMessage[], | ||
| closed?: number[], | ||
| created?: CreateMessage[], | ||
| events?: EventMessage[], | ||
| returns?: ReturnMessage[] | ||
| } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
251511
3.78%28
-3.45%3390
-0.29%