-
Notifications
You must be signed in to change notification settings - Fork 408
feat(closure): fix #727, add zone_externs.js for closure compiler #731
Conversation
package.json
Outdated
@@ -43,7 +43,9 @@ | |||
"bugs": { | |||
"url": "https://github.com/angular/zone.js/issues" | |||
}, | |||
"dependencies": {}, | |||
"dependencies": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be a devDependency right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, you are right, I will change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and you can remove the dependencies{} block too
lib/zone.ts
Outdated
@@ -136,11 +136,11 @@ | |||
interface Zone { | |||
/** | |||
* | |||
* @returns {Zone} The parent Zone. | |||
* @returns {?Zone} The parent Zone. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the reasoning for updating all the inline types?
If the externs file is independent of the .ts file,
- we'll have to maintain two different copies of the same info, and
- nothing enforces the JSDoc annotations in the .ts file are correct, so we will probably fail to maintain them
angular/tsickle can generate externs from the TS types, so we could just remove the JSDoc annotations if we were using the extern generator.
I know you already did a lot of work here, sorry to have to ask this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank for the review, I am new to closure compiler, so I just check the document and add the type I can find.
So I just revert all those inline type changes from zone.ts, is that correct?
scripts/closure/closure_compiler.sh
Outdated
# Flags to simplify debugging. | ||
"--formatting=PRETTY_PRINT" | ||
|
||
"--externs=test/closure/zone_externs_failed.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I'd have one options block with the options that are in common (including the zone.closure.js input file)
then when you call compiler.jar below, give the options that differ between the two cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexeagle , yes, you are right, I will make it change that way.
scripts/closure/closure_compiler.sh
Outdated
# compile closure test source file | ||
tsc -p . | ||
# Run the Google Closure compiler java runnable. | ||
java -jar node_modules/google-closure-compiler/compiler.jar --flagfile $closureFlags 'build/test/closure/zone.closure.js' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I prefer to have the flagfile be an actual file in this directory, then you don't have to use the fancy bash array construct that few people understand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I just copied from material, I also prefer use flagfile directly, I will modify it.
test/closure/zone_externs_failed.js
Outdated
*/ | ||
|
||
/** | ||
* @fileoverview Externs for zone.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file also looks like a lot of maintenance work. What is different between this and the other one? Could we get the same test coverage by just calling closure with no externs at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you are right , I will change it that way.
@alexeagle , thank you the review, I will make the changes of the comments you write above, and about the dist/zone_externs.js, is that ok? It can keep the name unchanged, I am not sure the Updated: |
138f5c4
to
ed36db1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking good, thanks! I'll let Misko look as well...
*/ | ||
|
||
/** | ||
* @fileoverview Externs for zone.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can verify that these work in a real project, like overwrite https://github.com/alexeagle/closure-compiler-angular-bundling/blob/master/vendor/zone_externs.js with yours and re-build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, I will check it too
package.json
Outdated
@@ -43,7 +43,9 @@ | |||
"bugs": { | |||
"url": "https://github.com/angular/zone.js/issues" | |||
}, | |||
"dependencies": {}, | |||
"dependencies": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and you can remove the dependencies{} block too
package.json
Outdated
@@ -52,6 +53,7 @@ | |||
"concurrently": "^2.2.0", | |||
"conventional-changelog": "^1.1.0", | |||
"es6-promise": "^3.0.2", | |||
"google-closure-compiler": "^20170218.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a new April release just came out, may as well upgrade this now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, got it. and the earlier version has a empty
dependencies: {}
I just reverted it to that way.
scripts/closure/closure_compiler.sh
Outdated
exit 1 | ||
fi | ||
|
||
# Run the Google Closure compiler java runnable with error zone externs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update comment - "without externs"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just updated the comment.
@alexeagle, I have modified the comment and update package.json, please review. |
scripts/closure/closure_compiler.sh
Outdated
|
||
if [ $? -eq 1 ] | ||
then | ||
echo "Successfully detect closure compiler error with wrong zone externs" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here too, wrong -> missing
scripts/closure/closure_compiler.sh
Outdated
then | ||
echo "Successfully detect closure compiler error with wrong zone externs" | ||
else | ||
echo "failed to detect closure compiler error with wrong zone externs" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexeagle , thanks, I will modify it now.
fc3f529
to
1423dfe
Compare
now we have 2 cases.