Skip to content

Commit

Permalink
feat: support Angular 12.1 (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Jul 7, 2021
1 parent a7316da commit c54ccbb
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
- "10.13.0"
angular:
- ""
- "~12.0.0"
- "^11.0.0"
- "^10.1.0"
- "~10.0.0"
Expand All @@ -42,7 +43,7 @@ jobs:
- if: matrix.angular == ''
run: yarn install --frozen-lockfile
- if: matrix.angular != ''
run: yarn upgrade @angular/compiler@${{ matrix.angular }}
run: yarn upgrade @angular/compiler@${{ matrix.angular }} --ignore-engines
- run: yarn run test
env:
ENABLE_COVERAGE: ${{ matrix.angular == '' && '1' || '' }}
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const NG_VERSION = require('@angular/compiler').VERSION.full;
module.exports = {
globals: {
'ts-jest': {
diagnostics: !/^(?:[67]|8\.[01])\./.test(NG_VERSION),
diagnostics: !/^(?:9|10|11|12\.0)\./.test(NG_VERSION),
}
},
testEnvironment: 'node',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"tslib": "^2.0.3"
},
"devDependencies": {
"@angular/compiler": "12.0.2",
"@angular/compiler": "12.1.0",
"@babel/code-frame": "7.8.3",
"@babel/parser": "7.6.4",
"@babel/types": "7.1.5",
Expand Down
16 changes: 12 additions & 4 deletions src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,14 @@ export const transform = (
});
}
case 'KeyedRead': {
const { obj, key } = node as ng.KeyedRead;
const { key } = node as ng.KeyedRead;
/* istanbul ignore next */
const receiver = Object.prototype.hasOwnProperty.call(node, 'receiver')
? (node as ng.KeyedRead).receiver
: (node as any).obj;
const tKey = _t<b.Expression>(key);
return _transformReceiverAndName(
obj,
receiver,
tKey,
{
computed: true,
Expand Down Expand Up @@ -384,11 +388,15 @@ export const transform = (
);
}
case 'KeyedWrite': {
const { obj, key, value } = node as ng.KeyedWrite;
const { key, value } = node as ng.KeyedWrite;
/* istanbul ignore next */
const receiver = Object.prototype.hasOwnProperty.call(node, 'receiver')
? (node as ng.KeyedRead).receiver
: (node as any).obj;
const tKey = _t<b.Expression>(key);
const tValue = _t<b.Expression>(value);
const tReceiverAndName = _transformReceiverAndName(
obj,
receiver,
tKey,
{
computed: true,
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# yarn lockfile v1


"@angular/compiler@12.0.2":
version "12.0.2"
resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-12.0.2.tgz#07acd56c3c18320ad2f3e1128b56fa3a9c8a812c"
integrity sha512-PLkDb1mxWpsOJwR0t9yDI8A9dSMUEmVf+HdNWFO1aFY84nZ3sH8t6e/BpoaRcbLJCkNgtm9YD8FmRHE30LZ3CA==
"@angular/compiler@12.1.0":
version "12.1.0"
resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-12.1.0.tgz#c630dd7fe26184645dd3f0f227d1b8862920919d"
integrity sha512-Nk9l8fWv0XrEZGpN8EftAzTC6Q2oTnDqnYQ9Ykc3rkRQs4r8MDG9cUd4z5gbEToFgX7KVQ3+wLAYVX+uB6A5hg==
dependencies:
tslib "^2.1.0"
tslib "^2.2.0"

"@babel/code-frame@7.8.3", "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.0.0-beta.35":
version "7.8.3"
Expand Down Expand Up @@ -4095,10 +4095,10 @@ tslib@^2.0.3:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.0.3.tgz#8e0741ac45fc0c226e58a17bfc3e64b9bc6ca61c"
integrity sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ==

tslib@^2.1.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.2.0.tgz#fb2c475977e35e241311ede2693cee1ec6698f5c"
integrity sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==
tslib@^2.2.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.0.tgz#803b8cdab3e12ba581a4ca41c8839bbb0dacb09e"
integrity sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==

tslint-config-prettier@1.18.0:
version "1.18.0"
Expand Down

0 comments on commit c54ccbb

Please sign in to comment.