Compare commits

...

24 Commits

Author SHA1 Message Date
85e95cc32b docs: add changelog for 5.0.0-rc.8 2017-10-27 23:31:35 -07:00
de71ba74bb release: cut the 5.0.0-rc.8 release 2017-10-27 23:31:27 -07:00
a01c877534 docs: ensure examples get rxjs ^5.5.0 (#19985)
This change coincidentally updates other packages that were in `package.json`
because it regenerates `yarn.lock`. This too should be fine.

PR Close #19985
2017-10-27 22:28:21 -07:00
2d508a3ef0 fix(compiler-cli): avoid producing source mappings for host views (#19965)
The host view doesn't map back to user code so the template compiler
produces a blank `url` for them.

PR Close #19965
2017-10-27 22:28:14 -07:00
4285b6c3e3 fix(platform-server): add missing packages to the UMD global rollup config
This adds the proper bindings for calling angular packages from platform-server in the UMD.
This was not a problem for universal apps that dont use UMD.

Fixes 19899
2017-10-27 22:27:43 -07:00
5542517b9c docs: add changelog for 5.0.0-rc.7 2017-10-26 19:03:14 -07:00
fef3539608 release: cut the 5.0.0-rc.7 release 2017-10-26 19:01:34 -07:00
f4d5729cb3 fix(compiler): make watch mode work on windows (#19953)
Fixes #19951
PR Close #19953
2017-10-26 21:52:35 -04:00
d343bf7885 fix(compiler): recover from structural errors in watch mode (#19953)
This also changes the compiler so that we throw less often
on structural changes and produce a meaningful state
in the `ng.Program` in case of errors.

Related to #19951

PR Close #19953
2017-10-26 21:52:25 -04:00
9ce7f0e538 fix(compiler): translate emit diagnostics with noEmitOnError: true. (#19953)
This prevents errors reported against `.ngfactory.ts` files show up
as the result of running `ngc`.

Closes #19935
PR Close #19953
2017-10-26 21:52:16 -04:00
4a23df3909 fix(compiler): don’t store invalid state when using listLazyRoutes (#19953)
Previously, `listLazyRoute` would store invalid information in a compiler
internal cache, which lead to incorrect paths that were used during emit.
This commit fixes this.

PR Close #19953
2017-10-26 21:51:43 -04:00
14016c781f fix(service-worker): fix improper call of Observable.merge (#19962)
Observable.merge was called using .call() as if it were an operator
and not an Observable factory. This removes the .call() and uses
the factory properly.

PR Close #19962
2017-10-26 18:16:20 -04:00
47caebfe86 fix(service-worker): don't block initialization on registration (#19936)
Importing ServiceWorkerModule.register() will schedule registration of
the Service Worker inside an APP_INITIALIZER. Previously, the Promise
returned by navigator.serviceWorker.register() was returned from the
initializer function. This has the unwanted side effect of blocking
initialization until the SW is registered. Even worse, if the SW script
fails to load, this can cause the app initialization to fail.

The solution is to not return the registration promise from the
initializer function, essentially decoupling registration from the rest
of the initialization flow.

This change is not unit testable as there are no mocks/adapters yet for
navigator.serviceWorker. A future integration test should cover this case
with better fidelity.

PR Close #19936
2017-10-26 16:10:17 -04:00
5cfd9c6020 fix(service-worker): listen for messages on the right event source (#19954)
Currently, the SwUpdate service doesn't receive messages from the SW.
This is because it attempts to subscribe to the 'message' event on
ServiceWorkerRegistration, when really messages are emitted by the
ServiceWorkerContainer.

This change moves to listening on ServiceWorkerContainer and changes
the mocks to reflect the way the browser actually works.

PR Close #19954
2017-10-26 16:10:07 -04:00
47bc6f105d docs: add changelog for 5.0.0-rc.6 2017-10-25 14:34:42 -07:00
40fa2593a9 release: cut the 5.0.0-rc.6 release 2017-10-25 14:32:11 -07:00
680bcf7b8a build: update to rxjs@5.5.2 (#19931)
PR Close #19931
2017-10-25 15:32:01 -04:00
ef08330341 fix(compiler): automatically set emitDecoratorMetadata when "annotationsAs": "static fields” (#19927)
This is a workaround for https://github.com/angular/tsickle/issues/635.

Fixes #19916
PR Close #19927
2017-10-25 14:26:28 -04:00
6cc042e2ba fix(compiler-cli): produce correct paths for windows output (#19915)
The path mapping was broken for Windows by fc0b1d5b61.
Fixed the path mapping and put code in place to make such a problem
to sneek by again.

PR Close #19915
2017-10-24 19:21:18 -04:00
9b26455740 fix(compiler-cli): only use error collector when needed. (#19912)
The error collector changes behavior of the metadata resolver
in ways that haven't been fully hardened. This changes limits
its use to the lazy route detection and the language service.

Issue: #19906

PR Close #19912
2017-10-24 19:21:13 -04:00
18bce5987c fix(compiler): don’t type check templates with skipTemplateCodegen (#19909)
This change is needed to prevent users’ builds from breaking.

If a user sets `fullTemlateTypeCheck` to true, we will
continue to check the templates even when `skipTemplateCodegen` is true
as well.

Related to #19906

PR Close #19909
2017-10-24 19:21:03 -04:00
f1108fea76 docs: add changelog for 5.0.0-rc.5 2017-10-23 23:28:28 -07:00
64b3e3e41a release: cut the 5.0.0-rc.5 release 2017-10-23 23:27:15 -07:00
a82f863e24 fix(compiler-cli): report all diagnostic error messages (#19886)
This fixes a problem introduced in 8d45fefc31
which modified how diagnostic error messages are reported for structural
metadata errors causing some of the diagnostics to be lost.

PR Close #19886
2017-10-24 00:57:41 -04:00
32 changed files with 770 additions and 323 deletions

View File

@ -1,3 +1,53 @@
<a name="5.0.0-rc.8"></a>
# [5.0.0-rc.8](https://github.com/angular/angular/compare/5.0.0-rc.7...5.0.0-rc.8) (2017-10-28)
### Bug Fixes
* **compiler-cli:** avoid producing source mappings for host views ([#19965](https://github.com/angular/angular/issues/19965)) ([2d508a3](https://github.com/angular/angular/commit/2d508a3))
* **platform-server:** add missing packages to the UMD global rollup config ([4285b6c](https://github.com/angular/angular/commit/4285b6c))
<a name="5.0.0-rc.7"></a>
# [5.0.0-rc.7](https://github.com/angular/angular/compare/5.0.0-rc.6...5.0.0-rc.7) (2017-10-27)
### Bug Fixes
* **compiler:** dont store invalid state when using `listLazyRoutes` ([#19953](https://github.com/angular/angular/issues/19953)) ([4a23df3](https://github.com/angular/angular/commit/4a23df3))
* **compiler:** make watch mode work on windows ([#19953](https://github.com/angular/angular/issues/19953)) ([f4d5729](https://github.com/angular/angular/commit/f4d5729)), closes [#19951](https://github.com/angular/angular/issues/19951)
* **compiler:** recover from structural errors in watch mode ([#19953](https://github.com/angular/angular/issues/19953)) ([d343bf7](https://github.com/angular/angular/commit/d343bf7))
* **compiler:** translate emit diagnostics with `noEmitOnError: true`. ([#19953](https://github.com/angular/angular/issues/19953)) ([9ce7f0e](https://github.com/angular/angular/commit/9ce7f0e)), closes [#19935](https://github.com/angular/angular/issues/19935)
* **service-worker:** don't block initialization on registration ([#19936](https://github.com/angular/angular/issues/19936)) ([47caebf](https://github.com/angular/angular/commit/47caebf))
* **service-worker:** fix improper call of Observable.merge ([#19962](https://github.com/angular/angular/issues/19962)) ([14016c7](https://github.com/angular/angular/commit/14016c7))
* **service-worker:** listen for messages on the right event source ([#19954](https://github.com/angular/angular/issues/19954)) ([5cfd9c6](https://github.com/angular/angular/commit/5cfd9c6))
<a name="5.0.0-rc.6"></a>
# [5.0.0-rc.6](https://github.com/angular/angular/compare/5.0.0-rc.5...5.0.0-rc.6) (2017-10-25)
### Bug Fixes
* **compiler:** automatically set `emitDecoratorMetadata` when `"annotationsAs": "static fields”` ([#19927](https://github.com/angular/angular/issues/19927)) ([ef08330](https://github.com/angular/angular/commit/ef08330)), closes [#19916](https://github.com/angular/angular/issues/19916)
* **compiler:** dont type check templates with `skipTemplateCodegen` ([#19909](https://github.com/angular/angular/issues/19909)) ([18bce59](https://github.com/angular/angular/commit/18bce59))
* **compiler-cli:** only use error collector when needed. ([#19912](https://github.com/angular/angular/issues/19912)) ([9b26455](https://github.com/angular/angular/commit/9b26455))
* **compiler-cli:** produce correct paths for windows output ([#19915](https://github.com/angular/angular/issues/19915)) ([6cc042e](https://github.com/angular/angular/commit/6cc042e))
<a name="5.0.0-rc.5"></a>
# [5.0.0-rc.5](https://github.com/angular/angular/compare/5.0.0-rc.4...5.0.0-rc.5) (2017-10-24)
### Bug Fixes
* **compiler-cli:** report all diagnostic error messages ([#19886](https://github.com/angular/angular/issues/19886)) ([a82f863](https://github.com/angular/angular/commit/a82f863))
<a name="5.0.0-rc.4"></a> <a name="5.0.0-rc.4"></a>
# [5.0.0-rc.4](https://github.com/angular/angular/compare/5.0.0-rc.3...5.0.0-rc.4) (2017-10-24) # [5.0.0-rc.4](https://github.com/angular/angular/compare/5.0.0-rc.3...5.0.0-rc.4) (2017-10-24)

View File

@ -28,7 +28,7 @@
"angular-in-memory-web-api": "~0.4.6", "angular-in-memory-web-api": "~0.4.6",
"core-js": "^2.4.1", "core-js": "^2.4.1",
"express": "^4.14.1", "express": "^4.14.1",
"rxjs": "^5.1.0", "rxjs": "^5.5.0",
"systemjs": "0.19.39", "systemjs": "0.19.39",
"web-animations-js": "^2.3.1", "web-animations-js": "^2.3.1",
"zone.js": "^0.8.4" "zone.js": "^0.8.4"

View File

@ -2,26 +2,26 @@
# yarn lockfile v1 # yarn lockfile v1
"@angular-devkit/build-optimizer@~0.0.23": "@angular-devkit/build-optimizer@~0.0.28":
version "0.0.24" version "0.0.31"
resolved "https://registry.yarnpkg.com/@angular-devkit/build-optimizer/-/build-optimizer-0.0.24.tgz#f361f34dd9f2a6b5ba14ab32327697419cc0ef7e" resolved "https://registry.yarnpkg.com/@angular-devkit/build-optimizer/-/build-optimizer-0.0.31.tgz#511bc00e18c787a6cd4efe37b8cdb9f1bc6d4472"
dependencies: dependencies:
loader-utils "^1.1.0" loader-utils "^1.1.0"
source-map "^0.5.6" source-map "^0.5.6"
typescript "^2.3.3" typescript "^2.3.3"
webpack-sources "^1.0.1" webpack-sources "^1.0.1"
"@angular-devkit/core@0.0.16": "@angular-devkit/core@0.0.20":
version "0.0.16" version "0.0.20"
resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-0.0.16.tgz#498efc22948e7e17fe7e826a67b5c23a60c5e873" resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-0.0.20.tgz#2ad36dd210fccd0e156d01c6499082ad4cd8c2af"
dependencies: dependencies:
source-map "^0.5.6" source-map "^0.5.6"
"@angular-devkit/schematics@~0.0.25": "@angular-devkit/schematics@~0.0.34":
version "0.0.26" version "0.0.34"
resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-0.0.26.tgz#58b9b004dbe6bfd125674b883a63180a521f2d2d" resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-0.0.34.tgz#c3ef61b0e49e585d9982f2828e9a67b3879a6b1b"
dependencies: dependencies:
"@angular-devkit/core" "0.0.16" "@angular-devkit/core" "0.0.20"
"@ngtools/json-schema" "^1.1.0" "@ngtools/json-schema" "^1.1.0"
minimist "^1.2.0" minimist "^1.2.0"
rxjs "^5.4.2" rxjs "^5.4.2"
@ -33,19 +33,19 @@
tslib "^1.7.1" tslib "^1.7.1"
"@angular/cli@^1.3.1": "@angular/cli@^1.3.1":
version "1.4.5" version "1.4.9"
resolved "https://registry.yarnpkg.com/@angular/cli/-/cli-1.4.5.tgz#b982e13799b19e13eb820c2e17ef2c62a3b10881" resolved "https://registry.yarnpkg.com/@angular/cli/-/cli-1.4.9.tgz#cd5cd7a8f3bf3a1c28dfcdc523a011f0fcebfb96"
dependencies: dependencies:
"@angular-devkit/build-optimizer" "~0.0.23" "@angular-devkit/build-optimizer" "~0.0.28"
"@angular-devkit/schematics" "~0.0.25" "@angular-devkit/schematics" "~0.0.34"
"@ngtools/json-schema" "1.1.0" "@ngtools/json-schema" "1.1.0"
"@ngtools/webpack" "1.7.2" "@ngtools/webpack" "1.7.4"
"@schematics/angular" "~0.0.38" "@schematics/angular" "~0.0.46"
autoprefixer "^6.5.3" autoprefixer "^6.5.3"
chalk "^2.0.1" chalk "^2.0.1"
circular-dependency-plugin "^3.0.0" circular-dependency-plugin "^3.0.0"
common-tags "^1.3.1" common-tags "^1.3.1"
copy-webpack-plugin "^4.0.1" copy-webpack-plugin "^4.1.1"
core-object "^3.1.0" core-object "^3.1.0"
css-loader "^0.28.1" css-loader "^0.28.1"
cssnano "^3.10.0" cssnano "^3.10.0"
@ -53,7 +53,7 @@
ember-cli-string-utils "^1.0.0" ember-cli-string-utils "^1.0.0"
exports-loader "^0.6.3" exports-loader "^0.6.3"
extract-text-webpack-plugin "3.0.0" extract-text-webpack-plugin "3.0.0"
file-loader "^0.10.0" file-loader "^1.1.5"
fs-extra "^4.0.0" fs-extra "^4.0.0"
glob "^7.0.3" glob "^7.0.3"
html-webpack-plugin "^2.29.0" html-webpack-plugin "^2.29.0"
@ -82,12 +82,13 @@
stylus "^0.54.5" stylus "^0.54.5"
stylus-loader "^3.0.1" stylus-loader "^3.0.1"
typescript ">=2.0.0 <2.6.0" typescript ">=2.0.0 <2.6.0"
url-loader "^0.6.0" url-loader "^0.6.2"
webpack "~3.6.0" webpack "~3.7.1"
webpack-concat-plugin "1.4.0" webpack-concat-plugin "1.4.0"
webpack-dev-middleware "~1.12.0" webpack-dev-middleware "~1.12.0"
webpack-dev-server "~2.7.1" webpack-dev-server "~2.7.1"
webpack-merge "^4.1.0" webpack-merge "^4.1.0"
webpack-sources "^1.0.0"
zone.js "^0.8.14" zone.js "^0.8.14"
optionalDependencies: optionalDependencies:
node-sass "^4.3.0" node-sass "^4.3.0"
@ -172,18 +173,20 @@
version "1.1.0" version "1.1.0"
resolved "https://registry.yarnpkg.com/@ngtools/json-schema/-/json-schema-1.1.0.tgz#c3a0c544d62392acc2813a42c8a0dc6f58f86922" resolved "https://registry.yarnpkg.com/@ngtools/json-schema/-/json-schema-1.1.0.tgz#c3a0c544d62392acc2813a42c8a0dc6f58f86922"
"@ngtools/webpack@1.7.2", "@ngtools/webpack@^1.2.11": "@ngtools/webpack@1.7.4", "@ngtools/webpack@^1.2.11":
version "1.7.2" version "1.7.4"
resolved "https://registry.yarnpkg.com/@ngtools/webpack/-/webpack-1.7.2.tgz#3fc4de01786dcc2f50d8cbaaa117311e56799977" resolved "https://registry.yarnpkg.com/@ngtools/webpack/-/webpack-1.7.4.tgz#5015c47ebd339045dd89a1bef0497f4524d2c8ed"
dependencies: dependencies:
enhanced-resolve "^3.1.0" enhanced-resolve "^3.1.0"
loader-utils "^1.0.2" loader-utils "^1.0.2"
magic-string "^0.22.3" magic-string "^0.22.3"
source-map "^0.5.6" source-map "^0.5.6"
"@schematics/angular@~0.0.38": "@schematics/angular@~0.0.46":
version "0.0.39" version "0.0.48"
resolved "https://registry.yarnpkg.com/@schematics/angular/-/angular-0.0.39.tgz#6dc2b461e95e4f4756a48693f2f13a771f6d6cb5" resolved "https://registry.yarnpkg.com/@schematics/angular/-/angular-0.0.48.tgz#6fa1bfb2676ba34c243811d2083173821d3cf07c"
dependencies:
"@angular-devkit/core" "0.0.20"
"@types/angular-animate@^1.5.5": "@types/angular-animate@^1.5.5":
version "1.5.8" version "1.5.8"
@ -222,25 +225,33 @@
"@types/angular" "*" "@types/angular" "*"
"@types/angular@*", "@types/angular@^1.5.16": "@types/angular@*", "@types/angular@^1.5.16":
version "1.6.32" version "1.6.36"
resolved "https://registry.yarnpkg.com/@types/angular/-/angular-1.6.32.tgz#fc791aad038227d9413eb5e552993e1076f8a509" resolved "https://registry.yarnpkg.com/@types/angular/-/angular-1.6.36.tgz#15e73d632274b5655a391470844863548c7755f4"
"@types/body-parser@*":
version "1.16.7"
resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.16.7.tgz#455fc23fd0ddaaeda6cd6cbb653558276e5920fa"
dependencies:
"@types/express" "*"
"@types/node" "*"
"@types/express-serve-static-core@*": "@types/express-serve-static-core@*":
version "4.0.53" version "4.0.55"
resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.0.53.tgz#1723a35d1447f2c55e13c8721eab3448e42f4d82" resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.0.55.tgz#f53868838a955f98b380819ec9134f5df7d9482f"
dependencies: dependencies:
"@types/node" "*" "@types/node" "*"
"@types/express@^4.0.35": "@types/express@*", "@types/express@^4.0.35":
version "4.0.37" version "4.0.39"
resolved "https://registry.yarnpkg.com/@types/express/-/express-4.0.37.tgz#625ac3765169676e01897ca47011c26375784971" resolved "https://registry.yarnpkg.com/@types/express/-/express-4.0.39.tgz#1441f21d52b33be8d4fa8a865c15a6a91cd0fa09"
dependencies: dependencies:
"@types/body-parser" "*"
"@types/express-serve-static-core" "*" "@types/express-serve-static-core" "*"
"@types/serve-static" "*" "@types/serve-static" "*"
"@types/jasmine@*": "@types/jasmine@*":
version "2.6.0" version "2.6.2"
resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.6.0.tgz#997b41a27752b4850af2683bc4a8d8222c25bd02" resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.6.2.tgz#6e6d4cb183cd55c7a1ad6270bced10fdd5367a3c"
"@types/jasmine@~2.5.53": "@types/jasmine@~2.5.53":
version "2.5.54" version "2.5.54"
@ -257,12 +268,12 @@
resolved "https://registry.yarnpkg.com/@types/mime/-/mime-2.0.0.tgz#5a7306e367c539b9f6543499de8dd519fac37a8b" resolved "https://registry.yarnpkg.com/@types/mime/-/mime-2.0.0.tgz#5a7306e367c539b9f6543499de8dd519fac37a8b"
"@types/node@*": "@types/node@*":
version "8.0.32" version "8.0.47"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.32.tgz#869a716538b6eec65ab3893f183d557be3cda206" resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.47.tgz#968e596f91acd59069054558a00708c445ca30c2"
"@types/node@^6.0.45", "@types/node@^6.0.46": "@types/node@^6.0.45", "@types/node@^6.0.46":
version "6.0.88" version "6.0.90"
resolved "https://registry.yarnpkg.com/@types/node/-/node-6.0.88.tgz#f618f11a944f6a18d92b5c472028728a3e3d4b66" resolved "https://registry.yarnpkg.com/@types/node/-/node-6.0.90.tgz#0ed74833fa1b73dcdb9409dcb1c97ec0a8b13b02"
"@types/q@^0.0.32": "@types/q@^0.0.32":
version "0.0.32" version "0.0.32"
@ -273,8 +284,8 @@
resolved "https://registry.yarnpkg.com/@types/selenium-webdriver/-/selenium-webdriver-2.53.42.tgz#74cb77fb6052edaff2a8984ddafd88d419f25cac" resolved "https://registry.yarnpkg.com/@types/selenium-webdriver/-/selenium-webdriver-2.53.42.tgz#74cb77fb6052edaff2a8984ddafd88d419f25cac"
"@types/serve-static@*": "@types/serve-static@*":
version "1.7.32" version "1.13.0"
resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.7.32.tgz#0f6732e4dab0813771dd8fc8fe14940f34728b4c" resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.13.0.tgz#2ef359d8d5982bc011a7a8fa36016e629e8b7635"
dependencies: dependencies:
"@types/express-serve-static-core" "*" "@types/express-serve-static-core" "*"
"@types/mime" "*" "@types/mime" "*"
@ -307,7 +318,7 @@ acorn@^4.0.3:
version "4.0.13" version "4.0.13"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787"
acorn@^5.0.0, acorn@^5.1.1: acorn@^5.0.0, acorn@^5.1.2:
version "5.1.2" version "5.1.2"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.1.2.tgz#911cb53e036807cf0fa778dc5d370fbd864246d7" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.1.2.tgz#911cb53e036807cf0fa778dc5d370fbd864246d7"
@ -346,13 +357,13 @@ ajv@^4.9.1:
json-stable-stringify "^1.0.1" json-stable-stringify "^1.0.1"
ajv@^5.0.0, ajv@^5.1.0, ajv@^5.1.5: ajv@^5.0.0, ajv@^5.1.0, ajv@^5.1.5:
version "5.2.3" version "5.3.0"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.2.3.tgz#c06f598778c44c6b161abafe3466b81ad1814ed2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.3.0.tgz#4414ff74a50879c208ee5fdc826e32c303549eda"
dependencies: dependencies:
co "^4.6.0" co "^4.6.0"
fast-deep-equal "^1.0.0" fast-deep-equal "^1.0.0"
fast-json-stable-stringify "^2.0.0"
json-schema-traverse "^0.3.0" json-schema-traverse "^0.3.0"
json-stable-stringify "^1.0.1"
align-text@^0.1.1, align-text@^0.1.3: align-text@^0.1.1, align-text@^0.1.3:
version "0.1.4" version "0.1.4"
@ -530,11 +541,7 @@ async@1.5.2, async@^1.5.2:
version "1.5.2" version "1.5.2"
resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"
async@^0.9.0: async@^2.1.2, async@^2.1.5, async@^2.4.1, async@^2.5.0:
version "0.9.2"
resolved "https://registry.yarnpkg.com/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d"
async@^2.1.2, async@^2.1.5, async@^2.4.1:
version "2.5.0" version "2.5.0"
resolved "https://registry.yarnpkg.com/async/-/async-2.5.0.tgz#843190fd6b7357a0b9e1c956edddd5ec8462b54d" resolved "https://registry.yarnpkg.com/async/-/async-2.5.0.tgz#843190fd6b7357a0b9e1c956edddd5ec8462b54d"
dependencies: dependencies:
@ -851,8 +858,8 @@ browser-sync@^2.18.5:
yargs "6.4.0" yargs "6.4.0"
browserify-aes@^1.0.0, browserify-aes@^1.0.4: browserify-aes@^1.0.0, browserify-aes@^1.0.4:
version "1.0.8" version "1.1.1"
resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.0.8.tgz#c8fa3b1b7585bb7ba77c5560b60996ddec6d5309" resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.1.1.tgz#38b7ab55edb806ff2dcda1a7f1620773a477c49f"
dependencies: dependencies:
buffer-xor "^1.0.3" buffer-xor "^1.0.3"
cipher-base "^1.0.0" cipher-base "^1.0.0"
@ -989,8 +996,8 @@ caniuse-api@^1.5.2:
lodash.uniq "^4.5.0" lodash.uniq "^4.5.0"
caniuse-db@^1.0.30000529, caniuse-db@^1.0.30000634, caniuse-db@^1.0.30000639: caniuse-db@^1.0.30000529, caniuse-db@^1.0.30000634, caniuse-db@^1.0.30000639:
version "1.0.30000744" version "1.0.30000752"
resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000744.tgz#00758ff7dd5f7138d34a15608dccf71a59656ffe" resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000752.tgz#daa129d54ce700e94ad14388bdef514ec1e2dd54"
canonical-path@0.0.2: canonical-path@0.0.2:
version "0.0.2" version "0.0.2"
@ -1027,17 +1034,9 @@ chalk@^1.1.1, chalk@^1.1.3:
strip-ansi "^3.0.0" strip-ansi "^3.0.0"
supports-color "^2.0.0" supports-color "^2.0.0"
chalk@^2.0.0, chalk@^2.1.0: chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0:
version "2.1.0" version "2.3.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.1.0.tgz#ac5becf14fa21b99c6c92ca7a7d7cfd5b17e743e" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba"
dependencies:
ansi-styles "^3.1.0"
escape-string-regexp "^1.0.5"
supports-color "^4.0.0"
chalk@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.0.1.tgz#dbec49436d2ae15f536114e76d14656cdbc0f44d"
dependencies: dependencies:
ansi-styles "^3.1.0" ansi-styles "^3.1.0"
escape-string-regexp "^1.0.5" escape-string-regexp "^1.0.5"
@ -1215,10 +1214,10 @@ component-inherit@0.0.3:
resolved "https://registry.yarnpkg.com/component-inherit/-/component-inherit-0.0.3.tgz#645fc4adf58b72b649d5cae65135619db26ff143" resolved "https://registry.yarnpkg.com/component-inherit/-/component-inherit-0.0.3.tgz#645fc4adf58b72b649d5cae65135619db26ff143"
compressible@~2.0.11: compressible@~2.0.11:
version "2.0.11" version "2.0.12"
resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.11.tgz#16718a75de283ed8e604041625a2064586797d8a" resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.12.tgz#c59a5c99db76767e9876500e271ef63b3493bd66"
dependencies: dependencies:
mime-db ">= 1.29.0 < 2" mime-db ">= 1.30.0 < 2"
compression@^1.5.2: compression@^1.5.2:
version "1.7.1" version "1.7.1"
@ -1258,8 +1257,8 @@ concurrently@^3.0.0:
tree-kill "^1.1.0" tree-kill "^1.1.0"
connect-history-api-fallback@^1.1.0, connect-history-api-fallback@^1.2.0, connect-history-api-fallback@^1.3.0: connect-history-api-fallback@^1.1.0, connect-history-api-fallback@^1.2.0, connect-history-api-fallback@^1.3.0:
version "1.3.0" version "1.4.0"
resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.3.0.tgz#e51d17f8f0ef0db90a64fdb47de3051556e9f169" resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.4.0.tgz#3db24f973f4b923b0e82f619ce0df02411ca623d"
connect-logger@0.0.1: connect-logger@0.0.1:
version "0.0.1" version "0.0.1"
@ -1327,9 +1326,9 @@ cookie@0.3.1:
version "0.3.1" version "0.3.1"
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb" resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb"
copy-webpack-plugin@^4.0.1: copy-webpack-plugin@^4.0.1, copy-webpack-plugin@^4.1.1:
version "4.1.1" version "4.2.0"
resolved "https://registry.yarnpkg.com/copy-webpack-plugin/-/copy-webpack-plugin-4.1.1.tgz#53ae69e04955ebfa9fda411f54cbb968531d71fd" resolved "https://registry.yarnpkg.com/copy-webpack-plugin/-/copy-webpack-plugin-4.2.0.tgz#252bb94597f96399d23d7fad355f8d3a661ac096"
dependencies: dependencies:
bluebird "^3.5.1" bluebird "^3.5.1"
fs-extra "^4.0.2" fs-extra "^4.0.2"
@ -1579,8 +1578,8 @@ dashdash@^1.12.0:
assert-plus "^1.0.0" assert-plus "^1.0.0"
date-fns@^1.23.0: date-fns@^1.23.0:
version "1.28.5" version "1.29.0"
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.28.5.tgz#257cfc45d322df45ef5658665967ee841cd73faf" resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.29.0.tgz#12e609cdcb935127311d04d33334e2960a2a54e6"
date-now@^0.1.4: date-now@^0.1.4:
version "0.1.4" version "0.1.4"
@ -1711,8 +1710,8 @@ diff@^2.2.1:
resolved "https://registry.yarnpkg.com/diff/-/diff-2.2.3.tgz#60eafd0d28ee906e4e8ff0a52c1229521033bf99" resolved "https://registry.yarnpkg.com/diff/-/diff-2.2.3.tgz#60eafd0d28ee906e4e8ff0a52c1229521033bf99"
diff@^3.1.0: diff@^3.1.0:
version "3.3.1" version "3.4.0"
resolved "https://registry.yarnpkg.com/diff/-/diff-3.3.1.tgz#aa8567a6eed03c531fc89d3f711cd0e5259dec75" resolved "https://registry.yarnpkg.com/diff/-/diff-3.4.0.tgz#b1d85507daf3964828de54b37d0d73ba67dda56c"
diffie-hellman@^5.0.0: diffie-hellman@^5.0.0:
version "5.0.2" version "5.0.2"
@ -1840,8 +1839,8 @@ ejs@^2.5.7:
resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.5.7.tgz#cc872c168880ae3c7189762fd5ffc00896c9518a" resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.5.7.tgz#cc872c168880ae3c7189762fd5ffc00896c9518a"
electron-to-chromium@^1.2.7: electron-to-chromium@^1.2.7:
version "1.3.24" version "1.3.27"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.24.tgz#9b7b88bb05ceb9fa016a177833cc2dde388f21b6" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz#78ecb8a399066187bb374eede35d9c70565a803d"
elliptic@^6.0.0: elliptic@^6.0.0:
version "6.4.0" version "6.4.0"
@ -1978,20 +1977,20 @@ error-ex@^1.2.0:
dependencies: dependencies:
is-arrayish "^0.2.1" is-arrayish "^0.2.1"
es5-ext@^0.10.14, es5-ext@^0.10.9, es5-ext@~0.10.14: es5-ext@^0.10.14, es5-ext@^0.10.35, es5-ext@^0.10.9, es5-ext@~0.10.14:
version "0.10.30" version "0.10.35"
resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.30.tgz#7141a16836697dbabfaaaeee41495ce29f52c939" resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.35.tgz#18ee858ce6a3c45c7d79e91c15fcca9ec568494f"
dependencies: dependencies:
es6-iterator "2" es6-iterator "~2.0.1"
es6-symbol "~3.1" es6-symbol "~3.1.1"
es6-iterator@2, es6-iterator@^2.0.1, es6-iterator@~2.0.1: es6-iterator@^2.0.1, es6-iterator@~2.0.1:
version "2.0.1" version "2.0.3"
resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.1.tgz#8e319c9f0453bf575d374940a655920e59ca5512" resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7"
dependencies: dependencies:
d "1" d "1"
es5-ext "^0.10.14" es5-ext "^0.10.35"
es6-symbol "^3.1" es6-symbol "^3.1.1"
es6-map@^0.1.3: es6-map@^0.1.3:
version "0.1.5" version "0.1.5"
@ -2018,7 +2017,7 @@ es6-set@~0.1.5:
es6-symbol "3.1.1" es6-symbol "3.1.1"
event-emitter "~0.3.5" event-emitter "~0.3.5"
es6-symbol@3.1.1, es6-symbol@^3.1, es6-symbol@^3.1.1, es6-symbol@~3.1, es6-symbol@~3.1.1: es6-symbol@3.1.1, es6-symbol@^3.1.1, es6-symbol@~3.1.1:
version "3.1.1" version "3.1.1"
resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77" resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77"
dependencies: dependencies:
@ -2185,8 +2184,8 @@ express@2.5.x:
qs "0.4.x" qs "0.4.x"
express@^4.13.3, express@^4.14.1: express@^4.13.3, express@^4.14.1:
version "4.16.1" version "4.16.2"
resolved "https://registry.yarnpkg.com/express/-/express-4.16.1.tgz#6b33b560183c9b253b7b62144df33a4654ac9ed0" resolved "https://registry.yarnpkg.com/express/-/express-4.16.2.tgz#e35c6dfe2d64b7dca0a5cd4f21781be3299e076c"
dependencies: dependencies:
accepts "~1.3.4" accepts "~1.3.4"
array-flatten "1.1.1" array-flatten "1.1.1"
@ -2263,6 +2262,10 @@ fast-deep-equal@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff"
fast-json-stable-stringify@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2"
fastparse@^1.1.1: fastparse@^1.1.1:
version "1.1.1" version "1.1.1"
resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.1.tgz#d1e2643b38a94d7583b479060e6c4affc94071f8" resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.1.tgz#d1e2643b38a94d7583b479060e6c4affc94071f8"
@ -2285,18 +2288,19 @@ fd-slicer@~1.0.1:
dependencies: dependencies:
pend "~1.2.0" pend "~1.2.0"
file-loader@^0.10.0:
version "0.10.1"
resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-0.10.1.tgz#815034119891fc6441fb5a64c11bc93c22ddd842"
dependencies:
loader-utils "^1.0.2"
file-loader@^0.9.0: file-loader@^0.9.0:
version "0.9.0" version "0.9.0"
resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-0.9.0.tgz#1d2daddd424ce6d1b07cfe3f79731bed3617ab42" resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-0.9.0.tgz#1d2daddd424ce6d1b07cfe3f79731bed3617ab42"
dependencies: dependencies:
loader-utils "~0.2.5" loader-utils "~0.2.5"
file-loader@^1.1.5:
version "1.1.5"
resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-1.1.5.tgz#91c25b6b6fbe56dae99f10a425fd64933b5c9daa"
dependencies:
loader-utils "^1.0.2"
schema-utils "^0.3.0"
filename-regex@^2.0.0: filename-regex@^2.0.0:
version "2.0.1" version "2.0.1"
resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26"
@ -2812,8 +2816,8 @@ html-loader@^0.4.3:
object-assign "^4.1.0" object-assign "^4.1.0"
html-minifier@^3.0.1, html-minifier@^3.2.3: html-minifier@^3.0.1, html-minifier@^3.2.3:
version "3.5.5" version "3.5.6"
resolved "https://registry.yarnpkg.com/html-minifier/-/html-minifier-3.5.5.tgz#3bdc9427e638bbe3dbde96c0eb988b044f02739e" resolved "https://registry.yarnpkg.com/html-minifier/-/html-minifier-3.5.6.tgz#7e4e661a09999599c7d8e8a2b8d7fb7430bb5c3e"
dependencies: dependencies:
camel-case "3.0.x" camel-case "3.0.x"
clean-css "4.1.x" clean-css "4.1.x"
@ -3049,8 +3053,8 @@ is-binary-path@^1.0.0:
binary-extensions "^1.0.0" binary-extensions "^1.0.0"
is-buffer@^1.0.2, is-buffer@^1.1.5, is-buffer@~1.1.1: is-buffer@^1.0.2, is-buffer@^1.1.5, is-buffer@~1.1.1:
version "1.1.5" version "1.1.6"
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.5.tgz#1f3b26ef613b214b88cbca23cc6c01d87961eecc" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
is-builtin-module@^1.0.0: is-builtin-module@^1.0.0:
version "1.0.0" version "1.0.0"
@ -3240,8 +3244,8 @@ istanbul-lib-coverage@^1.1.1:
resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz#73bfb998885299415c93d38a3e9adf784a77a9da" resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz#73bfb998885299415c93d38a3e9adf784a77a9da"
istanbul-lib-instrument@^1.1.3: istanbul-lib-instrument@^1.1.3:
version "1.8.0" version "1.9.1"
resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.8.0.tgz#66f6c9421cc9ec4704f76f2db084ba9078a2b532" resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.9.1.tgz#250b30b3531e5d3251299fdd64b0b2c9db6b558e"
dependencies: dependencies:
babel-generator "^6.18.0" babel-generator "^6.18.0"
babel-template "^6.16.0" babel-template "^6.16.0"
@ -3499,8 +3503,8 @@ less-loader@^4.0.5:
pify "^2.3.0" pify "^2.3.0"
less@^2.7.2: less@^2.7.2:
version "2.7.2" version "2.7.3"
resolved "https://registry.yarnpkg.com/less/-/less-2.7.2.tgz#368d6cc73e1fb03981183280918743c5dcf9b3df" resolved "https://registry.yarnpkg.com/less/-/less-2.7.3.tgz#cc1260f51c900a9ec0d91fb6998139e02507b63b"
optionalDependencies: optionalDependencies:
errno "^0.1.1" errno "^0.1.1"
graceful-fs "^4.1.2" graceful-fs "^4.1.2"
@ -3508,12 +3512,12 @@ less@^2.7.2:
mime "^1.2.11" mime "^1.2.11"
mkdirp "^0.5.0" mkdirp "^0.5.0"
promise "^7.1.1" promise "^7.1.1"
request "^2.72.0" request "2.81.0"
source-map "^0.5.3" source-map "^0.5.3"
license-webpack-plugin@^1.0.0: license-webpack-plugin@^1.0.0:
version "1.1.0" version "1.1.1"
resolved "https://registry.yarnpkg.com/license-webpack-plugin/-/license-webpack-plugin-1.1.0.tgz#99117ae985fb6c2a70df301b8a1ae0268f17f433" resolved "https://registry.yarnpkg.com/license-webpack-plugin/-/license-webpack-plugin-1.1.1.tgz#76b2cedccc78f139fd7877e576f756cfc141b8c2"
dependencies: dependencies:
ejs "^2.5.7" ejs "^2.5.7"
@ -3635,8 +3639,8 @@ log4js@^0.6.31:
semver "~4.3.3" semver "~4.3.3"
loglevel@^1.4.1: loglevel@^1.4.1:
version "1.5.0" version "1.5.1"
resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.5.0.tgz#3863984a2c326b986fbb965f378758a6dc8a4324" resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.5.1.tgz#189078c94ab9053ee215a0acdbf24244ea0f6502"
longest@^1.0.1: longest@^1.0.1:
version "1.0.1" version "1.0.1"
@ -3776,7 +3780,11 @@ miller-rabin@^4.0.0:
bn.js "^4.0.0" bn.js "^4.0.0"
brorand "^1.0.1" brorand "^1.0.1"
"mime-db@>= 1.29.0 < 2", mime-db@~1.30.0: "mime-db@>= 1.30.0 < 2":
version "1.31.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.31.0.tgz#a49cd8f3ebf3ed1a482b60561d9105ad40ca74cb"
mime-db@~1.30.0:
version "1.30.0" version "1.30.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.30.0.tgz#74c643da2dd9d6a45399963465b26d5ca7d71f01" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.30.0.tgz#74c643da2dd9d6a45399963465b26d5ca7d71f01"
@ -3863,8 +3871,8 @@ mkdirp@0.5.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkd
minimist "0.0.8" minimist "0.0.8"
moment@*: moment@*:
version "2.18.1" version "2.19.1"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.18.1.tgz#c36193dd3ce1c2eed2adb7c802dbbc77a81b1c0f" resolved "https://registry.yarnpkg.com/moment/-/moment-2.19.1.tgz#56da1a2d1cbf01d38b7e1afc31c10bcfa1929167"
ms@0.7.1: ms@0.7.1:
version "0.7.1" version "0.7.1"
@ -4732,8 +4740,8 @@ pretty-error@^2.0.2:
utila "~0.4" utila "~0.4"
private@~0.1.5: private@~0.1.5:
version "0.1.7" version "0.1.8"
resolved "https://registry.yarnpkg.com/private/-/private-0.1.7.tgz#68ce5e8a1ef0a23bb570cc28537b5332aba63ef1" resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff"
process-nextick-args@~1.0.6: process-nextick-args@~1.0.6:
version "1.0.7" version "1.0.7"
@ -4811,8 +4819,8 @@ q@1.4.1:
resolved "https://registry.yarnpkg.com/q/-/q-1.4.1.tgz#55705bcd93c5f3673530c2c2cbc0c2b3addc286e" resolved "https://registry.yarnpkg.com/q/-/q-1.4.1.tgz#55705bcd93c5f3673530c2c2cbc0c2b3addc286e"
q@^1.1.2, q@^1.4.1: q@^1.1.2, q@^1.4.1:
version "1.5.0" version "1.5.1"
resolved "https://registry.yarnpkg.com/q/-/q-1.5.0.tgz#dd01bac9d06d30e6f219aecb8253ee9ebdc308f1" resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7"
qjobs@^1.1.4: qjobs@^1.1.4:
version "1.1.5" version "1.1.5"
@ -4892,8 +4900,8 @@ raw-loader@^0.5.1:
resolved "https://registry.yarnpkg.com/raw-loader/-/raw-loader-0.5.1.tgz#0c3d0beaed8a01c966d9787bf778281252a979aa" resolved "https://registry.yarnpkg.com/raw-loader/-/raw-loader-0.5.1.tgz#0c3d0beaed8a01c966d9787bf778281252a979aa"
rc@^1.1.7: rc@^1.1.7:
version "1.2.1" version "1.2.2"
resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.1.tgz#2e03e8e42ee450b8cb3dce65be1bf8974e1dfd95" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.2.tgz#d8ce9cb57e8d64d9c7badd9876c7c34cbe3c7077"
dependencies: dependencies:
deep-extend "~0.4.0" deep-extend "~0.4.0"
ini "~1.3.0" ini "~1.3.0"
@ -5068,7 +5076,7 @@ request-progress@~2.0.1:
dependencies: dependencies:
throttleit "^1.0.0" throttleit "^1.0.0"
request@2, request@^2.72.0, request@^2.78.0, request@^2.79.0: request@2, request@^2.78.0, request@^2.79.0:
version "2.83.0" version "2.83.0"
resolved "https://registry.yarnpkg.com/request/-/request-2.83.0.tgz#ca0b65da02ed62935887808e6f510381034e3356" resolved "https://registry.yarnpkg.com/request/-/request-2.83.0.tgz#ca0b65da02ed62935887808e6f510381034e3356"
dependencies: dependencies:
@ -5143,8 +5151,8 @@ resolve@1.1.7:
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"
resolve@^1.1.6, resolve@^1.1.7, resolve@^1.4.0: resolve@^1.1.6, resolve@^1.1.7, resolve@^1.4.0:
version "1.4.0" version "1.5.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.4.0.tgz#a75be01c53da25d934a98ebd0e4c4a7312f92a86" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36"
dependencies: dependencies:
path-parse "^1.0.5" path-parse "^1.0.5"
@ -5179,10 +5187,10 @@ ripemd160@^2.0.0, ripemd160@^2.0.1:
inherits "^2.0.1" inherits "^2.0.1"
rollup-plugin-commonjs@^8.0.2: rollup-plugin-commonjs@^8.0.2:
version "8.2.1" version "8.2.5"
resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-8.2.1.tgz#5e40c78375eb163c14c76bce69da1750e5905a2e" resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-8.2.5.tgz#924421278a6f879fd976b2ef1a28391b1e4f2a6e"
dependencies: dependencies:
acorn "^5.1.1" acorn "^5.1.2"
estree-walker "^0.5.0" estree-walker "^0.5.0"
magic-string "^0.22.4" magic-string "^0.22.4"
resolve "^1.4.0" resolve "^1.4.0"
@ -5223,9 +5231,9 @@ rx@4.1.0:
version "4.1.0" version "4.1.0"
resolved "https://registry.yarnpkg.com/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782" resolved "https://registry.yarnpkg.com/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782"
rxjs@^5.1.0, rxjs@^5.4.2: rxjs@^5.4.2, rxjs@^5.5.0:
version "5.4.3" version "5.5.2"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.4.3.tgz#0758cddee6033d68e0fd53676f0f3596ce3d483f" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.2.tgz#28d403f0071121967f18ad665563255d54236ac3"
dependencies: dependencies:
symbol-observable "^1.0.1" symbol-observable "^1.0.1"
@ -5481,8 +5489,8 @@ sntp@1.x.x:
hoek "2.x.x" hoek "2.x.x"
sntp@2.x.x: sntp@2.x.x:
version "2.0.2" version "2.1.0"
resolved "https://registry.yarnpkg.com/sntp/-/sntp-2.0.2.tgz#5064110f0af85f7cfdb7d6b67a40028ce52b4b2b" resolved "https://registry.yarnpkg.com/sntp/-/sntp-2.1.0.tgz#2c6cec14fedc2222739caf9b5c3d85d1cc5a2cc8"
dependencies: dependencies:
hoek "4.x.x" hoek "4.x.x"
@ -5604,12 +5612,12 @@ source-map-explorer@^1.3.2:
underscore "^1.8.3" underscore "^1.8.3"
source-map-loader@^0.2.0: source-map-loader@^0.2.0:
version "0.2.2" version "0.2.3"
resolved "https://registry.yarnpkg.com/source-map-loader/-/source-map-loader-0.2.2.tgz#1249348ff6a66ea64a2957fc98f74cb6bba67505" resolved "https://registry.yarnpkg.com/source-map-loader/-/source-map-loader-0.2.3.tgz#d4b0c8cd47d54edce3e6bfa0f523f452b5b0e521"
dependencies: dependencies:
async "^0.9.0" async "^2.5.0"
loader-utils "~0.2.2" loader-utils "~0.2.2"
source-map "~0.1.33" source-map "~0.6.1"
source-map-support@^0.4.0, source-map-support@^0.4.1, source-map-support@^0.4.2, source-map-support@~0.4.0: source-map-support@^0.4.0, source-map-support@^0.4.1, source-map-support@^0.4.2, source-map-support@~0.4.0:
version "0.4.18" version "0.4.18"
@ -5617,7 +5625,7 @@ source-map-support@^0.4.0, source-map-support@^0.4.1, source-map-support@^0.4.2,
dependencies: dependencies:
source-map "^0.5.6" source-map "^0.5.6"
source-map@0.1.x, source-map@~0.1.33, source-map@~0.1.7: source-map@0.1.x, source-map@~0.1.7:
version "0.1.43" version "0.1.43"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.43.tgz#c24bc146ca517c1471f5dacbe2571b2b7f9e3346" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.43.tgz#c24bc146ca517c1471f5dacbe2571b2b7f9e3346"
dependencies: dependencies:
@ -5633,7 +5641,7 @@ source-map@^0.4.2:
dependencies: dependencies:
amdefine ">=0.0.4" amdefine ">=0.0.4"
source-map@^0.6.1: source-map@^0.6.1, source-map@~0.6.1:
version "0.6.1" version "0.6.1"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
@ -5700,7 +5708,11 @@ sshpk@^1.7.0:
jsbn "~0.1.0" jsbn "~0.1.0"
tweetnacl "~0.14.0" tweetnacl "~0.14.0"
"statuses@>= 1.3.1 < 2", statuses@~1.3.0, statuses@~1.3.1: "statuses@>= 1.3.1 < 2":
version "1.4.0"
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.4.0.tgz#bb73d446da2796106efcc1b601a253d6c46bd087"
statuses@~1.3.0, statuses@~1.3.1:
version "1.3.1" version "1.3.1"
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.3.1.tgz#faf51b9eb74aaef3b3acf4ad5f61abf24cb7b93e" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.3.1.tgz#faf51b9eb74aaef3b3acf4ad5f61abf24cb7b93e"
@ -5849,8 +5861,8 @@ supports-color@^3.1.1, supports-color@^3.2.3:
has-flag "^1.0.0" has-flag "^1.0.0"
supports-color@^4.0.0, supports-color@^4.2.1, supports-color@^4.4.0: supports-color@^4.0.0, supports-color@^4.2.1, supports-color@^4.4.0:
version "4.4.0" version "4.5.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.4.0.tgz#883f7ddabc165142b2a61427f3352ded195d1a3e" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b"
dependencies: dependencies:
has-flag "^2.0.0" has-flag "^2.0.0"
@ -5881,8 +5893,8 @@ tapable@^0.2.7:
resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.2.8.tgz#99372a5c999bf2df160afc0d74bed4f47948cd22" resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.2.8.tgz#99372a5c999bf2df160afc0d74bed4f47948cd22"
tar-pack@^3.4.0: tar-pack@^3.4.0:
version "3.4.0" version "3.4.1"
resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.4.0.tgz#23be2d7f671a8339376cbdb0b8fe3fdebf317984" resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.4.1.tgz#e1dbc03a9b9d3ba07e896ad027317eb679a10a1f"
dependencies: dependencies:
debug "^2.2.0" debug "^2.2.0"
fstream "^1.0.10" fstream "^1.0.10"
@ -6025,8 +6037,8 @@ tsickle@^0.21.0:
source-map-support "^0.4.2" source-map-support "^0.4.2"
tslib@^1.7.1: tslib@^1.7.1:
version "1.7.1" version "1.8.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.7.1.tgz#bc8004164691923a79fe8378bbeb3da2017538ec" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.8.0.tgz#dc604ebad64bcbf696d613da6c954aa0e7ea1eb6"
tslint@^3.15.1: tslint@^3.15.1:
version "3.15.1" version "3.15.1"
@ -6078,11 +6090,11 @@ ua-parser-js@0.7.12:
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.12.tgz#04c81a99bdd5dc52263ea29d24c6bf8d4818a4bb" resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.12.tgz#04c81a99bdd5dc52263ea29d24c6bf8d4818a4bb"
uglify-js@3.1.x: uglify-js@3.1.x:
version "3.1.3" version "3.1.5"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.1.3.tgz#d61f0453b4718cab01581f3162aa90bab7520b42" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.1.5.tgz#4c1a6d53b2fe77e4710dd94631853effd3ff5143"
dependencies: dependencies:
commander "~2.11.0" commander "~2.11.0"
source-map "~0.5.1" source-map "~0.6.1"
uglify-js@^2.6.1, uglify-js@^2.8.29: uglify-js@^2.6.1, uglify-js@^2.8.29:
version "2.8.29" version "2.8.29"
@ -6172,7 +6184,7 @@ url-join@^1.0.0:
version "1.1.0" version "1.1.0"
resolved "https://registry.yarnpkg.com/url-join/-/url-join-1.1.0.tgz#741c6c2f4596c4830d6718460920d0c92202dc78" resolved "https://registry.yarnpkg.com/url-join/-/url-join-1.1.0.tgz#741c6c2f4596c4830d6718460920d0c92202dc78"
url-loader@^0.6.0: url-loader@^0.6.2:
version "0.6.2" version "0.6.2"
resolved "https://registry.yarnpkg.com/url-loader/-/url-loader-0.6.2.tgz#a007a7109620e9d988d14bce677a1decb9a993f7" resolved "https://registry.yarnpkg.com/url-loader/-/url-loader-0.6.2.tgz#a007a7109620e9d988d14bce677a1decb9a993f7"
dependencies: dependencies:
@ -6384,16 +6396,16 @@ webpack-sources@^0.1.0:
source-list-map "~0.1.7" source-list-map "~0.1.7"
source-map "~0.5.3" source-map "~0.5.3"
webpack-sources@^1.0.1: webpack-sources@^1.0.0, webpack-sources@^1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.0.1.tgz#c7356436a4d13123be2e2426a05d1dad9cbe65cf" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.0.1.tgz#c7356436a4d13123be2e2426a05d1dad9cbe65cf"
dependencies: dependencies:
source-list-map "^2.0.0" source-list-map "^2.0.0"
source-map "~0.5.3" source-map "~0.5.3"
webpack@~3.6.0: webpack@~3.7.1:
version "3.6.0" version "3.7.1"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-3.6.0.tgz#a89a929fbee205d35a4fa2cc487be9cbec8898bc" resolved "https://registry.yarnpkg.com/webpack/-/webpack-3.7.1.tgz#6046b5c415ff7df7a0dc54c5b6b86098e8b952da"
dependencies: dependencies:
acorn "^5.0.0" acorn "^5.0.0"
acorn-dynamic-import "^2.0.0" acorn-dynamic-import "^2.0.0"

View File

@ -1,6 +1,6 @@
{ {
"name": "angular-srcs", "name": "angular-srcs",
"version": "5.0.0-rc.4", "version": "5.0.0-rc.8",
"private": true, "private": true,
"branchPattern": "2.0.*", "branchPattern": "2.0.*",
"description": "Angular - a web framework for modern web apps", "description": "Angular - a web framework for modern web apps",
@ -24,7 +24,7 @@
"dependencies": { "dependencies": {
"core-js": "^2.4.1", "core-js": "^2.4.1",
"reflect-metadata": "^0.1.3", "reflect-metadata": "^0.1.3",
"rxjs": "^5.5.0", "rxjs": "^5.5.2",
"tslib": "^1.7.1", "tslib": "^1.7.1",
"zone.js": "^0.8.12" "zone.js": "^0.8.12"
}, },

View File

@ -38,10 +38,10 @@ export function translateDiagnostics(host: TypeCheckHost, untranslatedDiagnostic
source: SOURCE, source: SOURCE,
code: DEFAULT_ERROR_CODE code: DEFAULT_ERROR_CODE
}); });
return;
} }
} else {
ts.push(diagnostic);
} }
ts.push(diagnostic);
}); });
return {ts, ng}; return {ts, ng};
} }

View File

@ -45,6 +45,12 @@ function createEmitCallback(options: api.CompilerOptions): api.TsEmitCallback|un
if (!transformDecorators && !transformTypesToClosure) { if (!transformDecorators && !transformTypesToClosure) {
return undefined; return undefined;
} }
if (transformDecorators) {
// This is needed as a workaround for https://github.com/angular/tsickle/issues/635
// Otherwise tsickle might emit references to non imported values
// as TypeScript elided the import.
options.emitDecoratorMetadata = true;
}
const tsickleHost: tsickle.TsickleHost = { const tsickleHost: tsickle.TsickleHost = {
shouldSkipTsickleProcessing: (fileName) => shouldSkipTsickleProcessing: (fileName) =>
/\.d\.ts$/.test(fileName) || GENERATED_FILES.test(fileName), /\.d\.ts$/.test(fileName) || GENERATED_FILES.test(fileName),

View File

@ -89,7 +89,7 @@ export class NgTools_InternalApi_NG_2 {
// as we only needed this to support Angular CLI 1.5.0 rc.* // as we only needed this to support Angular CLI 1.5.0 rc.*
const ngProgram = createProgram({ const ngProgram = createProgram({
rootNames: options.program.getRootFileNames(), rootNames: options.program.getRootFileNames(),
options: options.angularCompilerOptions, options: {...options.angularCompilerOptions, collectAllErrors: true},
host: options.host host: options.host
}); });
const lazyRoutes = ngProgram.listLazyRoutes(options.entryModule); const lazyRoutes = ngProgram.listLazyRoutes(options.entryModule);

View File

@ -129,6 +129,7 @@ export function performWatchCompilation(host: PerformWatchHost):
return {close, ready: cb => readyPromise.then(cb), firstCompileResult}; return {close, ready: cb => readyPromise.then(cb), firstCompileResult};
function cacheEntry(fileName: string): CacheEntry { function cacheEntry(fileName: string): CacheEntry {
fileName = path.normalize(fileName);
let entry = fileCache.get(fileName); let entry = fileCache.get(fileName);
if (!entry) { if (!entry) {
entry = {}; entry = {};
@ -191,6 +192,10 @@ export function performWatchCompilation(host: PerformWatchHost):
}; };
} }
ingoreFilesForWatch.clear(); ingoreFilesForWatch.clear();
const oldProgram = cachedProgram;
// We clear out the `cachedProgram` here as a
// program can only be used as `oldProgram` 1x
cachedProgram = undefined;
const compileResult = performCompilation({ const compileResult = performCompilation({
rootNames: cachedOptions.rootNames, rootNames: cachedOptions.rootNames,
options: cachedOptions.options, options: cachedOptions.options,
@ -245,7 +250,7 @@ export function performWatchCompilation(host: PerformWatchHost):
if (event === FileChangeEvent.CreateDeleteDir) { if (event === FileChangeEvent.CreateDeleteDir) {
fileCache.clear(); fileCache.clear();
} else { } else {
fileCache.delete(fileName); fileCache.delete(path.normalize(fileName));
} }
if (!ingoreFilesForWatch.has(path.normalize(fileName))) { if (!ingoreFilesForWatch.has(path.normalize(fileName))) {

View File

@ -150,6 +150,9 @@ export interface CompilerOptions extends ts.CompilerOptions {
* in JIT mode. This is off by default. * in JIT mode. This is off by default.
*/ */
enableSummariesForJit?: boolean; enableSummariesForJit?: boolean;
/** @internal */
collectAllErrors?: boolean;
} }
export interface CompilerHost extends ts.CompilerHost { export interface CompilerHost extends ts.CompilerHost {

View File

@ -426,6 +426,12 @@ export class TsCompilerAotCompilerTypeCheckHostAdapter implements ts.CompilerHos
} }
isSourceFile(filePath: string): boolean { isSourceFile(filePath: string): boolean {
// Don't generate any files nor typecheck them
// if skipTemplateCodegen is set and fullTemplateTypeCheck is not yet set,
// for backwards compatibility.
if (this.options.skipTemplateCodegen && !this.options.fullTemplateTypeCheck) {
return false;
}
// If we have a summary from a previous compilation, // If we have a summary from a previous compilation,
// treat the file never as a source file. // treat the file never as a source file.
if (this.librarySummaries.has(filePath)) { if (this.librarySummaries.has(filePath)) {

View File

@ -181,11 +181,13 @@ function createVariableStatementForDeclarations(declarations: Declaration[]): ts
/* modifiers */ undefined, ts.createVariableDeclarationList(varDecls, ts.NodeFlags.Const)); /* modifiers */ undefined, ts.createVariableDeclarationList(varDecls, ts.NodeFlags.Const));
} }
export function getExpressionLoweringTransformFactory(requestsMap: RequestsMap): export function getExpressionLoweringTransformFactory(
(context: ts.TransformationContext) => (sourceFile: ts.SourceFile) => ts.SourceFile { requestsMap: RequestsMap, program: ts.Program): (context: ts.TransformationContext) =>
(sourceFile: ts.SourceFile) => ts.SourceFile {
// Return the factory // Return the factory
return (context: ts.TransformationContext) => (sourceFile: ts.SourceFile): ts.SourceFile => { return (context: ts.TransformationContext) => (sourceFile: ts.SourceFile): ts.SourceFile => {
const requests = requestsMap.getRequests(sourceFile); // We need to use the original SourceFile for reading metadata, and not the transformed one.
const requests = requestsMap.getRequests(program.getSourceFile(sourceFile.fileName));
if (requests && requests.size) { if (requests && requests.size) {
return transformSourceFile(sourceFile, requests, context); return transformSourceFile(sourceFile, requests, context);
} }

View File

@ -144,12 +144,14 @@ class _NodeEmitterVisitor implements StatementVisitor, ExpressionVisitor {
const span = node.sourceSpan; const span = node.sourceSpan;
if (span.start.file == span.end.file) { if (span.start.file == span.end.file) {
const file = span.start.file; const file = span.start.file;
let source = this._templateSources.get(file); if (file.url) {
if (!source) { let source = this._templateSources.get(file);
source = ts.createSourceMapSource(file.url, file.content, pos => pos); if (!source) {
this._templateSources.set(file, source); source = ts.createSourceMapSource(file.url, file.content, pos => pos);
this._templateSources.set(file, source);
}
return {pos: span.start.offset, end: span.end.offset, source};
} }
return {pos: span.start.offset, end: span.end.offset, source};
} }
} }
return null; return null;

View File

@ -18,7 +18,7 @@ import {CompilerHost, CompilerOptions, CustomTransformers, DEFAULT_ERROR_CODE, D
import {CodeGenerator, TsCompilerAotCompilerTypeCheckHostAdapter, getOriginalReferences} from './compiler_host'; import {CodeGenerator, TsCompilerAotCompilerTypeCheckHostAdapter, getOriginalReferences} from './compiler_host';
import {LowerMetadataCache, getExpressionLoweringTransformFactory} from './lower_expressions'; import {LowerMetadataCache, getExpressionLoweringTransformFactory} from './lower_expressions';
import {getAngularEmitterTransformFactory} from './node_emitter_transform'; import {getAngularEmitterTransformFactory} from './node_emitter_transform';
import {GENERATED_FILES, StructureIsReused, createMessageDiagnostic, isInRootDir, tsStructureIsReused} from './util'; import {GENERATED_FILES, StructureIsReused, createMessageDiagnostic, isInRootDir, ngToTsDiagnostic, tsStructureIsReused} from './util';
@ -149,11 +149,9 @@ class AngularCompilerProgram implements Program {
getTsSemanticDiagnostics(sourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken): getTsSemanticDiagnostics(sourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken):
ts.Diagnostic[] { ts.Diagnostic[] {
if (sourceFile) { const sourceFiles = sourceFile ? [sourceFile] : this.tsProgram.getSourceFiles();
return this.tsProgram.getSemanticDiagnostics(sourceFile, cancellationToken);
}
let diags: ts.Diagnostic[] = []; let diags: ts.Diagnostic[] = [];
this.tsProgram.getSourceFiles().forEach(sf => { sourceFiles.forEach(sf => {
if (!GENERATED_FILES.test(sf.fileName)) { if (!GENERATED_FILES.test(sf.fileName)) {
diags.push(...this.tsProgram.getSemanticDiagnostics(sf, cancellationToken)); diags.push(...this.tsProgram.getSemanticDiagnostics(sf, cancellationToken));
} }
@ -177,15 +175,17 @@ class AngularCompilerProgram implements Program {
if (this._analyzedModules) { if (this._analyzedModules) {
throw new Error('Angular structure already loaded'); throw new Error('Angular structure already loaded');
} }
const {tmpProgram, sourceFiles, rootNames} = this._createProgramWithBasicStubs(); return Promise.resolve()
return this.compiler.loadFilesAsync(sourceFiles) .then(() => {
.catch(this.catchAnalysisError.bind(this)) const {tmpProgram, sourceFiles, rootNames} = this._createProgramWithBasicStubs();
.then(analyzedModules => { return this.compiler.loadFilesAsync(sourceFiles).then(analyzedModules => {
if (this._analyzedModules) { if (this._analyzedModules) {
throw new Error('Angular structure loaded both synchronously and asynchronsly'); throw new Error('Angular structure loaded both synchronously and asynchronsly');
} }
this._updateProgramWithTypeCheckStubs(tmpProgram, analyzedModules, rootNames); this._updateProgramWithTypeCheckStubs(tmpProgram, analyzedModules, rootNames);
}); });
})
.catch(e => this._createProgramOnError(e));
} }
listLazyRoutes(route?: string): LazyRoute[] { listLazyRoutes(route?: string): LazyRoute[] {
@ -300,6 +300,10 @@ class AngularCompilerProgram implements Program {
} }
} }
this.emittedSourceFiles = emittedSourceFiles; this.emittedSourceFiles = emittedSourceFiles;
// translate the diagnostics in the emitResult as well.
const translatedEmitDiags = translateDiagnostics(this.hostAdapter, emitResult.diagnostics);
emitResult.diagnostics = translatedEmitDiags.ts.concat(
this.structuralDiagnostics.concat(translatedEmitDiags.ng).map(ngToTsDiagnostic));
if (!outSrcMapping.length) { if (!outSrcMapping.length) {
// if no files were emitted by TypeScript, also don't emit .json files // if no files were emitted by TypeScript, also don't emit .json files
@ -386,7 +390,7 @@ class AngularCompilerProgram implements Program {
customTransformers?: CustomTransformers): ts.CustomTransformers { customTransformers?: CustomTransformers): ts.CustomTransformers {
const beforeTs: ts.TransformerFactory<ts.SourceFile>[] = []; const beforeTs: ts.TransformerFactory<ts.SourceFile>[] = [];
if (!this.options.disableExpressionLowering) { if (!this.options.disableExpressionLowering) {
beforeTs.push(getExpressionLoweringTransformFactory(this.metadataCache)); beforeTs.push(getExpressionLoweringTransformFactory(this.metadataCache, this.tsProgram));
} }
beforeTs.push(getAngularEmitterTransformFactory(genFiles)); beforeTs.push(getAngularEmitterTransformFactory(genFiles));
if (customTransformers && customTransformers.beforeTs) { if (customTransformers && customTransformers.beforeTs) {
@ -400,14 +404,13 @@ class AngularCompilerProgram implements Program {
if (this._analyzedModules) { if (this._analyzedModules) {
return; return;
} }
const {tmpProgram, sourceFiles, rootNames} = this._createProgramWithBasicStubs();
let analyzedModules: NgAnalyzedModules|null;
try { try {
analyzedModules = this.compiler.loadFilesSync(sourceFiles); const {tmpProgram, sourceFiles, rootNames} = this._createProgramWithBasicStubs();
const analyzedModules = this.compiler.loadFilesSync(sourceFiles);
this._updateProgramWithTypeCheckStubs(tmpProgram, analyzedModules, rootNames);
} catch (e) { } catch (e) {
analyzedModules = this.catchAnalysisError(e); this._createProgramOnError(e);
} }
this._updateProgramWithTypeCheckStubs(tmpProgram, analyzedModules, rootNames);
} }
private _createCompiler() { private _createCompiler() {
@ -422,14 +425,15 @@ class AngularCompilerProgram implements Program {
this.oldProgramLibrarySummaries); this.oldProgramLibrarySummaries);
const aotOptions = getAotCompilerOptions(this.options); const aotOptions = getAotCompilerOptions(this.options);
this._structuralDiagnostics = []; this._structuralDiagnostics = [];
const errorCollector = (err: any) => { const errorCollector =
this._structuralDiagnostics !.push({ (this.options.collectAllErrors || this.options.fullTemplateTypeCheck) ? (err: any) => {
messageText: err.toString(), this._structuralDiagnostics !.push({
category: ts.DiagnosticCategory.Error, messageText: err.toString(),
source: SOURCE, category: ts.DiagnosticCategory.Error,
code: DEFAULT_ERROR_CODE source: SOURCE,
}); code: DEFAULT_ERROR_CODE
}; });
} : undefined;
this._compiler = createAotCompiler(this._hostAdapter, aotOptions, errorCollector).compiler; this._compiler = createAotCompiler(this._hostAdapter, aotOptions, errorCollector).compiler;
} }
@ -454,7 +458,7 @@ class AngularCompilerProgram implements Program {
let rootNames = this.rootNames; let rootNames = this.rootNames;
if (this.options.generateCodeForLibraries !== false) { if (this.options.generateCodeForLibraries !== false) {
// if we should generateCodeForLibraries, enver include // if we should generateCodeForLibraries, never include
// generated files in the program as otherwise we will // generated files in the program as otherwise we will
// ovewrite them and typescript will report the error // ovewrite them and typescript will report the error
// TS5055: Cannot write file ... because it would overwrite input file. // TS5055: Cannot write file ... because it would overwrite input file.
@ -479,23 +483,21 @@ class AngularCompilerProgram implements Program {
} }
private _updateProgramWithTypeCheckStubs( private _updateProgramWithTypeCheckStubs(
tmpProgram: ts.Program, analyzedModules: NgAnalyzedModules|null, rootNames: string[]) { tmpProgram: ts.Program, analyzedModules: NgAnalyzedModules, rootNames: string[]) {
this._analyzedModules = analyzedModules || emptyModules; this._analyzedModules = analyzedModules;
if (analyzedModules) { tmpProgram.getSourceFiles().forEach(sf => {
tmpProgram.getSourceFiles().forEach(sf => { if (sf.fileName.endsWith('.ngfactory.ts')) {
if (sf.fileName.endsWith('.ngfactory.ts')) { const {generate, baseFileName} = this.hostAdapter.shouldGenerateFile(sf.fileName);
const {generate, baseFileName} = this.hostAdapter.shouldGenerateFile(sf.fileName); if (generate) {
if (generate) { // Note: ! is ok as hostAdapter.shouldGenerateFile will always return a basefileName
// Note: ! is ok as hostAdapter.shouldGenerateFile will always return a basefileName // for .ngfactory.ts files.
// for .ngfactory.ts files. const genFile = this.compiler.emitTypeCheckStub(sf.fileName, baseFileName !);
const genFile = this.compiler.emitTypeCheckStub(sf.fileName, baseFileName !); if (genFile) {
if (genFile) { this.hostAdapter.updateGeneratedFile(genFile);
this.hostAdapter.updateGeneratedFile(genFile);
}
} }
} }
}); }
} });
this._tsProgram = ts.createProgram(rootNames, this.options, this.hostAdapter, tmpProgram); this._tsProgram = ts.createProgram(rootNames, this.options, this.hostAdapter, tmpProgram);
// Note: the new ts program should be completely reusable by TypeScript as: // Note: the new ts program should be completely reusable by TypeScript as:
// - we cache all the files in the hostAdapter // - we cache all the files in the hostAdapter
@ -506,27 +508,37 @@ class AngularCompilerProgram implements Program {
} }
} }
private catchAnalysisError(e: any): NgAnalyzedModules|null { private _createProgramOnError(e: any) {
// Still fill the analyzedModules and the tsProgram
// so that we don't cause other errors for users who e.g. want to emit the ngProgram.
this._analyzedModules = emptyModules;
this.oldTsProgram = undefined;
this._hostAdapter.isSourceFile = () => false;
this._tsProgram = ts.createProgram(this.rootNames, this.options, this.hostAdapter);
if (isSyntaxError(e)) { if (isSyntaxError(e)) {
const parserErrors = getParseErrors(e); const parserErrors = getParseErrors(e);
if (parserErrors && parserErrors.length) { if (parserErrors && parserErrors.length) {
this._structuralDiagnostics = this._structuralDiagnostics = [
parserErrors.map<Diagnostic>(e => ({ ...(this._structuralDiagnostics || []),
messageText: e.contextualMessage(), ...parserErrors.map<Diagnostic>(e => ({
category: ts.DiagnosticCategory.Error, messageText: e.contextualMessage(),
span: e.span, category: ts.DiagnosticCategory.Error,
source: SOURCE, span: e.span,
code: DEFAULT_ERROR_CODE source: SOURCE,
})); code: DEFAULT_ERROR_CODE
}))
];
} else { } else {
this._structuralDiagnostics = [{ this._structuralDiagnostics = [
messageText: e.message, ...(this._structuralDiagnostics || []), {
category: ts.DiagnosticCategory.Error, messageText: e.message,
source: SOURCE, category: ts.DiagnosticCategory.Error,
code: DEFAULT_ERROR_CODE source: SOURCE,
}]; code: DEFAULT_ERROR_CODE
}
];
} }
return null; return;
} }
throw e; throw e;
} }
@ -702,6 +714,10 @@ function getNgOptionDiagnostics(options: CompilerOptions): Diagnostic[] {
return []; return [];
} }
function normalizeSeparators(path: string): string {
return path.replace(/\\/g, '/');
}
/** /**
* Returns a function that can adjust a path from source path to out path, * Returns a function that can adjust a path from source path to out path,
* based on an existing mapping from source to out path. * based on an existing mapping from source to out path.
@ -723,18 +739,19 @@ export function createSrcToOutPathMapper(
} = path): (srcFileName: string) => string { } = path): (srcFileName: string) => string {
let srcToOutPath: (srcFileName: string) => string; let srcToOutPath: (srcFileName: string) => string;
if (outDir) { if (outDir) {
let path: {} = {}; // Ensure we error if we use `path` instead of `host`.
if (sampleSrcFileName == null || sampleOutFileName == null) { if (sampleSrcFileName == null || sampleOutFileName == null) {
throw new Error(`Can't calculate the rootDir without a sample srcFileName / outFileName. `); throw new Error(`Can't calculate the rootDir without a sample srcFileName / outFileName. `);
} }
const srcFileDir = host.dirname(sampleSrcFileName).replace(/\\/g, '/'); const srcFileDir = normalizeSeparators(host.dirname(sampleSrcFileName));
const outFileDir = host.dirname(sampleOutFileName).replace(/\\/g, '/'); const outFileDir = normalizeSeparators(host.dirname(sampleOutFileName));
if (srcFileDir === outFileDir) { if (srcFileDir === outFileDir) {
return (srcFileName) => srcFileName; return (srcFileName) => srcFileName;
} }
// calculate the common suffix, stopping // calculate the common suffix, stopping
// at `outDir`. // at `outDir`.
const srcDirParts = srcFileDir.split('/'); const srcDirParts = srcFileDir.split('/');
const outDirParts = path.relative(outDir, outFileDir).split('/'); const outDirParts = normalizeSeparators(host.relative(outDir, outFileDir)).split('/');
let i = 0; let i = 0;
while (i < Math.min(srcDirParts.length, outDirParts.length) && while (i < Math.min(srcDirParts.length, outDirParts.length) &&
srcDirParts[srcDirParts.length - 1 - i] === outDirParts[outDirParts.length - 1 - i]) srcDirParts[srcDirParts.length - 1 - i] === outDirParts[outDirParts.length - 1 - i])
@ -750,7 +767,7 @@ export function createSrcToOutPathMapper(
export function i18nExtract( export function i18nExtract(
formatName: string | null, outFile: string | null, host: ts.CompilerHost, formatName: string | null, outFile: string | null, host: ts.CompilerHost,
options: CompilerOptions, bundle: MessageBundle): string[] { options: CompilerOptions, bundle: MessageBundle): string[] {
formatName = formatName || 'null'; formatName = formatName || 'xlf';
// Checks the format and returns the extension // Checks the format and returns the extension
const ext = i18nGetExtension(formatName); const ext = i18nGetExtension(formatName);
const content = i18nSerialize(bundle, formatName, options); const content = i18nSerialize(bundle, formatName, options);
@ -784,7 +801,7 @@ export function i18nSerialize(
} }
export function i18nGetExtension(formatName: string): string { export function i18nGetExtension(formatName: string): string {
const format = (formatName || 'xlf').toLowerCase(); const format = formatName.toLowerCase();
switch (format) { switch (format) {
case 'xmb': case 'xmb':

View File

@ -51,3 +51,29 @@ function pathStartsWithPrefix(prefix: string, fullPath: string): string|null {
const rel = path.relative(prefix, fullPath); const rel = path.relative(prefix, fullPath);
return rel.startsWith('..') ? null : rel; return rel.startsWith('..') ? null : rel;
} }
/**
* Converts a ng.Diagnostic into a ts.Diagnostic.
* This looses some information, and also uses an incomplete object as `file`.
*
* I.e. only use this where the API allows only a ts.Diagnostic.
*/
export function ngToTsDiagnostic(ng: Diagnostic): ts.Diagnostic {
let file: ts.SourceFile|undefined;
let start: number|undefined;
let length: number|undefined;
if (ng.span) {
// Note: We can't use a real ts.SourceFile,
// but we can at least mirror the properties `fileName` and `text`, which
// are mostly used for error reporting.
file = { fileName: ng.span.start.file.url, text: ng.span.start.file.content } as ts.SourceFile;
start = ng.span.start.offset;
length = ng.span.end.offset - start;
}
return {
file,
messageText: ng.messageText,
category: ng.category,
code: ng.code, start, length,
};
}

View File

@ -502,29 +502,69 @@ describe('ngc transformer command-line', () => {
it('should add metadata as decorators', () => { it('should add metadata as decorators', () => {
writeConfig(`{ writeConfig(`{
"extends": "./tsconfig-base.json", "extends": "./tsconfig-base.json",
"compilerOptions": {
"emitDecoratorMetadata": true
},
"angularCompilerOptions": { "angularCompilerOptions": {
"annotationsAs": "decorators" "annotationsAs": "decorators"
}, },
"files": ["mymodule.ts"] "files": ["mymodule.ts"]
}`); }`);
write('aclass.ts', `export class AClass {}`);
write('mymodule.ts', ` write('mymodule.ts', `
import {NgModule, Component} from '@angular/core'; import {NgModule} from '@angular/core';
import {AClass} from './aclass';
@Component({template: ''}) @NgModule({declarations: []})
export class MyComp { export class MyModule {
fn(p: any) {} constructor(importedClass: AClass) {}
} }
`);
@NgModule({declarations: [MyComp]})
export class MyModule {}
`);
const exitCode = main(['-p', basePath], errorSpy); const exitCode = main(['-p', basePath], errorSpy);
expect(exitCode).toEqual(0); expect(exitCode).toEqual(0);
const mymodulejs = path.resolve(outDir, 'mymodule.js'); const mymodulejs = path.resolve(outDir, 'mymodule.js');
const mymoduleSource = fs.readFileSync(mymodulejs, 'utf8'); const mymoduleSource = fs.readFileSync(mymodulejs, 'utf8');
expect(mymoduleSource).toContain('MyComp = __decorate(['); expect(mymoduleSource).toContain('MyModule = __decorate([');
expect(mymoduleSource).toContain(`import { AClass } from './aclass';`);
expect(mymoduleSource).toContain(`__metadata("design:paramtypes", [AClass])`);
});
it('should add metadata as static fields', () => {
// Note: Don't specify emitDecoratorMetadata here on purpose,
// as regression test for https://github.com/angular/angular/issues/19916.
writeConfig(`{
"extends": "./tsconfig-base.json",
"compilerOptions": {
"emitDecoratorMetadata": false
},
"angularCompilerOptions": {
"annotationsAs": "static fields"
},
"files": ["mymodule.ts"]
}`);
write('aclass.ts', `export class AClass {}`);
write('mymodule.ts', `
import {NgModule} from '@angular/core';
import {AClass} from './aclass';
@NgModule({declarations: []})
export class MyModule {
constructor(importedClass: AClass) {}
}
`);
const exitCode = main(['-p', basePath], errorSpy);
expect(exitCode).toEqual(0);
const mymodulejs = path.resolve(outDir, 'mymodule.js');
const mymoduleSource = fs.readFileSync(mymodulejs, 'utf8');
expect(mymoduleSource).not.toContain('__decorate');
expect(mymoduleSource).toContain('args: [{ declarations: [] },] }');
expect(mymoduleSource).not.toContain(`__metadata`);
expect(mymoduleSource).toContain(`import { AClass } from './aclass';`);
expect(mymoduleSource).toContain(`{ type: AClass, }`);
}); });
}); });
@ -1391,5 +1431,73 @@ describe('ngc transformer command-line', () => {
main(['-p', path.join(basePath, 'src/tsconfig.json')], message => messages.push(message)); main(['-p', path.join(basePath, 'src/tsconfig.json')], message => messages.push(message));
expect(exitCode).toBe(0, 'Compile failed unexpectedly.\n ' + messages.join('\n ')); expect(exitCode).toBe(0, 'Compile failed unexpectedly.\n ' + messages.join('\n '));
}); });
it('should emit all structural errors', () => {
write('src/tsconfig.json', `{
"extends": "../tsconfig-base.json",
"files": ["test-module.ts"]
}`);
write('src/lib/indirect2.ts', `
declare var f: any;
export const t2 = f\`<p>hello</p>\`;
`);
write('src/lib/indirect1.ts', `
import {t2} from './indirect2';
export const t1 = t2 + ' ';
`);
write('src/lib/test.component.ts', `
import {Component} from '@angular/core';
import {t1} from './indirect1';
@Component({
template: t1
})
export class TestComponent {}
`);
write('src/test-module.ts', `
import {NgModule} from '@angular/core';
import {TestComponent} from './lib/test.component';
@NgModule({declarations: [TestComponent]})
export class TestModule {}
`);
const messages: string[] = [];
const exitCode =
main(['-p', path.join(basePath, 'src/tsconfig.json')], message => messages.push(message));
expect(exitCode).toBe(1, 'Compile was expected to fail');
expect(messages[0]).toContain(['Tagged template expressions are not supported in metadata']);
});
it('should allow using 2 classes with the same name in declarations with noEmitOnError=true',
() => {
write('src/tsconfig.json', `{
"extends": "../tsconfig-base.json",
"compilerOptions": {
"noEmitOnError": true
},
"files": ["test-module.ts"]
}`);
function writeComp(fileName: string) {
write(fileName, `
import {Component} from '@angular/core';
@Component({selector: 'comp', template: ''})
export class TestComponent {}
`);
}
writeComp('src/comp1.ts');
writeComp('src/comp2.ts');
write('src/test-module.ts', `
import {NgModule} from '@angular/core';
import {TestComponent as Comp1} from './comp1';
import {TestComponent as Comp2} from './comp2';
@NgModule({
declarations: [Comp1, Comp2],
})
export class MyModule {}
`);
expect(main(['-p', path.join(basePath, 'src/tsconfig.json')])).toBe(0);
});
}); });
}); });

View File

@ -105,6 +105,47 @@ describe('perform watch', () => {
expect(getSourceFileSpy !).toHaveBeenCalledWith(mainTsPath, ts.ScriptTarget.ES5); expect(getSourceFileSpy !).toHaveBeenCalledWith(mainTsPath, ts.ScriptTarget.ES5);
expect(getSourceFileSpy !).toHaveBeenCalledWith(utilTsPath, ts.ScriptTarget.ES5); expect(getSourceFileSpy !).toHaveBeenCalledWith(utilTsPath, ts.ScriptTarget.ES5);
}); });
it('should recover from static analysis errors', () => {
const config = createConfig();
const host = new MockWatchHost(config);
const okFileContent = `
import {NgModule} from '@angular/core';
@NgModule()
export class MyModule {}
`;
const errorFileContent = `
import {NgModule} from '@angular/core';
@NgModule(() => (1===1 ? null as any : null as any))
export class MyModule {}
`;
const indexTsPath = path.resolve(testSupport.basePath, 'src', 'index.ts');
testSupport.write(indexTsPath, okFileContent);
performWatchCompilation(host);
expectNoDiagnostics(config.options, host.diagnostics);
// Do it multiple times as the watch mode switches internal modes.
// E.g. from regular compile to using summaries, ...
for (let i = 0; i < 3; i++) {
host.diagnostics = [];
testSupport.write(indexTsPath, okFileContent);
host.triggerFileChange(FileChangeEvent.Change, indexTsPath);
expectNoDiagnostics(config.options, host.diagnostics);
host.diagnostics = [];
testSupport.write(indexTsPath, errorFileContent);
host.triggerFileChange(FileChangeEvent.Change, indexTsPath);
const errDiags = host.diagnostics.filter(d => d.category === ts.DiagnosticCategory.Error);
expect(errDiags.length).toBe(1);
expect(errDiags[0].messageText).toContain('Function calls are not supported.');
}
});
}); });
function createModuleAndCompSource(prefix: string, template: string = prefix + 'template') { function createModuleAndCompSource(prefix: string, template: string = prefix + 'template') {
@ -122,7 +163,8 @@ function createModuleAndCompSource(prefix: string, template: string = prefix + '
} }
class MockWatchHost { class MockWatchHost {
timeoutListeners: Array<(() => void)|null> = []; nextTimeoutListenerId = 1;
timeoutListeners: {[id: string]: (() => void)} = {};
fileChangeListeners: Array<((event: FileChangeEvent, fileName: string) => void)|null> = []; fileChangeListeners: Array<((event: FileChangeEvent, fileName: string) => void)|null> = [];
diagnostics: ng.Diagnostics = []; diagnostics: ng.Diagnostics = [];
constructor(public config: ng.ParsedConfiguration) {} constructor(public config: ng.ParsedConfiguration) {}
@ -141,16 +183,16 @@ class MockWatchHost {
close: () => this.fileChangeListeners[id] = null, close: () => this.fileChangeListeners[id] = null,
}; };
} }
setTimeout(callback: () => void, ms: number): any { setTimeout(callback: () => void): any {
const id = this.timeoutListeners.length; const id = this.nextTimeoutListenerId++;
this.timeoutListeners.push(callback); this.timeoutListeners[id] = callback;
return id; return id;
} }
clearTimeout(timeoutId: any): void { this.timeoutListeners[timeoutId] = null; } clearTimeout(timeoutId: any): void { delete this.timeoutListeners[timeoutId]; }
flushTimeouts() { flushTimeouts() {
this.timeoutListeners.forEach(cb => { const listeners = this.timeoutListeners;
if (cb) cb(); this.timeoutListeners = {};
}); Object.keys(listeners).forEach(id => listeners[id]());
} }
triggerFileChange(event: FileChangeEvent, fileName: string) { triggerFileChange(event: FileChangeEvent, fileName: string) {
this.fileChangeListeners.forEach(listener => { this.fileChangeListeners.forEach(listener => {

View File

@ -64,10 +64,10 @@ export function setup(): TestSupport {
function write(fileName: string, content: string) { function write(fileName: string, content: string) {
const dir = path.dirname(fileName); const dir = path.dirname(fileName);
if (dir != '.') { if (dir != '.') {
const newDir = path.join(basePath, dir); const newDir = path.resolve(basePath, dir);
if (!fs.existsSync(newDir)) fs.mkdirSync(newDir); if (!fs.existsSync(newDir)) fs.mkdirSync(newDir);
} }
fs.writeFileSync(path.join(basePath, fileName), content, {encoding: 'utf-8'}); fs.writeFileSync(path.resolve(basePath, fileName), content, {encoding: 'utf-8'});
} }
function writeFiles(...mockDirs: {[fileName: string]: string}[]) { function writeFiles(...mockDirs: {[fileName: string]: string}[]) {

View File

@ -181,13 +181,15 @@ function convert(annotatedSource: string) {
[fileName], {module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2017}, host); [fileName], {module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2017}, host);
const moduleSourceFile = program.getSourceFile(fileName); const moduleSourceFile = program.getSourceFile(fileName);
const transformers: ts.CustomTransformers = { const transformers: ts.CustomTransformers = {
before: [getExpressionLoweringTransformFactory({ before: [getExpressionLoweringTransformFactory(
getRequests(sourceFile: ts.SourceFile): RequestLocationMap{ {
if (sourceFile.fileName == moduleSourceFile.fileName) { getRequests(sourceFile: ts.SourceFile): RequestLocationMap{
return requests; if (sourceFile.fileName == moduleSourceFile.fileName) {
} else {return new Map();} return requests;
} } else {return new Map();}
})] }
},
program)]
}; };
let result: string = ''; let result: string = '';
const emitResult = program.emit( const emitResult = program.emit(

View File

@ -11,7 +11,8 @@ import * as fs from 'fs';
import * as path from 'path'; import * as path from 'path';
import * as ts from 'typescript'; import * as ts from 'typescript';
import {CompilerHost, LazyRoute} from '../../src/transformers/api'; import {formatDiagnostics} from '../../src/perform_compile';
import {CompilerHost, EmitFlags, LazyRoute} from '../../src/transformers/api';
import {createSrcToOutPathMapper} from '../../src/transformers/program'; import {createSrcToOutPathMapper} from '../../src/transformers/program';
import {GENERATED_FILES, StructureIsReused, tsStructureIsReused} from '../../src/transformers/util'; import {GENERATED_FILES, StructureIsReused, tsStructureIsReused} from '../../src/transformers/util';
import {TestSupport, expectNoDiagnosticsInProgram, setup} from '../test_support'; import {TestSupport, expectNoDiagnosticsInProgram, setup} from '../test_support';
@ -309,11 +310,35 @@ describe('ng program', () => {
}); });
}); });
it('should typecheck templates even if skipTemplateCodegen is set', () => { it('should not typecheck templates if skipTemplateCodegen is set but fullTemplateTypeCheck is not',
() => {
testSupport.writeFiles({
'src/main.ts': `
import {NgModule} from '@angular/core';
@NgModule(() => {if (1==1) return null as any;})
export class SomeClassWithInvalidMetadata {}
`,
});
const options = testSupport.createCompilerOptions({skipTemplateCodegen: true});
const host = ng.createCompilerHost({options});
const program = ng.createProgram(
{rootNames: [path.resolve(testSupport.basePath, 'src/main.ts')], options, host});
expectNoDiagnosticsInProgram(options, program);
const emitResult = program.emit({emitFlags: EmitFlags.All});
expect(emitResult.diagnostics.length).toBe(0);
testSupport.shouldExist('built/src/main.metadata.json');
});
it('should typecheck templates if skipTemplateCodegen and fullTemplateTypeCheck is set', () => {
testSupport.writeFiles({ testSupport.writeFiles({
'src/main.ts': createModuleAndCompSource('main', `{{nonExistent}}`), 'src/main.ts': createModuleAndCompSource('main', `{{nonExistent}}`),
}); });
const options = testSupport.createCompilerOptions({skipTemplateCodegen: true}); const options = testSupport.createCompilerOptions({
skipTemplateCodegen: true,
fullTemplateTypeCheck: true,
});
const host = ng.createCompilerHost({options}); const host = ng.createCompilerHost({options});
const program = ng.createProgram( const program = ng.createProgram(
{rootNames: [path.resolve(testSupport.basePath, 'src/main.ts')], options, host}); {rootNames: [path.resolve(testSupport.basePath, 'src/main.ts')], options, host});
@ -554,8 +579,8 @@ describe('ng program', () => {
}); });
} }
function createProgram(rootNames: string[]) { function createProgram(rootNames: string[], overrideOptions: ng.CompilerOptions = {}) {
const options = testSupport.createCompilerOptions(); const options = testSupport.createCompilerOptions(overrideOptions);
const host = ng.createCompilerHost({options}); const host = ng.createCompilerHost({options});
const program = ng.createProgram( const program = ng.createProgram(
{rootNames: rootNames.map(p => path.resolve(testSupport.basePath, p)), options, host}); {rootNames: rootNames.map(p => path.resolve(testSupport.basePath, p)), options, host});
@ -593,6 +618,34 @@ describe('ng program', () => {
]); ]);
}); });
it('should emit correctly after listing lazyRoutes', () => {
testSupport.writeFiles({
'src/main.ts': `
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
@NgModule({
imports: [RouterModule.forRoot([{loadChildren: './lazy/lazy#LazyModule'}])]
})
export class MainModule {}
`,
'src/lazy/lazy.ts': `
import {NgModule} from '@angular/core';
@NgModule()
export class ChildModule {}
`,
});
const {program, options} = createProgram(['src/main.ts', 'src/lazy/lazy.ts']);
expectNoDiagnosticsInProgram(options, program);
program.listLazyRoutes();
program.emit();
const lazyNgFactory =
fs.readFileSync(path.resolve(testSupport.basePath, 'built/src/lazy/lazy.ngfactory.js'));
expect(lazyNgFactory).toContain('import * as i1 from "./lazy";');
});
it('should list lazyRoutes given an entryRoute recursively', () => { it('should list lazyRoutes given an entryRoute recursively', () => {
writeSomeRoutes(); writeSomeRoutes();
const {program, options} = createProgram(['src/main.ts']); const {program, options} = createProgram(['src/main.ts']);
@ -797,7 +850,7 @@ describe('ng program', () => {
export class ChildModule {} export class ChildModule {}
`, `,
}); });
const program = createProgram(['src/main.ts']).program; const program = createProgram(['src/main.ts'], {collectAllErrors: true}).program;
expect(normalizeRoutes(program.listLazyRoutes('src/main#MainModule'))).toEqual([{ expect(normalizeRoutes(program.listLazyRoutes('src/main#MainModule'))).toEqual([{
module: {name: 'MainModule', filePath: path.resolve(testSupport.basePath, 'src/main.ts')}, module: {name: 'MainModule', filePath: path.resolve(testSupport.basePath, 'src/main.ts')},
referencedModule: referencedModule:
@ -806,4 +859,96 @@ describe('ng program', () => {
}]); }]);
}); });
}); });
it('should report errors for ts and ng errors on emit with noEmitOnError=true', () => {
testSupport.writeFiles({
'src/main.ts': `
import {Component, NgModule} from '@angular/core';
// Ts error
let x: string = 1;
// Ng error
@Component({selector: 'comp', templateUrl: './main.html'})
export class MyComp {}
@NgModule({declarations: [MyComp]})
export class MyModule {}
`,
'src/main.html': '{{nonExistent}}'
});
const options = testSupport.createCompilerOptions({noEmitOnError: true});
const host = ng.createCompilerHost({options});
const program1 = ng.createProgram(
{rootNames: [path.resolve(testSupport.basePath, 'src/main.ts')], options, host});
const errorDiags =
program1.emit().diagnostics.filter(d => d.category === ts.DiagnosticCategory.Error);
expect(formatDiagnostics(errorDiags))
.toContain(`src/main.ts(5,13): error TS2322: Type '1' is not assignable to type 'string'.`);
expect(formatDiagnostics(errorDiags))
.toContain(
`src/main.html(1,1): error TS100: Property 'nonExistent' does not exist on type 'MyComp'.`);
});
describe('errors', () => {
const fileWithStructuralError = `
import {NgModule} from '@angular/core';
@NgModule(() => (1===1 ? null as any : null as any))
export class MyModule {}
`;
const fileWithGoodContent = `
import {NgModule} from '@angular/core';
@NgModule()
export class MyModule {}
`;
it('should not throw on structural errors but collect them', () => {
testSupport.write('src/index.ts', fileWithStructuralError);
const options = testSupport.createCompilerOptions();
const host = ng.createCompilerHost({options});
const program = ng.createProgram(
{rootNames: [path.resolve(testSupport.basePath, 'src/index.ts')], options, host});
const structuralErrors = program.getNgStructuralDiagnostics();
expect(structuralErrors.length).toBe(1);
expect(structuralErrors[0].messageText).toContain('Function calls are not supported.');
});
it('should not throw on structural errors but collect them (loadNgStructureAsync)', (done) => {
testSupport.write('src/index.ts', fileWithStructuralError);
const options = testSupport.createCompilerOptions();
const host = ng.createCompilerHost({options});
const program = ng.createProgram(
{rootNames: [path.resolve(testSupport.basePath, 'src/index.ts')], options, host});
program.loadNgStructureAsync().then(() => {
const structuralErrors = program.getNgStructuralDiagnostics();
expect(structuralErrors.length).toBe(1);
expect(structuralErrors[0].messageText).toContain('Function calls are not supported.');
done();
});
});
it('should be able to use a program with structural errors as oldProgram', () => {
testSupport.write('src/index.ts', fileWithStructuralError);
const options = testSupport.createCompilerOptions();
const host = ng.createCompilerHost({options});
const program1 = ng.createProgram(
{rootNames: [path.resolve(testSupport.basePath, 'src/index.ts')], options, host});
expect(program1.getNgStructuralDiagnostics().length).toBe(1);
testSupport.write('src/index.ts', fileWithGoodContent);
const program2 = ng.createProgram({
rootNames: [path.resolve(testSupport.basePath, 'src/index.ts')],
options,
host,
oldProgram: program1
});
expectNoDiagnosticsInProgram(options, program2);
});
});
}); });

View File

@ -193,6 +193,7 @@ export class AotCompiler {
private _createNgFactoryStub( private _createNgFactoryStub(
outputCtx: OutputContext, file: NgAnalyzedFile, emitFlags: StubEmitFlags) { outputCtx: OutputContext, file: NgAnalyzedFile, emitFlags: StubEmitFlags) {
let componentId = 0;
file.ngModules.forEach((ngModuleMeta, ngModuleIndex) => { file.ngModules.forEach((ngModuleMeta, ngModuleIndex) => {
// Note: the code below needs to executed for StubEmitFlags.Basic and StubEmitFlags.TypeCheck, // Note: the code below needs to executed for StubEmitFlags.Basic and StubEmitFlags.TypeCheck,
// so we don't change the .ngfactory file too much when adding the typecheck block. // so we don't change the .ngfactory file too much when adding the typecheck block.
@ -230,12 +231,14 @@ export class AotCompiler {
if (!compMeta.isComponent) { if (!compMeta.isComponent) {
return; return;
} }
componentId++;
this._createTypeCheckBlock( this._createTypeCheckBlock(
outputCtx, ngModuleMeta, this._metadataResolver.getHostComponentMetadata(compMeta), outputCtx, `${compMeta.type.reference.name}_Host_${componentId}`, ngModuleMeta,
[compMeta.type], externalReferenceVars); this._metadataResolver.getHostComponentMetadata(compMeta), [compMeta.type],
this._createTypeCheckBlock(
outputCtx, ngModuleMeta, compMeta, ngModuleMeta.transitiveModule.directives,
externalReferenceVars); externalReferenceVars);
this._createTypeCheckBlock(
outputCtx, `${compMeta.type.reference.name}_${componentId}`, ngModuleMeta, compMeta,
ngModuleMeta.transitiveModule.directives, externalReferenceVars);
}); });
} }
}); });
@ -246,12 +249,13 @@ export class AotCompiler {
} }
private _createTypeCheckBlock( private _createTypeCheckBlock(
ctx: OutputContext, moduleMeta: CompileNgModuleMetadata, compMeta: CompileDirectiveMetadata, ctx: OutputContext, componentId: string, moduleMeta: CompileNgModuleMetadata,
directives: CompileIdentifierMetadata[], externalReferenceVars: Map<any, string>) { compMeta: CompileDirectiveMetadata, directives: CompileIdentifierMetadata[],
externalReferenceVars: Map<any, string>) {
const {template: parsedTemplate, pipes: usedPipes} = const {template: parsedTemplate, pipes: usedPipes} =
this._parseTemplate(compMeta, moduleMeta, directives); this._parseTemplate(compMeta, moduleMeta, directives);
ctx.statements.push(...this._typeCheckCompiler.compileComponent( ctx.statements.push(...this._typeCheckCompiler.compileComponent(
compMeta, parsedTemplate, usedPipes, externalReferenceVars)); componentId, compMeta, parsedTemplate, usedPipes, externalReferenceVars));
} }
emitMessageBundle(analyzeResult: NgAnalyzedModules, locale: string|null): MessageBundle { emitMessageBundle(analyzeResult: NgAnalyzedModules, locale: string|null): MessageBundle {

View File

@ -54,7 +54,7 @@ export function createAotUrlResolver(host: {
*/ */
export function createAotCompiler( export function createAotCompiler(
compilerHost: AotCompilerHost, options: AotCompilerOptions, compilerHost: AotCompilerHost, options: AotCompilerOptions,
errorCollector: (error: any, type?: any) => errorCollector?: (error: any, type?: any) =>
void): {compiler: AotCompiler, reflector: StaticReflector} { void): {compiler: AotCompiler, reflector: StaticReflector} {
let translations: string = options.translations || ''; let translations: string = options.translations || '';

View File

@ -80,8 +80,10 @@ export class StaticReflector implements CompileReflector {
const refSymbol = const refSymbol =
this.symbolResolver.getSymbolByModule(ref.moduleName !, ref.name !, containingFile); this.symbolResolver.getSymbolByModule(ref.moduleName !, ref.name !, containingFile);
const declarationSymbol = this.findSymbolDeclaration(refSymbol); const declarationSymbol = this.findSymbolDeclaration(refSymbol);
this.symbolResolver.recordModuleNameForFileName(refSymbol.filePath, ref.moduleName !); if (!containingFile) {
this.symbolResolver.recordImportAs(declarationSymbol, refSymbol); this.symbolResolver.recordModuleNameForFileName(refSymbol.filePath, ref.moduleName !);
this.symbolResolver.recordImportAs(declarationSymbol, refSymbol);
}
return declarationSymbol; return declarationSymbol;
} }
@ -750,7 +752,7 @@ class PopulatedScope extends BindingScope {
} }
function positionalError(message: string, fileName: string, line: number, column: number): Error { function positionalError(message: string, fileName: string, line: number, column: number): Error {
const result = new Error(message); const result = syntaxError(message);
(result as any).fileName = fileName; (result as any).fileName = fileName;
(result as any).line = line; (result as any).line = line;
(result as any).column = column; (result as any).column = column;

View File

@ -9,7 +9,7 @@
import {AotCompilerOptions} from '../aot/compiler_options'; import {AotCompilerOptions} from '../aot/compiler_options';
import {StaticReflector} from '../aot/static_reflector'; import {StaticReflector} from '../aot/static_reflector';
import {StaticSymbol} from '../aot/static_symbol'; import {StaticSymbol} from '../aot/static_symbol';
import {CompileDiDependencyMetadata, CompileDirectiveMetadata, CompilePipeSummary, viewClassName} from '../compile_metadata'; import {CompileDiDependencyMetadata, CompileDirectiveMetadata, CompilePipeSummary} from '../compile_metadata';
import {BuiltinConverter, EventHandlerVars, LocalResolver, convertActionBinding, convertPropertyBinding, convertPropertyBindingBuiltins} from '../compiler_util/expression_converter'; import {BuiltinConverter, EventHandlerVars, LocalResolver, convertActionBinding, convertPropertyBinding, convertPropertyBindingBuiltins} from '../compiler_util/expression_converter';
import {AST, ASTWithSource, Interpolation} from '../expression_parser/ast'; import {AST, ASTWithSource, Interpolation} from '../expression_parser/ast';
import {Identifiers} from '../identifiers'; import {Identifiers} from '../identifiers';
@ -33,7 +33,8 @@ export class TypeCheckCompiler {
* and also violate the point above. * and also violate the point above.
*/ */
compileComponent( compileComponent(
component: CompileDirectiveMetadata, template: TemplateAst[], usedPipes: CompilePipeSummary[], componentId: string, component: CompileDirectiveMetadata, template: TemplateAst[],
usedPipes: CompilePipeSummary[],
externalReferenceVars: Map<StaticSymbol, string>): o.Statement[] { externalReferenceVars: Map<StaticSymbol, string>): o.Statement[] {
const pipes = new Map<string, StaticSymbol>(); const pipes = new Map<string, StaticSymbol>();
usedPipes.forEach(p => pipes.set(p.name, p.type.reference)); usedPipes.forEach(p => pipes.set(p.name, p.type.reference));
@ -48,7 +49,7 @@ export class TypeCheckCompiler {
const visitor = viewBuilderFactory(null); const visitor = viewBuilderFactory(null);
visitor.visitAll([], template); visitor.visitAll([], template);
return visitor.build(); return visitor.build(componentId);
} }
} }
@ -103,8 +104,8 @@ class ViewBuilder implements TemplateAstVisitor, LocalResolver {
templateVisitAll(this, astNodes); templateVisitAll(this, astNodes);
} }
build(targetStatements: o.Statement[] = []): o.Statement[] { build(componentId: string, targetStatements: o.Statement[] = []): o.Statement[] {
this.children.forEach((child) => child.build(targetStatements)); this.children.forEach((child) => child.build(componentId, targetStatements));
const viewStmts: o.Statement[] = const viewStmts: o.Statement[] =
[o.variable(DYNAMIC_VAR_NAME).set(o.NULL_EXPR).toDeclStmt(o.DYNAMIC_TYPE)]; [o.variable(DYNAMIC_VAR_NAME).set(o.NULL_EXPR).toDeclStmt(o.DYNAMIC_TYPE)];
let bindingCount = 0; let bindingCount = 0;
@ -128,7 +129,7 @@ class ViewBuilder implements TemplateAstVisitor, LocalResolver {
(stmt: o.Statement) => o.applySourceSpanToStatementIfNeeded(stmt, sourceSpan))); (stmt: o.Statement) => o.applySourceSpanToStatementIfNeeded(stmt, sourceSpan)));
}); });
const viewName = `_View_${this.component.name}_${this.embeddedViewIndex}`; const viewName = `_View_${componentId}_${this.embeddedViewIndex}`;
const viewFactory = new o.DeclareFunctionStmt(viewName, [], viewStmts); const viewFactory = new o.DeclareFunctionStmt(viewName, [], viewStmts);
targetStatements.push(viewFactory); targetStatements.push(viewFactory);
return targetStatements; return targetStatements;

View File

@ -1062,6 +1062,22 @@ describe('StaticReflector', () => {
.useValue) .useValue)
.toEqual({path: 'foo', data: {e: 1}}); .toEqual({path: 'foo', data: {e: 1}});
}); });
describe('resolveExternalReference', () => {
it('should register modules names in the StaticSymbolResolver if no containingFile is given',
() => {
init({
'/tmp/root.ts': ``,
'/tmp/a.ts': `export const x = 1;`,
});
let symbol =
reflector.resolveExternalReference({moduleName: './a', name: 'x'}, '/tmp/root.ts');
expect(symbolResolver.getKnownModuleName(symbol.filePath)).toBeFalsy();
symbol = reflector.resolveExternalReference({moduleName: 'a', name: 'x'});
expect(symbolResolver.getKnownModuleName(symbol.filePath)).toBe('a');
});
});
}); });
const DEFAULT_TEST_DATA: {[key: string]: any} = { const DEFAULT_TEST_DATA: {[key: string]: any} = {

View File

@ -10,10 +10,13 @@ import resolve from 'rollup-plugin-node-resolve';
import sourcemaps from 'rollup-plugin-sourcemaps'; import sourcemaps from 'rollup-plugin-sourcemaps';
const globals = { const globals = {
'@angular/animations': 'ng.animations',
'@angular/core': 'ng.core', '@angular/core': 'ng.core',
'@angular/common': 'ng.common', '@angular/common': 'ng.common',
'@angular/compiler': 'ng.compiler', '@angular/compiler': 'ng.compiler',
'@angular/http': 'ng.http',
'@angular/platform-browser': 'ng.platformBrowser', '@angular/platform-browser': 'ng.platformBrowser',
'@angular/platform-browser-dynamic': 'ng.platformBrowserDynamic',
'rxjs/Observable': 'Rx', 'rxjs/Observable': 'Rx',
'rxjs/Subject': 'Rx', 'rxjs/Subject': 'Rx',
'rxjs/operator/toPromise': 'Rx.Observable.prototype', 'rxjs/operator/toPromise': 'Rx.Observable.prototype',

View File

@ -106,8 +106,7 @@ export class NgswCommChannel {
this.registration = <Observable<ServiceWorkerRegistration>>( this.registration = <Observable<ServiceWorkerRegistration>>(
op_switchMap.call(this.worker, () => serviceWorker.getRegistration())); op_switchMap.call(this.worker, () => serviceWorker.getRegistration()));
const rawEvents = <Observable<MessageEvent>>(op_switchMap.call( const rawEvents = obs_fromEvent(serviceWorker, 'message');
this.registration, (reg: ServiceWorkerRegistration) => obs_fromEvent(reg, 'message')));
const rawEventPayload = const rawEventPayload =
<Observable<Object>>(op_map.call(rawEvents, (event: MessageEvent) => event.data)); <Observable<Object>>(op_map.call(rawEvents, (event: MessageEvent) => event.data));

View File

@ -30,8 +30,10 @@ export function ngswAppInitializer(
op_filter.call(app.isStable, (stable: boolean) => !!stable) as Observable<boolean>; op_filter.call(app.isStable, (stable: boolean) => !!stable) as Observable<boolean>;
const isStable = op_take.call(onStable, 1) as Observable<boolean>; const isStable = op_take.call(onStable, 1) as Observable<boolean>;
const whenStable = op_toPromise.call(isStable) as Promise<boolean>; const whenStable = op_toPromise.call(isStable) as Promise<boolean>;
return whenStable.then(() => navigator.serviceWorker.register(script, options))
.then(() => undefined) as Promise<void>; // Don't return the Promise, as that will block the application until the SW is registered, and
// cause a crash if the SW registration fails.
whenStable.then(() => navigator.serviceWorker.register(script, options));
}; };
return initializer; return initializer;
} }

View File

@ -43,7 +43,7 @@ export class SwPush {
const workerDrivenSubscriptions = <Observable<PushSubscription|null>>(op_switchMap.call( const workerDrivenSubscriptions = <Observable<PushSubscription|null>>(op_switchMap.call(
this.pushManager, (pm: PushManager) => pm.getSubscription().then(sub => { return sub; }))); this.pushManager, (pm: PushManager) => pm.getSubscription().then(sub => { return sub; })));
this.subscription = obs_merge.call(workerDrivenSubscriptions, this.subscriptionChanges); this.subscription = obs_merge(workerDrivenSubscriptions, this.subscriptionChanges);
} }
requestSubscription(options: {serverPublicKey: string}): Promise<PushSubscription> { requestSubscription(options: {serverPublicKey: string}): Promise<PushSubscription> {

View File

@ -44,11 +44,9 @@ export function main() {
}); });
describe('SwPush', () => { describe('SwPush', () => {
let push: SwPush; let push: SwPush;
let reg: MockServiceWorkerRegistration; beforeEach(() => {
beforeEach((done: DoneFn) => {
push = new SwPush(comm); push = new SwPush(comm);
mock.setupSw(); mock.setupSw();
mock.mockRegistration.then(r => reg = r).then(() => done());
}); });
it('receives push messages', (done: DoneFn) => { it('receives push messages', (done: DoneFn) => {
push.messages.subscribe(msg => { push.messages.subscribe(msg => {
@ -57,7 +55,7 @@ export function main() {
}); });
done(); done();
}); });
reg.sendMessage({ mock.sendMessage({
type: 'PUSH', type: 'PUSH',
data: { data: {
message: 'this was a push message', message: 'this was a push message',
@ -76,11 +74,9 @@ export function main() {
}); });
describe('SwUpdate', () => { describe('SwUpdate', () => {
let update: SwUpdate; let update: SwUpdate;
let reg: MockServiceWorkerRegistration; beforeEach(() => {
beforeEach((done: DoneFn) => {
update = new SwUpdate(comm); update = new SwUpdate(comm);
mock.setupSw(); mock.setupSw();
mock.mockRegistration.then(r => reg = r).then(() => done());
}); });
it('processes update availability notifications when sent', (done: DoneFn) => { it('processes update availability notifications when sent', (done: DoneFn) => {
update.available.subscribe(event => { update.available.subscribe(event => {
@ -89,7 +85,7 @@ export function main() {
expect(event.type).toEqual('UPDATE_AVAILABLE'); expect(event.type).toEqual('UPDATE_AVAILABLE');
done(); done();
}); });
reg.sendMessage({ mock.sendMessage({
type: 'UPDATE_AVAILABLE', type: 'UPDATE_AVAILABLE',
current: { current: {
version: 'A', version: 'A',
@ -106,7 +102,7 @@ export function main() {
expect(event.type).toEqual('UPDATE_ACTIVATED'); expect(event.type).toEqual('UPDATE_ACTIVATED');
done(); done();
}); });
reg.sendMessage({ mock.sendMessage({
type: 'UPDATE_ACTIVATED', type: 'UPDATE_ACTIVATED',
previous: { previous: {
version: 'A', version: 'A',
@ -119,7 +115,7 @@ export function main() {
it('activates updates when requested', (done: DoneFn) => { it('activates updates when requested', (done: DoneFn) => {
mock.messages.subscribe((msg: {action: string, statusNonce: number}) => { mock.messages.subscribe((msg: {action: string, statusNonce: number}) => {
expect(msg.action).toEqual('ACTIVATE_UPDATE'); expect(msg.action).toEqual('ACTIVATE_UPDATE');
reg.sendMessage({ mock.sendMessage({
type: 'STATUS', type: 'STATUS',
nonce: msg.statusNonce, nonce: msg.statusNonce,
status: true, status: true,
@ -130,7 +126,7 @@ export function main() {
it('reports activation failure when requested', (done: DoneFn) => { it('reports activation failure when requested', (done: DoneFn) => {
mock.messages.subscribe((msg: {action: string, statusNonce: number}) => { mock.messages.subscribe((msg: {action: string, statusNonce: number}) => {
expect(msg.action).toEqual('ACTIVATE_UPDATE'); expect(msg.action).toEqual('ACTIVATE_UPDATE');
reg.sendMessage({ mock.sendMessage({
type: 'STATUS', type: 'STATUS',
nonce: msg.statusNonce, nonce: msg.statusNonce,
status: false, status: false,

View File

@ -85,7 +85,7 @@ export function main() {
driver = new Driver(scope, scope, new CacheDatabase(scope, scope)); driver = new Driver(scope, scope, new CacheDatabase(scope, scope));
scope.clients.add('default'); scope.clients.add('default');
scope.clients.getMock('default') !.queue.subscribe(msg => { reg.sendMessage(msg); }); scope.clients.getMock('default') !.queue.subscribe(msg => { mock.sendMessage(msg); });
mock.messages.subscribe(msg => { scope.handleMessage(msg, 'default'); }); mock.messages.subscribe(msg => { scope.handleMessage(msg, 'default'); });

View File

@ -10,17 +10,26 @@ import {Subject} from 'rxjs/Subject';
export class MockServiceWorkerContainer { export class MockServiceWorkerContainer {
private onControllerChange: Function[] = []; private onControllerChange: Function[] = [];
private onMessage: Function[] = [];
private registration: MockServiceWorkerRegistration|null = null; private registration: MockServiceWorkerRegistration|null = null;
controller: MockServiceWorker|null = null; controller: MockServiceWorker|null = null;
messages = new Subject(); messages = new Subject();
addEventListener(event: 'controllerchange', handler: Function) { addEventListener(event: 'controllerchange'|'message', handler: Function) {
this.onControllerChange.push(handler); if (event === 'controllerchange') {
this.onControllerChange.push(handler);
} else if (event === 'message') {
this.onMessage.push(handler);
}
} }
removeEventListener(event: 'controllerchange', handler: Function) { removeEventListener(event: 'controllerchange', handler: Function) {
this.onControllerChange = this.onControllerChange.filter(h => h !== handler); if (event === 'controllerchange') {
this.onControllerChange = this.onControllerChange.filter(h => h !== handler);
} else if (event === 'message') {
this.onMessage = this.onMessage.filter(h => h !== handler);
}
} }
async register(url: string): Promise<void> { return; } async register(url: string): Promise<void> { return; }
@ -36,6 +45,12 @@ export class MockServiceWorkerContainer {
get mockRegistration(): Promise<MockServiceWorkerRegistration> { get mockRegistration(): Promise<MockServiceWorkerRegistration> {
return Promise.resolve(this.registration !); return Promise.resolve(this.registration !);
} }
sendMessage(value: Object): void {
this.onMessage.forEach(onMessage => onMessage({
data: value,
}));
}
} }
export class MockServiceWorker { export class MockServiceWorker {
@ -44,21 +59,4 @@ export class MockServiceWorker {
postMessage(value: Object) { this.mock.messages.next(value); } postMessage(value: Object) { this.mock.messages.next(value); }
} }
export class MockServiceWorkerRegistration { export class MockServiceWorkerRegistration {}
private onMessage: Function[] = [];
messages: Object[] = [];
constructor() {}
addEventListener(event: 'message', handler: Function) { this.onMessage.push(handler); }
removeEventListener(event: 'message', handler: Function) {
this.onMessage = this.onMessage.filter(h => h !== handler);
}
sendMessage(value: Object): void {
this.onMessage.forEach(onMessage => onMessage({
data: value,
}));
}
}

View File

@ -6194,9 +6194,9 @@ rx-lite@^3.1.2:
version "3.1.2" version "3.1.2"
resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102" resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102"
rxjs@^5.5.0: rxjs@^5.5.2:
version "5.5.0" version "5.5.2"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.0.tgz#26d8f3866eb700e247e0728a147c3d628993d812" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.2.tgz#28d403f0071121967f18ad665563255d54236ac3"
dependencies: dependencies:
symbol-observable "^1.0.1" symbol-observable "^1.0.1"