Skip to content

Commit

Permalink
fix: support rxjs 7 and introduce module index
Browse files Browse the repository at this point in the history
  • Loading branch information
PSanetra committed Jan 8, 2022
1 parent adb6274 commit 3951a17
Show file tree
Hide file tree
Showing 8 changed files with 20,367 additions and 2,200 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
15 changes: 15 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
],
rules: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-inferrable-types": "off"
}
};
22,502 changes: 20,328 additions & 2,174 deletions package-lock.json

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"node": ">=12.0.0"
},
"scripts": {
"lint": "tslint --project tsconfig.json -t codeFrame 'src/**/*.ts' 'test/**/*.ts'",
"build": "tsc --module commonjs && rollup -c rollup.config.ts && typedoc --out docs --target es6 --theme minimal --mode file src",
"lint": "eslint src --ext .js,.jsx,.ts,.tsx",
"build": "tsc --module commonjs && rollup -c rollup.config.ts && typedoc --out docs src",
"start": "rollup -c rollup.config.ts -w",
"test": "jest",
"test:watch": "jest --watch",
Expand Down Expand Up @@ -78,7 +78,7 @@
"singleQuote": true
},
"peerDependencies": {
"rxjs": "^6.0.0"
"rxjs": "^7.0.0 || ^6.0.0"
},
"devDependencies": {
"@commitlint/cli": "^11.0.0",
Expand All @@ -90,11 +90,14 @@
"@types/lodash.camelcase": "^4.3.6",
"@types/node": "^12.19.7",
"@types/rollup-plugin-peer-deps-external": "^2.2.0",
"@typescript-eslint/eslint-plugin": "^5.9.0",
"@typescript-eslint/parser": "^5.9.0",
"colors": "^1.4.0",
"commitizen": "^4.2.2",
"coveralls": "^3.1.0",
"cross-env": "^7.0.2",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.6.0",
"husky": "^4.3.0",
"jest": "^26.6.3",
"lint-staged": "^10.5.2",
Expand All @@ -105,15 +108,12 @@
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-typescript2": "^0.29.0",
"rxjs": "^7.5.1",
"semantic-release": "^17.3.0",
"ts-jest": "^26.4.4",
"ts-node": "^9.0.0",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"tslint-config-standard": "^9.0.0",
"tslint-eslint-rules": "^5.4.0",
"typedoc": "^0.19.2",
"typescript": "^4.1.2"
"ts-node": "^10.4.0",
"typedoc": "^0.22.10",
"typescript": "^4.5.4"
},
"husky": {
"hooks": {
Expand Down
6 changes: 3 additions & 3 deletions src/bind-observable.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BindObservable } from '../src/bind-observable'
import { BindObservable } from './bind-observable'
import { Observable } from 'rxjs'
import { take } from 'rxjs/operators'

Expand Down Expand Up @@ -27,7 +27,7 @@ function WrappingDecorator(prefix?: string): PropertyDecorator {
if (descriptor.set) {
descriptor.set.call(this, `${prefix}wrapSet(${value})`)
}
}
},
})
} else {
Object.defineProperty(target, propertyName, {
Expand All @@ -42,7 +42,7 @@ function WrappingDecorator(prefix?: string): PropertyDecorator {
expect(propertyName in this).toBe(true)

target['@WrappingDecorator.value'] = `${prefix}wrapSet(${value})`
}
},
})
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/bind-observable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { BindObservableOpts, isBindObservableOpts } from './bind-observable-opti

type SubjectByProp = Map<string, ReplaySubject<any>>

const subjects: WeakMap<Object, SubjectByProp> = new WeakMap()
const subjects: WeakMap<object, SubjectByProp> = new WeakMap()

type ValueByProp = Map<string, any>

const values: WeakMap<Object, ValueByProp> = new WeakMap()
const values: WeakMap<object, ValueByProp> = new WeakMap()

function subject(instance: any, key: string): ReplaySubject<any> {
let subjectByProp = subjects.get(instance)
Expand Down Expand Up @@ -38,13 +38,13 @@ function valueMap(instance: any): ValueByProp {
return valueMap
}

function defineObservableProperty(target: Object, observableKey: string): void {
function defineObservableProperty(target: object, observableKey: string): void {
Object.defineProperty(target, observableKey, {
configurable: true,
enumerable: false,
get() {
return subject(this, observableKey)
}
},
})
}

Expand All @@ -58,12 +58,12 @@ function redefineSimpleProperty(target: any, propertyKey: string, observableKey:
},
get() {
return valueMap(this).get(propertyKey)
}
},
})
}

function redefineAccessorProperty(
target: Object,
target: object,
propertyKey: string,
observableKey: string,
emitRawSetterValue: boolean,
Expand Down Expand Up @@ -93,7 +93,7 @@ function redefineAccessorProperty(
}

return descriptor.get.call(this)
}
},
})
}

Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './bind-observable'
export * from './bind-observable-options'
6 changes: 0 additions & 6 deletions tslint.json

This file was deleted.

0 comments on commit 3951a17

Please sign in to comment.