From 0d55600fd8b217f8b6005fad52161b897ca6b05f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=A1ko=20Hevery?= Date: Fri, 19 Jan 2018 13:06:33 -0800 Subject: [PATCH 01/47] Revert "fix(core): fix chained http call (#20924)" This reverts commit 54e75766adb22e15cd9831991e8537d2ca71eaef. --- packages/core/src/testability/testability.ts | 21 ++----- .../core/test/testability/testability_spec.ts | 60 ++++++++++--------- 2 files changed, 37 insertions(+), 44 deletions(-) diff --git a/packages/core/src/testability/testability.ts b/packages/core/src/testability/testability.ts index f007707880e22..f39e0bb823371 100644 --- a/packages/core/src/testability/testability.ts +++ b/packages/core/src/testability/testability.ts @@ -98,22 +98,13 @@ export class Testability implements PublicTestability { /** @internal */ _runCallbacksIfReady(): void { if (this.isStable()) { - if (this._callbacks.length !== 0) { - // Schedules the call backs after a macro task run outside of the angular zone to make sure - // no new task are added - this._ngZone.runOutsideAngular(() => { - setTimeout(() => { - if (this.isStable()) { - while (this._callbacks.length !== 0) { - (this._callbacks.pop() !)(this._didWork); - } - this._didWork = false; - } - }); - }); - } else { + // Schedules the call backs in a new frame so that it is always async. + scheduleMicroTask(() => { + while (this._callbacks.length !== 0) { + (this._callbacks.pop() !)(this._didWork); + } this._didWork = false; - } + }); } else { // Not Ready this._didWork = true; diff --git a/packages/core/test/testability/testability_spec.ts b/packages/core/test/testability/testability_spec.ts index ec5deb1af9223..ee5e7560c5905 100644 --- a/packages/core/test/testability/testability_spec.ts +++ b/packages/core/test/testability/testability_spec.ts @@ -16,11 +16,13 @@ import {scheduleMicroTask} from '../../src/util'; -// Schedules a task to be run after Testability checks for oustanding tasks. Since Testability -// uses a 0 second timeout to check for outstanding tasks we add our 0 second timeout after a -// micro task (which ensures Testability's timeout is run first). -function afterTestabilityCheck(fn: Function): void { - scheduleMicroTask(() => setTimeout(fn)); +// Schedules a microtasks (using a resolved promise .then()) +function microTask(fn: Function): void { + scheduleMicroTask(() => { + // We do double dispatch so that we can wait for scheduleMicrotask in the Testability when + // NgZone becomes stable. + scheduleMicroTask(fn); + }); } @Injectable() @@ -63,7 +65,7 @@ class MockNgZone extends NgZone { it('should fire whenstable callbacks if pending count is 0', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => { testability.whenStable(execute); - afterTestabilityCheck(() => { + microTask(() => { expect(execute).toHaveBeenCalled(); async.done(); }); @@ -80,11 +82,11 @@ class MockNgZone extends NgZone { testability.increasePendingRequestCount(); testability.whenStable(execute); - afterTestabilityCheck(() => { + microTask(() => { expect(execute).not.toHaveBeenCalled(); testability.decreasePendingRequestCount(); - afterTestabilityCheck(() => { + microTask(() => { expect(execute).not.toHaveBeenCalled(); async.done(); }); @@ -96,11 +98,11 @@ class MockNgZone extends NgZone { testability.increasePendingRequestCount(); testability.whenStable(execute); - afterTestabilityCheck(() => { + microTask(() => { expect(execute).not.toHaveBeenCalled(); testability.decreasePendingRequestCount(); - afterTestabilityCheck(() => { + microTask(() => { expect(execute).toHaveBeenCalled(); async.done(); }); @@ -118,7 +120,7 @@ class MockNgZone extends NgZone { it('should fire whenstable callbacks with didWork if pending count is 0', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => { testability.whenStable(execute); - afterTestabilityCheck(() => { + microTask(() => { expect(execute).toHaveBeenCalledWith(false); async.done(); }); @@ -129,14 +131,14 @@ class MockNgZone extends NgZone { testability.increasePendingRequestCount(); testability.whenStable(execute); - afterTestabilityCheck(() => { + microTask(() => { testability.decreasePendingRequestCount(); - afterTestabilityCheck(() => { + microTask(() => { expect(execute).toHaveBeenCalledWith(true); testability.whenStable(execute2); - afterTestabilityCheck(() => { + microTask(() => { expect(execute2).toHaveBeenCalledWith(false); async.done(); }); @@ -152,7 +154,7 @@ class MockNgZone extends NgZone { ngZone.stable(); testability.whenStable(execute); - afterTestabilityCheck(() => { + microTask(() => { expect(execute).toHaveBeenCalled(); async.done(); }); @@ -171,11 +173,11 @@ class MockNgZone extends NgZone { ngZone.unstable(); testability.whenStable(execute); - afterTestabilityCheck(() => { + microTask(() => { expect(execute).not.toHaveBeenCalled(); ngZone.stable(); - afterTestabilityCheck(() => { + microTask(() => { expect(execute).toHaveBeenCalled(); async.done(); }); @@ -196,15 +198,15 @@ class MockNgZone extends NgZone { testability.increasePendingRequestCount(); testability.whenStable(execute); - afterTestabilityCheck(() => { + microTask(() => { expect(execute).not.toHaveBeenCalled(); testability.decreasePendingRequestCount(); - afterTestabilityCheck(() => { + microTask(() => { expect(execute).not.toHaveBeenCalled(); ngZone.stable(); - afterTestabilityCheck(() => { + microTask(() => { expect(execute).toHaveBeenCalled(); async.done(); }); @@ -219,19 +221,19 @@ class MockNgZone extends NgZone { testability.increasePendingRequestCount(); testability.whenStable(execute); - afterTestabilityCheck(() => { + microTask(() => { expect(execute).not.toHaveBeenCalled(); ngZone.stable(); - afterTestabilityCheck(() => { + microTask(() => { expect(execute).not.toHaveBeenCalled(); testability.decreasePendingRequestCount(); - afterTestabilityCheck(() => { + microTask(() => { expect(execute).not.toHaveBeenCalled(); testability.decreasePendingRequestCount(); - afterTestabilityCheck(() => { + microTask(() => { expect(execute).toHaveBeenCalled(); async.done(); }); @@ -246,11 +248,11 @@ class MockNgZone extends NgZone { ngZone.stable(); testability.whenStable(execute); - afterTestabilityCheck(() => { + microTask(() => { expect(execute).toHaveBeenCalledWith(true); testability.whenStable(execute2); - afterTestabilityCheck(() => { + microTask(() => { expect(execute2).toHaveBeenCalledWith(false); async.done(); }); @@ -262,14 +264,14 @@ class MockNgZone extends NgZone { ngZone.unstable(); testability.whenStable(execute); - afterTestabilityCheck(() => { + microTask(() => { ngZone.stable(); - afterTestabilityCheck(() => { + microTask(() => { expect(execute).toHaveBeenCalledWith(true); testability.whenStable(execute2); - afterTestabilityCheck(() => { + microTask(() => { expect(execute2).toHaveBeenCalledWith(false); async.done(); }); From 02352bcd9ead0707eb613fc9ca7a1ce76ad9247c Mon Sep 17 00:00:00 2001 From: Olivier Combe Date: Tue, 2 Jan 2018 11:19:16 +0100 Subject: [PATCH 02/47] fix(compiler): add support for marker tags in xliff serializers (#21250) The Xliff serializer now supports the tags `seg-source` and `mrk`, while the Xliff2 serializer now supports `mrk`. Fixes #21078 PR Close #21250 --- .../compiler/src/i18n/serializers/xliff.ts | 18 ++++++++++----- .../compiler/src/i18n/serializers/xliff2.ts | 3 +++ .../test/i18n/serializers/xliff2_spec.ts | 22 ++++++++++++++++++- .../test/i18n/serializers/xliff_spec.ts | 18 ++++++++++++++- 4 files changed, 54 insertions(+), 7 deletions(-) diff --git a/packages/compiler/src/i18n/serializers/xliff.ts b/packages/compiler/src/i18n/serializers/xliff.ts index 11a59441a683c..fb64794daaf07 100644 --- a/packages/compiler/src/i18n/serializers/xliff.ts +++ b/packages/compiler/src/i18n/serializers/xliff.ts @@ -20,9 +20,11 @@ const _XMLNS = 'urn:oasis:names:tc:xliff:document:1.2'; // TODO(vicb): make this a param (s/_/-/) const _DEFAULT_SOURCE_LANG = 'en'; const _PLACEHOLDER_TAG = 'x'; +const _MARKER_TAG = 'mrk'; const _FILE_TAG = 'file'; const _SOURCE_TAG = 'source'; +const _SEGMENT_SOURCE_TAG = 'seg-source'; const _TARGET_TAG = 'target'; const _UNIT_TAG = 'trans-unit'; const _CONTEXT_GROUP_TAG = 'context-group'; @@ -214,8 +216,9 @@ class XliffParser implements ml.Visitor { } break; + // ignore those tags case _SOURCE_TAG: - // ignore source message + case _SEGMENT_SOURCE_TAG: break; case _TARGET_TAG: @@ -266,7 +269,7 @@ class XmlToI18n implements ml.Visitor { const i18nNodes = this._errors.length > 0 || xmlIcu.rootNodes.length == 0 ? [] : - ml.visitAll(this, xmlIcu.rootNodes); + [].concat(...ml.visitAll(this, xmlIcu.rootNodes)); return { i18nNodes: i18nNodes, @@ -276,7 +279,7 @@ class XmlToI18n implements ml.Visitor { visitText(text: ml.Text, context: any) { return new i18n.Text(text.value, text.sourceSpan !); } - visitElement(el: ml.Element, context: any): i18n.Placeholder|null { + visitElement(el: ml.Element, context: any): i18n.Placeholder|ml.Node[]|null { if (el.name === _PLACEHOLDER_TAG) { const nameAttr = el.attrs.find((attr) => attr.name === 'id'); if (nameAttr) { @@ -284,9 +287,14 @@ class XmlToI18n implements ml.Visitor { } this._addError(el, `<${_PLACEHOLDER_TAG}> misses the "id" attribute`); - } else { - this._addError(el, `Unexpected tag`); + return null; } + + if (el.name === _MARKER_TAG) { + return [].concat(...ml.visitAll(this, el.children)); + } + + this._addError(el, `Unexpected tag`); return null; } diff --git a/packages/compiler/src/i18n/serializers/xliff2.ts b/packages/compiler/src/i18n/serializers/xliff2.ts index ea754b34fc046..eac6612f5d09d 100644 --- a/packages/compiler/src/i18n/serializers/xliff2.ts +++ b/packages/compiler/src/i18n/serializers/xliff2.ts @@ -21,6 +21,7 @@ const _XMLNS = 'urn:oasis:names:tc:xliff:document:2.0'; const _DEFAULT_SOURCE_LANG = 'en'; const _PLACEHOLDER_TAG = 'ph'; const _PLACEHOLDER_SPANNING_TAG = 'pc'; +const _MARKER_TAG = 'mrk'; const _XLIFF_TAG = 'xliff'; const _SOURCE_TAG = 'source'; @@ -332,6 +333,8 @@ class XmlToI18n implements ml.Visitor { new i18n.Placeholder('', endId, el.sourceSpan)); } break; + case _MARKER_TAG: + return [].concat(...ml.visitAll(this, el.children)); default: this._addError(el, `Unexpected tag`); } diff --git a/packages/compiler/test/i18n/serializers/xliff2_spec.ts b/packages/compiler/test/i18n/serializers/xliff2_spec.ts index 937dcf0eb8787..027bdc5bdce2b 100644 --- a/packages/compiler/test/i18n/serializers/xliff2_spec.ts +++ b/packages/compiler/test/i18n/serializers/xliff2_spec.ts @@ -238,6 +238,24 @@ lines lignes + + + Please check the translation for 'namespace'. On also can use 'espace de nom',but I think most technical manuals use the English term. + + + You use your own namespace. + Vous pouvez utiliser votre propre namespace. + + + + + Please check the translation for 'namespace'. On also can use 'espace de nom',but I think most technical manuals use the English term. + + + You use your own namespace. + Vous pouvez utiliser votre propre namespace. + + `; @@ -289,7 +307,9 @@ lignes '5229984852258993423': '{VAR_PLURAL, plural, =0 {[{VAR_SELECT, select, other {[, profondément imbriqué, ]}}, ]}, =other {[beaucoup]}}', '2340165783990709777': `multi -lignes` +lignes`, + 'mrk-test': 'Vous pouvez utiliser votre propre namespace.', + 'mrk-test2': 'Vous pouvez utiliser votre propre namespace.' }); }); diff --git a/packages/compiler/test/i18n/serializers/xliff_spec.ts b/packages/compiler/test/i18n/serializers/xliff_spec.ts index 010bace00d441..87c153b63357a 100644 --- a/packages/compiler/test/i18n/serializers/xliff_spec.ts +++ b/packages/compiler/test/i18n/serializers/xliff_spec.ts @@ -221,6 +221,20 @@ lignes 12 + + First sentence. + + Should not be parsed + + Translated first sentence. + + + First sentence. Second sentence. + + Should not be parsed + + Translated first sentence. + @@ -273,7 +287,9 @@ lignes '{VAR_PLURAL, plural, =0 {[{VAR_SELECT, select, other {[, profondément imbriqué, ]}}, ]}, =other {[beaucoup]}}', 'fcfa109b0e152d4c217dbc02530be0bcb8123ad1': `multi -lignes` +lignes`, + 'mrk-test': 'Translated first sentence.', + 'mrk-test2': 'Translated first sentence.' }); }); From c9b65914d3bf6589bc9dd3df42ab37847eb6a06b Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 4 Jan 2018 11:29:55 -0800 Subject: [PATCH 03/47] build: add mhevery to bazel approvers (#21314) PR Close #21314 --- .pullapprove.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pullapprove.yml b/.pullapprove.yml index 7115108803642..621b6016a56dd 100644 --- a/.pullapprove.yml +++ b/.pullapprove.yml @@ -92,6 +92,7 @@ groups: - alexeagle #primary - chuckjaz - IgorMinar #fallback + - mhevery - vikerman #fallback build-and-ci: From 4ee92f14a633643f6c7f6fe4a5d1a57ef77607e7 Mon Sep 17 00:00:00 2001 From: Kapunahele Wong Date: Thu, 11 Jan 2018 11:09:23 -0500 Subject: [PATCH 04/47] docs: fix lazy loading example dir name (#21475) PR Close #21475 --- .../e2e/app.e2e-spec.ts | 0 .../example-config.json | 0 .../plnkr.json | 0 .../src/app/app-routing.module.ts | 0 .../src/app/app.component.css | 0 .../src/app/app.component.html | 0 .../src/app/app.component.spec.ts | 0 .../src/app/app.component.ts | 0 .../src/app/app.module.ts | 0 .../customer-list/customer-list.component.css | 0 .../customer-list/customer-list.component.html | 0 .../customer-list/customer-list.component.spec.ts | 0 .../customers/customer-list/customer-list.component.ts | 0 .../src/app/customers/customers-routing.module.ts | 0 .../src/app/customers/customers.module.ts | 0 .../src/app/orders/order-list/order-list.component.css | 0 .../app/orders/order-list/order-list.component.html | 0 .../app/orders/order-list/order-list.component.spec.ts | 0 .../src/app/orders/order-list/order-list.component.ts | 0 .../src/app/orders/orders-routing.module.ts | 0 .../src/app/orders/orders.module.ts | 0 .../src/index.html | 0 .../src/main.ts | 0 aio/content/guide/lazy-loading-ngmodules.md | 10 +++++----- 24 files changed, 5 insertions(+), 5 deletions(-) rename aio/content/examples/{lazy-loading => lazy-loading-ngmodules}/e2e/app.e2e-spec.ts (100%) rename aio/content/examples/{lazy-loading => lazy-loading-ngmodules}/example-config.json (100%) rename aio/content/examples/{lazy-loading => lazy-loading-ngmodules}/plnkr.json (100%) rename aio/content/examples/{lazy-loading => lazy-loading-ngmodules}/src/app/app-routing.module.ts (100%) rename aio/content/examples/{lazy-loading => lazy-loading-ngmodules}/src/app/app.component.css (100%) rename aio/content/examples/{lazy-loading => lazy-loading-ngmodules}/src/app/app.component.html (100%) rename aio/content/examples/{lazy-loading => lazy-loading-ngmodules}/src/app/app.component.spec.ts (100%) rename aio/content/examples/{lazy-loading => lazy-loading-ngmodules}/src/app/app.component.ts (100%) rename aio/content/examples/{lazy-loading => lazy-loading-ngmodules}/src/app/app.module.ts (100%) rename aio/content/examples/{lazy-loading => lazy-loading-ngmodules}/src/app/customers/customer-list/customer-list.component.css (100%) rename aio/content/examples/{lazy-loading => lazy-loading-ngmodules}/src/app/customers/customer-list/customer-list.component.html (100%) rename aio/content/examples/{lazy-loading => lazy-loading-ngmodules}/src/app/customers/customer-list/customer-list.component.spec.ts (100%) rename aio/content/examples/{lazy-loading => lazy-loading-ngmodules}/src/app/customers/customer-list/customer-list.component.ts (100%) rename aio/content/examples/{lazy-loading => lazy-loading-ngmodules}/src/app/customers/customers-routing.module.ts (100%) rename aio/content/examples/{lazy-loading => lazy-loading-ngmodules}/src/app/customers/customers.module.ts (100%) rename aio/content/examples/{lazy-loading => lazy-loading-ngmodules}/src/app/orders/order-list/order-list.component.css (100%) rename aio/content/examples/{lazy-loading => lazy-loading-ngmodules}/src/app/orders/order-list/order-list.component.html (100%) rename aio/content/examples/{lazy-loading => lazy-loading-ngmodules}/src/app/orders/order-list/order-list.component.spec.ts (100%) rename aio/content/examples/{lazy-loading => lazy-loading-ngmodules}/src/app/orders/order-list/order-list.component.ts (100%) rename aio/content/examples/{lazy-loading => lazy-loading-ngmodules}/src/app/orders/orders-routing.module.ts (100%) rename aio/content/examples/{lazy-loading => lazy-loading-ngmodules}/src/app/orders/orders.module.ts (100%) rename aio/content/examples/{lazy-loading => lazy-loading-ngmodules}/src/index.html (100%) rename aio/content/examples/{lazy-loading => lazy-loading-ngmodules}/src/main.ts (100%) diff --git a/aio/content/examples/lazy-loading/e2e/app.e2e-spec.ts b/aio/content/examples/lazy-loading-ngmodules/e2e/app.e2e-spec.ts similarity index 100% rename from aio/content/examples/lazy-loading/e2e/app.e2e-spec.ts rename to aio/content/examples/lazy-loading-ngmodules/e2e/app.e2e-spec.ts diff --git a/aio/content/examples/lazy-loading/example-config.json b/aio/content/examples/lazy-loading-ngmodules/example-config.json similarity index 100% rename from aio/content/examples/lazy-loading/example-config.json rename to aio/content/examples/lazy-loading-ngmodules/example-config.json diff --git a/aio/content/examples/lazy-loading/plnkr.json b/aio/content/examples/lazy-loading-ngmodules/plnkr.json similarity index 100% rename from aio/content/examples/lazy-loading/plnkr.json rename to aio/content/examples/lazy-loading-ngmodules/plnkr.json diff --git a/aio/content/examples/lazy-loading/src/app/app-routing.module.ts b/aio/content/examples/lazy-loading-ngmodules/src/app/app-routing.module.ts similarity index 100% rename from aio/content/examples/lazy-loading/src/app/app-routing.module.ts rename to aio/content/examples/lazy-loading-ngmodules/src/app/app-routing.module.ts diff --git a/aio/content/examples/lazy-loading/src/app/app.component.css b/aio/content/examples/lazy-loading-ngmodules/src/app/app.component.css similarity index 100% rename from aio/content/examples/lazy-loading/src/app/app.component.css rename to aio/content/examples/lazy-loading-ngmodules/src/app/app.component.css diff --git a/aio/content/examples/lazy-loading/src/app/app.component.html b/aio/content/examples/lazy-loading-ngmodules/src/app/app.component.html similarity index 100% rename from aio/content/examples/lazy-loading/src/app/app.component.html rename to aio/content/examples/lazy-loading-ngmodules/src/app/app.component.html diff --git a/aio/content/examples/lazy-loading/src/app/app.component.spec.ts b/aio/content/examples/lazy-loading-ngmodules/src/app/app.component.spec.ts similarity index 100% rename from aio/content/examples/lazy-loading/src/app/app.component.spec.ts rename to aio/content/examples/lazy-loading-ngmodules/src/app/app.component.spec.ts diff --git a/aio/content/examples/lazy-loading/src/app/app.component.ts b/aio/content/examples/lazy-loading-ngmodules/src/app/app.component.ts similarity index 100% rename from aio/content/examples/lazy-loading/src/app/app.component.ts rename to aio/content/examples/lazy-loading-ngmodules/src/app/app.component.ts diff --git a/aio/content/examples/lazy-loading/src/app/app.module.ts b/aio/content/examples/lazy-loading-ngmodules/src/app/app.module.ts similarity index 100% rename from aio/content/examples/lazy-loading/src/app/app.module.ts rename to aio/content/examples/lazy-loading-ngmodules/src/app/app.module.ts diff --git a/aio/content/examples/lazy-loading/src/app/customers/customer-list/customer-list.component.css b/aio/content/examples/lazy-loading-ngmodules/src/app/customers/customer-list/customer-list.component.css similarity index 100% rename from aio/content/examples/lazy-loading/src/app/customers/customer-list/customer-list.component.css rename to aio/content/examples/lazy-loading-ngmodules/src/app/customers/customer-list/customer-list.component.css diff --git a/aio/content/examples/lazy-loading/src/app/customers/customer-list/customer-list.component.html b/aio/content/examples/lazy-loading-ngmodules/src/app/customers/customer-list/customer-list.component.html similarity index 100% rename from aio/content/examples/lazy-loading/src/app/customers/customer-list/customer-list.component.html rename to aio/content/examples/lazy-loading-ngmodules/src/app/customers/customer-list/customer-list.component.html diff --git a/aio/content/examples/lazy-loading/src/app/customers/customer-list/customer-list.component.spec.ts b/aio/content/examples/lazy-loading-ngmodules/src/app/customers/customer-list/customer-list.component.spec.ts similarity index 100% rename from aio/content/examples/lazy-loading/src/app/customers/customer-list/customer-list.component.spec.ts rename to aio/content/examples/lazy-loading-ngmodules/src/app/customers/customer-list/customer-list.component.spec.ts diff --git a/aio/content/examples/lazy-loading/src/app/customers/customer-list/customer-list.component.ts b/aio/content/examples/lazy-loading-ngmodules/src/app/customers/customer-list/customer-list.component.ts similarity index 100% rename from aio/content/examples/lazy-loading/src/app/customers/customer-list/customer-list.component.ts rename to aio/content/examples/lazy-loading-ngmodules/src/app/customers/customer-list/customer-list.component.ts diff --git a/aio/content/examples/lazy-loading/src/app/customers/customers-routing.module.ts b/aio/content/examples/lazy-loading-ngmodules/src/app/customers/customers-routing.module.ts similarity index 100% rename from aio/content/examples/lazy-loading/src/app/customers/customers-routing.module.ts rename to aio/content/examples/lazy-loading-ngmodules/src/app/customers/customers-routing.module.ts diff --git a/aio/content/examples/lazy-loading/src/app/customers/customers.module.ts b/aio/content/examples/lazy-loading-ngmodules/src/app/customers/customers.module.ts similarity index 100% rename from aio/content/examples/lazy-loading/src/app/customers/customers.module.ts rename to aio/content/examples/lazy-loading-ngmodules/src/app/customers/customers.module.ts diff --git a/aio/content/examples/lazy-loading/src/app/orders/order-list/order-list.component.css b/aio/content/examples/lazy-loading-ngmodules/src/app/orders/order-list/order-list.component.css similarity index 100% rename from aio/content/examples/lazy-loading/src/app/orders/order-list/order-list.component.css rename to aio/content/examples/lazy-loading-ngmodules/src/app/orders/order-list/order-list.component.css diff --git a/aio/content/examples/lazy-loading/src/app/orders/order-list/order-list.component.html b/aio/content/examples/lazy-loading-ngmodules/src/app/orders/order-list/order-list.component.html similarity index 100% rename from aio/content/examples/lazy-loading/src/app/orders/order-list/order-list.component.html rename to aio/content/examples/lazy-loading-ngmodules/src/app/orders/order-list/order-list.component.html diff --git a/aio/content/examples/lazy-loading/src/app/orders/order-list/order-list.component.spec.ts b/aio/content/examples/lazy-loading-ngmodules/src/app/orders/order-list/order-list.component.spec.ts similarity index 100% rename from aio/content/examples/lazy-loading/src/app/orders/order-list/order-list.component.spec.ts rename to aio/content/examples/lazy-loading-ngmodules/src/app/orders/order-list/order-list.component.spec.ts diff --git a/aio/content/examples/lazy-loading/src/app/orders/order-list/order-list.component.ts b/aio/content/examples/lazy-loading-ngmodules/src/app/orders/order-list/order-list.component.ts similarity index 100% rename from aio/content/examples/lazy-loading/src/app/orders/order-list/order-list.component.ts rename to aio/content/examples/lazy-loading-ngmodules/src/app/orders/order-list/order-list.component.ts diff --git a/aio/content/examples/lazy-loading/src/app/orders/orders-routing.module.ts b/aio/content/examples/lazy-loading-ngmodules/src/app/orders/orders-routing.module.ts similarity index 100% rename from aio/content/examples/lazy-loading/src/app/orders/orders-routing.module.ts rename to aio/content/examples/lazy-loading-ngmodules/src/app/orders/orders-routing.module.ts diff --git a/aio/content/examples/lazy-loading/src/app/orders/orders.module.ts b/aio/content/examples/lazy-loading-ngmodules/src/app/orders/orders.module.ts similarity index 100% rename from aio/content/examples/lazy-loading/src/app/orders/orders.module.ts rename to aio/content/examples/lazy-loading-ngmodules/src/app/orders/orders.module.ts diff --git a/aio/content/examples/lazy-loading/src/index.html b/aio/content/examples/lazy-loading-ngmodules/src/index.html similarity index 100% rename from aio/content/examples/lazy-loading/src/index.html rename to aio/content/examples/lazy-loading-ngmodules/src/index.html diff --git a/aio/content/examples/lazy-loading/src/main.ts b/aio/content/examples/lazy-loading-ngmodules/src/main.ts similarity index 100% rename from aio/content/examples/lazy-loading/src/main.ts rename to aio/content/examples/lazy-loading-ngmodules/src/main.ts diff --git a/aio/content/guide/lazy-loading-ngmodules.md b/aio/content/guide/lazy-loading-ngmodules.md index 579bd5f07a36e..e38dbbfca933b 100644 --- a/aio/content/guide/lazy-loading-ngmodules.md +++ b/aio/content/guide/lazy-loading-ngmodules.md @@ -97,7 +97,7 @@ placeholder markup in `app.component.html` with a custom nav so you can easily navigate to your modules in the browser: - + @@ -137,7 +137,7 @@ Each feature module acts as a doorway via the router. In the `AppRoutingModule`, In `AppRoutingModule`, update the `routes` array with the following: - + @@ -149,7 +149,7 @@ The import statements stay the same. The first two paths are the routes to the ` Next, take a look at `customers.module.ts`. If you’re using the CLI and following the steps outlined in this page, you don’t have to do anything here. The feature module is like a connector between the `AppRoutingModule` and the feature routing module. The `AppRoutingModule` imports the feature module, `CustomersModule`, and `CustomersModule` in turn imports the `CustomersRoutingModule`. - + @@ -162,7 +162,7 @@ The `customers.module.ts` file imports the `CustomersRoutingModule` and `Custome The next step is in `customers-routing.module.ts`. First, import the component at the top of the file with the other JavaScript import statements. Then, add the route to `CustomerListComponent`. - + @@ -171,7 +171,7 @@ Notice that the `path` is set to an empty string. This is because the path in `A Repeat this last step of importing the `OrdersListComponent` and configuring the Routes array for the `orders-routing.module.ts`: - + From 2c6502739191fd34169ba7be463ef2543fbcfdbd Mon Sep 17 00:00:00 2001 From: Kapunahele Wong Date: Thu, 11 Jan 2018 15:38:51 -0500 Subject: [PATCH 05/47] docs: add server side redirect and fix NgModule FAQ links (#21487) PR Close #21487 --- aio/content/guide/feature-modules.md | 2 +- aio/content/guide/ngmodule-faq.md | 3 +++ aio/content/guide/sharing-ngmodules.md | 2 +- aio/firebase.json | 3 +++ aio/ngsw-manifest.json | 2 +- 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/aio/content/guide/feature-modules.md b/aio/content/guide/feature-modules.md index 890f0baf27cdc..e29cfa6c0ba07 100644 --- a/aio/content/guide/feature-modules.md +++ b/aio/content/guide/feature-modules.md @@ -104,7 +104,7 @@ When the CLI generated the `CustomerDashboardComponent` for the feature module, To see this HTML in the `AppComponent`, you first have to export the `CustomerDashboardComponent` in the `CustomerDashboardModule`. In `customer-dashboard.module.ts`, just beneath the declarations array, add an exports array containing `CustomerDashboardModule`: - + diff --git a/aio/content/guide/ngmodule-faq.md b/aio/content/guide/ngmodule-faq.md index 2f8409c561337..0a6738934a05f 100644 --- a/aio/content/guide/ngmodule-faq.md +++ b/aio/content/guide/ngmodule-faq.md @@ -338,6 +338,7 @@ Define child routes and let the router load module components into that outlet.
+ {@ q-root-component-or-module} ## Should I add application-wide providers to the root `AppModule` or the root `AppComponent`? @@ -372,6 +373,7 @@ This means that lazy-loaded modules can't reach them.
+ {@ q-component-or-module} ## Should I add other providers to a module or a component? @@ -394,6 +396,7 @@ not the root `AppComponent`.
+ {@ q-why-bad} ## Why is it bad if a shared module provides a service to a lazy-loaded module? diff --git a/aio/content/guide/sharing-ngmodules.md b/aio/content/guide/sharing-ngmodules.md index c5e4e6a515a17..e971294463899 100644 --- a/aio/content/guide/sharing-ngmodules.md +++ b/aio/content/guide/sharing-ngmodules.md @@ -55,7 +55,7 @@ having to import it directly into the `@NgModule` decorator. ### Using components vs services from other modules. There is an important distinction between using another module's component and -using a service from another module.. Import modules when you want to use +using a service from another module. Import modules when you want to use directives, pipes, and components. Importing a module with services means that you will have a new instance of that service, which typically is not what you need, (typically one wants to reuse an existing service.) Use module imports to control service instantiation. The most common way to get a hold of sharedservices is through Angular diff --git a/aio/firebase.json b/aio/firebase.json index a41d85931f784..6dcbc99227396 100644 --- a/aio/firebase.json +++ b/aio/firebase.json @@ -49,6 +49,9 @@ // aot-compiler.md and metadata.md combined into aot-compiler.md - issue #19510 {"type": 301, "source": "/guide/metadata", "destination": "/guide/aot-compiler"}, + // ngmodule.md renamed to ngmodules.md + {"type": 301, "source": "/guide/ngmodule", "destination": "/guide/ngmodules"} + // service-worker-getstart.md, service-worker-comm.md, service-worker-configref.md {"type": 301, "source": "/guide/service-worker-getstart", "destination": "/guide/service-worker-getting-started"}, {"type": 301, "source": "/guide/service-worker-comm", "destination": "/guide/service-worker-communications"}, diff --git a/aio/ngsw-manifest.json b/aio/ngsw-manifest.json index e2a077482c712..da6ad6af2d632 100644 --- a/aio/ngsw-manifest.json +++ b/aio/ngsw-manifest.json @@ -19,7 +19,7 @@ "routing": { "index": "/index.html", "routes": { - "^(?!/docs/ts/latest|/guide/(?:cli-quickstart|metadata|service-worker-(?:getstart|comm|configref))/?$|/styleguide).*/(?!e?plnkr)[^/.]*$": { + "^(?!/docs/ts/latest|/guide/(?:cli-quickstart|metadata|ngmodule|service-worker-(?:getstart|comm|configref))/?$|/styleguide).*/(?!e?plnkr)[^/.]*$": { "match": "regex" } } From 3606c55410d67fa53e161e25ad518521a05c2712 Mon Sep 17 00:00:00 2001 From: Kapunahele Wong Date: Wed, 17 Jan 2018 10:23:19 -0500 Subject: [PATCH 06/47] docs: edit entry component FAQ (#21487) PR Close #21487 --- aio/content/guide/ngmodule-faq.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aio/content/guide/ngmodule-faq.md b/aio/content/guide/ngmodule-faq.md index 0a6738934a05f..31af24be1f8c7 100644 --- a/aio/content/guide/ngmodule-faq.md +++ b/aio/content/guide/ngmodule-faq.md @@ -488,9 +488,9 @@ An entry component is any component that Angular loads _imperatively_ by type. A component loaded _declaratively_ via its selector is _not_ an entry component. -Most application components are loaded declaratively, which means -Angular uses the component's selector to locate the element in the template. -It then creates the HTML representation of the component and inserts it into the DOM at the selected element. These aren't entry components. +Angular loads a component declaratively when +using the component's selector to locate the element in the template. +Angular then creates the HTML representation of the component and inserts it into the DOM at the selected element. These aren't entry components. The bootstrapped root `AppComponent` is an _entry component_. True, its selector matches an element tag in `index.html`. From 982eb7bba81805e852cd13e6b743102feffc444a Mon Sep 17 00:00:00 2001 From: Trotyl Date: Thu, 4 Jan 2018 15:35:57 +0800 Subject: [PATCH 07/47] fix(common): fallback to last defined value for named date and time formats (#21299) closes #21282 PR Close #21299 --- packages/common/src/i18n/locale_data_api.ts | 4 ++-- packages/common/test/i18n/locale_data_api_spec.ts | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/common/src/i18n/locale_data_api.ts b/packages/common/src/i18n/locale_data_api.ts index 9e5ecb0ac7085..4bf240e497a26 100644 --- a/packages/common/src/i18n/locale_data_api.ts +++ b/packages/common/src/i18n/locale_data_api.ts @@ -253,7 +253,7 @@ export function getLocaleWeekEndRange(locale: string): [WeekDay, WeekDay] { */ export function getLocaleDateFormat(locale: string, width: FormatWidth): string { const data = findLocaleData(locale); - return data[LocaleDataIndex.DateFormat][width]; + return getLastDefinedValue(data[LocaleDataIndex.DateFormat], width); } /** @@ -278,7 +278,7 @@ export function getLocaleDateFormat(locale: string, width: FormatWidth): string */ export function getLocaleTimeFormat(locale: string, width: FormatWidth): string { const data = findLocaleData(locale); - return data[LocaleDataIndex.TimeFormat][width]; + return getLastDefinedValue(data[LocaleDataIndex.TimeFormat], width); } /** diff --git a/packages/common/test/i18n/locale_data_api_spec.ts b/packages/common/test/i18n/locale_data_api_spec.ts index 911a4cc61d6f9..ad7b673bf7ec3 100644 --- a/packages/common/test/i18n/locale_data_api_spec.ts +++ b/packages/common/test/i18n/locale_data_api_spec.ts @@ -9,9 +9,10 @@ import localeCaESVALENCIA from '@angular/common/locales/ca-ES-VALENCIA'; import localeEn from '@angular/common/locales/en'; import localeFr from '@angular/common/locales/fr'; +import localeZh from '@angular/common/locales/zh'; import localeFrCA from '@angular/common/locales/fr-CA'; import {registerLocaleData} from '../../src/i18n/locale_data'; -import {findLocaleData, getCurrencySymbol} from '../../src/i18n/locale_data_api'; +import {findLocaleData, getCurrencySymbol, getLocaleDateFormat, FormatWidth} from '../../src/i18n/locale_data_api'; { describe('locale data api', () => { @@ -22,6 +23,7 @@ import {findLocaleData, getCurrencySymbol} from '../../src/i18n/locale_data_api' registerLocaleData(localeFrCA); registerLocaleData(localeFr, 'fake-id'); registerLocaleData(localeFrCA, 'fake_Id2'); + registerLocaleData(localeZh); }); describe('findLocaleData', () => { @@ -64,5 +66,10 @@ import {findLocaleData, getCurrencySymbol} from '../../src/i18n/locale_data_api' expect(getCurrencySymbol('FAKE', 'narrow')).toEqual('FAKE'); }); }); + + describe('getLastDefinedValue', () => { + it('should find the last defined date format when format not defined', + () => { expect(getLocaleDateFormat('zh', FormatWidth.Long)).toEqual('y年M月d日'); }); + }); }); } From ba4ea82f6841aa238bbba19bb2bd53ca7e661201 Mon Sep 17 00:00:00 2001 From: Chuck Jazdzewski Date: Thu, 18 Jan 2018 14:36:49 -0800 Subject: [PATCH 08/47] fix(compiler-cli): do not lower expressions in non-modules (#21649) Fixes: #21651 PR Close #21649 --- .../src/transformers/lower_expressions.ts | 5 +++-- .../test/transformers/lower_expressions_spec.ts | 12 +++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/compiler-cli/src/transformers/lower_expressions.ts b/packages/compiler-cli/src/transformers/lower_expressions.ts index ef38ff728652c..9ac0f8174dd52 100644 --- a/packages/compiler-cli/src/transformers/lower_expressions.ts +++ b/packages/compiler-cli/src/transformers/lower_expressions.ts @@ -325,13 +325,14 @@ export class LowerMetadataCache implements RequestsMap { }; // Do not validate or lower metadata in a declaration file. Declaration files are requested - // when we need to update the version of the metadata to add informatoin that might be missing + // when we need to update the version of the metadata to add information that might be missing // in the out-of-date version that can be recovered from the .d.ts file. const declarationFile = sourceFile.isDeclarationFile; + const moduleFile = ts.isExternalModule(sourceFile); const metadata = this.collector.getMetadata( sourceFile, this.strict && !declarationFile, - declarationFile ? undefined : substituteExpression); + moduleFile && !declarationFile ? substituteExpression : undefined); return {metadata, requests}; } diff --git a/packages/compiler-cli/test/transformers/lower_expressions_spec.ts b/packages/compiler-cli/test/transformers/lower_expressions_spec.ts index d76d5571ee628..2f34c235dc649 100644 --- a/packages/compiler-cli/test/transformers/lower_expressions_spec.ts +++ b/packages/compiler-cli/test/transformers/lower_expressions_spec.ts @@ -99,7 +99,17 @@ describe('Expression lowering', () => { .toBeTruthy('did not find the data field'); }); - it('should throw a validation execption for invalid files', () => { + it('should not lower a non-module', () => { + const collected = collect(` + declare const global: any; + const ngDevMode: boolean = (function(global: any) { + return global.ngDevMode = true; + })(typeof window != 'undefined' && window || typeof self != 'undefined' && self || typeof global != 'undefined' && global); + `); + expect(collected.requests.size).toBe(0, 'unexpected rewriting'); + }); + + it('should throw a validation exception for invalid files', () => { const cache = new LowerMetadataCache({}, /* strict */ true); const sourceFile = ts.createSourceFile( 'foo.ts', ` From 00f99b3c4c5a9b1dd9127871776c05cb541347ca Mon Sep 17 00:00:00 2001 From: Olivier Combe Date: Thu, 18 Jan 2018 17:41:07 +0100 Subject: [PATCH 09/47] ci: update github bot messages (#21634) Fixes #21633 PR Close #21634 --- .github/angular-robot.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/angular-robot.yml b/.github/angular-robot.yml index 85905933664b3..160d5200309d2 100644 --- a/.github/angular-robot.yml +++ b/.github/angular-robot.yml @@ -14,8 +14,8 @@ merge: failureText: "The following checks are failing:" # comment that will be added to a PR when there is a conflict, leave empty or set to false to disable - mergeConflictComment: "Hello? Don't want to hassle you. Sure you're busy. But this PR has some merge conflicts that you probably ought to resolve. -\nThat is... if you want it to be merged someday..." + mergeConflictComment: "Hi @{{PRAuthor}}! This PR has merge conflicts due to recent upstream merges. +\nPlease help to unblock it by resolving these conflicts. Thanks!" # label to monitor mergeLabel: "PR action: merge" @@ -44,9 +44,9 @@ merge: # the comment that will be added when the merge label is added despite failing checks, leave empty or set to false to disable # {{MERGE_LABEL}} will be replaced by the value of the mergeLabel option # {{PLACEHOLDER}} will be replaced by the list of failing checks - mergeRemovedComment: "I see that you just added the `{{MERGE_LABEL}}` label. It won't do anything good though, because the following checks are still failing: - \n{{PLACEHOLDER}} - \n - \n**If you want your PR to be merged, it has to pass all the CI checks.** - \n - \nIf you can't get the PR to a green state due to flakes or broken master, please try rebasing to master and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help." + mergeRemovedComment: "I see that you just added the `{{MERGE_LABEL}}` label, but the following checks are still failing: +\n{{PLACEHOLDER}} +\n +\n**If you want your PR to be merged, it has to pass all the CI checks.** +\n +\nIf you can't get the PR to a green state due to flakes or broken master, please try rebasing to master and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help." From 983ccc02ad86adbbcd440cf592f54a5f02752e33 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Thu, 18 Jan 2018 16:36:54 +0200 Subject: [PATCH 10/47] build(aio): fix zips testing commands (#21629) PR Close #21629 --- .../package.json | 49 -------- .../customizer/package-json/base.json | 1 - .../customizer/package-json/cli.json | 1 + .../customizer/package-json/i18n.json | 1 + .../customizer/package-json/universal.json | 1 + aio/tools/examples/shared/package.json | 2 + aio/tools/examples/shared/yarn.lock | 111 ++++++++++++++++-- 7 files changed, 108 insertions(+), 58 deletions(-) delete mode 100644 aio/content/examples/service-worker-getting-started/package.json diff --git a/aio/content/examples/service-worker-getting-started/package.json b/aio/content/examples/service-worker-getting-started/package.json deleted file mode 100644 index 41bbb4a01f542..0000000000000 --- a/aio/content/examples/service-worker-getting-started/package.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "angular.io-example", - "version": "0.0.0", - "license": "MIT", - "scripts": { - "ng": "ng", - "start": "ng serve", - "build": "ng build", - "test": "ng test", - "lint": "ng lint", - "e2e": "ng e2e" - }, - "private": true, - "dependencies": { - "@angular/animations": "^5.0.0", - "@angular/common": "^5.0.0", - "@angular/compiler": "^5.0.0", - "@angular/core": "^5.0.0", - "@angular/forms": "^5.0.0", - "@angular/http": "^5.0.0", - "@angular/platform-browser": "^5.0.0", - "@angular/platform-browser-dynamic": "^5.0.0", - "@angular/router": "^5.0.0", - "core-js": "^2.4.1", - "rxjs": "^5.5.2", - "zone.js": "^0.8.14" - }, - "devDependencies": { - "@angular/cli": "1.5.4", - "@angular/compiler-cli": "^5.0.0", - "@angular/language-service": "^5.0.0", - "@types/jasmine": "~2.5.53", - "@types/jasminewd2": "~2.0.2", - "@types/node": "~6.0.60", - "codelyzer": "^4.0.1", - "jasmine-core": "~2.6.2", - "jasmine-spec-reporter": "~4.1.0", - "karma": "~1.7.0", - "karma-chrome-launcher": "~2.1.1", - "karma-cli": "~1.0.1", - "karma-coverage-istanbul-reporter": "^1.2.1", - "karma-jasmine": "~1.1.0", - "karma-jasmine-html-reporter": "^0.2.2", - "protractor": "~5.1.2", - "ts-node": "~3.2.0", - "tslint": "~5.7.0", - "typescript": "~2.4.2" - } -} diff --git a/aio/tools/example-zipper/customizer/package-json/base.json b/aio/tools/example-zipper/customizer/package-json/base.json index 88990659310d1..85c8e13d8cbb5 100644 --- a/aio/tools/example-zipper/customizer/package-json/base.json +++ b/aio/tools/example-zipper/customizer/package-json/base.json @@ -23,7 +23,6 @@ "devDependencies": [ "@types/jasmine", "@types/node", - "jasmine", "jasmine-core", "karma", "karma-chrome-launcher", diff --git a/aio/tools/example-zipper/customizer/package-json/cli.json b/aio/tools/example-zipper/customizer/package-json/cli.json index ca5fc2be05dde..92d69b7ae9367 100644 --- a/aio/tools/example-zipper/customizer/package-json/cli.json +++ b/aio/tools/example-zipper/customizer/package-json/cli.json @@ -13,6 +13,7 @@ "devDependencies": [ "@angular/cli", "@types/jasminewd2", + "jasmine-spec-reporter", "karma-coverage-istanbul-reporter", "ts-node" ] diff --git a/aio/tools/example-zipper/customizer/package-json/i18n.json b/aio/tools/example-zipper/customizer/package-json/i18n.json index 567306590fa04..531385d2a8db0 100644 --- a/aio/tools/example-zipper/customizer/package-json/i18n.json +++ b/aio/tools/example-zipper/customizer/package-json/i18n.json @@ -15,6 +15,7 @@ "devDependencies": [ "@angular/cli", "@types/jasminewd2", + "jasmine-spec-reporter", "karma-coverage-istanbul-reporter", "ts-node" ] diff --git a/aio/tools/example-zipper/customizer/package-json/universal.json b/aio/tools/example-zipper/customizer/package-json/universal.json index 76ca9e673ad72..06d609e421a26 100644 --- a/aio/tools/example-zipper/customizer/package-json/universal.json +++ b/aio/tools/example-zipper/customizer/package-json/universal.json @@ -19,6 +19,7 @@ "devDependencies": [ "@angular/cli", "@types/jasminewd2", + "jasmine-spec-reporter", "karma-coverage-istanbul-reporter", "ts-node" ] diff --git a/aio/tools/examples/shared/package.json b/aio/tools/examples/shared/package.json index ba76c27b16577..5974a1787ccf2 100644 --- a/aio/tools/examples/shared/package.json +++ b/aio/tools/examples/shared/package.json @@ -66,9 +66,11 @@ "http-server": "^0.9.0", "jasmine": "~2.4.1", "jasmine-core": "~2.4.1", + "jasmine-spec-reporter": "^4.2.1", "karma": "^1.3.0", "karma-chrome-launcher": "^2.0.0", "karma-cli": "^1.0.1", + "karma-coverage-istanbul-reporter": "^1.3.3", "karma-jasmine": "^1.0.2", "karma-jasmine-html-reporter": "^0.2.2", "karma-phantomjs-launcher": "^1.0.2", diff --git a/aio/tools/examples/shared/yarn.lock b/aio/tools/examples/shared/yarn.lock index 2db1e47f7a970..76bfb0e36429f 100644 --- a/aio/tools/examples/shared/yarn.lock +++ b/aio/tools/examples/shared/yarn.lock @@ -436,6 +436,12 @@ anymatch@^1.3.0: micromatch "^2.1.5" normalize-path "^2.0.0" +append-transform@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/append-transform/-/append-transform-0.4.0.tgz#d76ebf8ca94d276e247a36bad44a4b74ab611991" + dependencies: + default-require-extensions "^1.0.0" + aproba@^1.0.3, aproba@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" @@ -558,7 +564,7 @@ async@0.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/async/-/async-0.9.0.tgz#ac3613b1da9bed1b47510bb4651b8931e47146c7" -async@1.5.2, async@^1.5.2: +async@1.5.2, async@^1.4.0, async@^1.5.2: version "1.5.2" resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" @@ -568,6 +574,12 @@ async@^2.1.2, async@^2.1.5, async@^2.4.1, async@^2.5.0: dependencies: lodash "^4.14.0" +async@^2.1.4: + version "2.6.0" + resolved "https://registry.yarnpkg.com/async/-/async-2.6.0.tgz#61a29abb6fcc026fea77e56d1c6ec53a795951f4" + dependencies: + lodash "^4.14.0" + async@~0.2.6: version "0.2.10" resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1" @@ -1218,7 +1230,7 @@ colors@1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/colors/-/colors-1.0.3.tgz#0433f44d809680fdeb60ed260f1b0c262e82a40b" -colors@^1.1.0, colors@^1.1.2, colors@~1.1.2: +colors@1.1.2, colors@^1.1.0, colors@^1.1.2, colors@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/colors/-/colors-1.1.2.tgz#168a4701756b6a7f51a12ce0c97bfa28c084ed63" @@ -1703,6 +1715,12 @@ deep-extend@~0.4.0: version "0.4.2" resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f" +default-require-extensions@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-1.0.0.tgz#f37ea15d3e13ffd9b437d33e1a75b5fb97874cb8" + dependencies: + strip-bom "^2.0.0" + define-properties@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94" @@ -2419,6 +2437,13 @@ filename-regex@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" +fileset@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/fileset/-/fileset-2.0.3.tgz#8e7548a96d3cc2327ee5e674168723a333bba2a0" + dependencies: + glob "^7.0.3" + minimatch "^3.0.3" + fill-range@^2.1.0: version "2.2.3" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.3.tgz#50b77dfd7e469bc7492470963699fe7a8485a723" @@ -2790,6 +2815,16 @@ handlebars@^1.3.0: optionalDependencies: uglify-js "~2.3" +handlebars@^4.0.3: + version "4.0.11" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.11.tgz#630a35dfe0294bc281edae6ffc5d329fc7982dcc" + dependencies: + async "^1.4.0" + optimist "^0.6.1" + source-map "^0.4.4" + optionalDependencies: + uglify-js "^2.6" + har-schema@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-1.0.5.tgz#d263135f43307c02c602afc8fe95970c0151369e" @@ -3412,6 +3447,22 @@ isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" +istanbul-api@^1.1.14: + version "1.2.1" + resolved "https://registry.yarnpkg.com/istanbul-api/-/istanbul-api-1.2.1.tgz#0c60a0515eb11c7d65c6b50bba2c6e999acd8620" + dependencies: + async "^2.1.4" + fileset "^2.0.2" + istanbul-lib-coverage "^1.1.1" + istanbul-lib-hook "^1.1.0" + istanbul-lib-instrument "^1.9.1" + istanbul-lib-report "^1.1.2" + istanbul-lib-source-maps "^1.2.2" + istanbul-reports "^1.1.3" + js-yaml "^3.7.0" + mkdirp "^0.5.1" + once "^1.4.0" + istanbul-instrumenter-loader@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/istanbul-instrumenter-loader/-/istanbul-instrumenter-loader-2.0.0.tgz#e5492900ab0bba835efa8024cb00be9b3eea2700" @@ -3425,7 +3476,13 @@ istanbul-lib-coverage@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz#73bfb998885299415c93d38a3e9adf784a77a9da" -istanbul-lib-instrument@^1.1.3: +istanbul-lib-hook@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-1.1.0.tgz#8538d970372cb3716d53e55523dd54b557a8d89b" + dependencies: + append-transform "^0.4.0" + +istanbul-lib-instrument@^1.1.3, istanbul-lib-instrument@^1.9.1: version "1.9.1" resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.9.1.tgz#250b30b3531e5d3251299fdd64b0b2c9db6b558e" dependencies: @@ -3437,6 +3494,31 @@ istanbul-lib-instrument@^1.1.3: istanbul-lib-coverage "^1.1.1" semver "^5.3.0" +istanbul-lib-report@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-1.1.2.tgz#922be27c13b9511b979bd1587359f69798c1d425" + dependencies: + istanbul-lib-coverage "^1.1.1" + mkdirp "^0.5.1" + path-parse "^1.0.5" + supports-color "^3.1.2" + +istanbul-lib-source-maps@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.2.tgz#750578602435f28a0c04ee6d7d9e0f2960e62c1c" + dependencies: + debug "^3.1.0" + istanbul-lib-coverage "^1.1.1" + mkdirp "^0.5.1" + rimraf "^2.6.1" + source-map "^0.5.3" + +istanbul-reports@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.1.3.tgz#3b9e1e8defb6d18b1d425da8e8b32c5a163f2d10" + dependencies: + handlebars "^4.0.3" + jasmine-core@~2.4.0, jasmine-core@~2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.4.1.tgz#6f83ab3a0f16951722ce07d206c773d57cc838be" @@ -3445,6 +3527,12 @@ jasmine-core@~2.8.0: version "2.8.0" resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.8.0.tgz#bcc979ae1f9fd05701e45e52e65d3a5d63f1a24e" +jasmine-spec-reporter@^4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/jasmine-spec-reporter/-/jasmine-spec-reporter-4.2.1.tgz#1d632aec0341670ad324f92ba84b4b32b35e9e22" + dependencies: + colors "1.1.2" + jasmine@^2.5.3: version "2.8.0" resolved "https://registry.yarnpkg.com/jasmine/-/jasmine-2.8.0.tgz#6b089c0a11576b1f16df11b80146d91d4e8b8a3e" @@ -3473,7 +3561,7 @@ js-tokens@^3.0.0, js-tokens@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" -js-yaml@^3.4.3: +js-yaml@^3.4.3, js-yaml@^3.7.0: version "3.10.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc" dependencies: @@ -3573,6 +3661,13 @@ karma-cli@^1.0.1: dependencies: resolve "^1.1.6" +karma-coverage-istanbul-reporter@^1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/karma-coverage-istanbul-reporter/-/karma-coverage-istanbul-reporter-1.3.3.tgz#daf26051d5a0daa5838a4ce81aa4a41724bdf36b" + dependencies: + istanbul-api "^1.1.14" + minimatch "^3.0.4" + karma-jasmine-html-reporter@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/karma-jasmine-html-reporter/-/karma-jasmine-html-reporter-0.2.2.tgz#48a8e5ef18807617ee2b5e33c1194c35b439524c" @@ -4017,7 +4112,7 @@ minimatch@0.3: lru-cache "2" sigmund "~1.0.0" -"minimatch@2 || 3", minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.4, minimatch@~3.0.2: +"minimatch@2 || 3", minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4, minimatch@~3.0.2: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" dependencies: @@ -5903,7 +5998,7 @@ source-map@0.5.x, source-map@^0.5.1, source-map@^0.5.3, source-map@^0.5.6, sourc version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" -source-map@^0.4.2, source-map@~0.4.1: +source-map@^0.4.2, source-map@^0.4.4, source-map@~0.4.1: version "0.4.4" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" dependencies: @@ -6139,7 +6234,7 @@ supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" -supports-color@^3.2.3: +supports-color@^3.1.2, supports-color@^3.2.3: version "3.2.3" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" dependencies: @@ -6404,7 +6499,7 @@ uglify-js@3.1.x: commander "~2.11.0" source-map "~0.6.1" -uglify-js@^2.6.1, uglify-js@^2.8.29: +uglify-js@^2.6, uglify-js@^2.6.1, uglify-js@^2.8.29: version "2.8.29" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" dependencies: From 451bdb9a75bacc3c3a332f8272ed2f4b4c18c745 Mon Sep 17 00:00:00 2001 From: Vani Date: Wed, 17 Jan 2018 21:06:43 -0800 Subject: [PATCH 11/47] docs: change titles to sentence case (#21620) PR Close #21620 --- aio/content/guide/service-worker-communications.md | 2 +- aio/content/guide/service-worker-config.md | 2 +- aio/content/guide/service-worker-devops.md | 2 +- aio/content/guide/service-worker-getting-started.md | 2 +- aio/content/guide/service-worker-intro.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/aio/content/guide/service-worker-communications.md b/aio/content/guide/service-worker-communications.md index 62f327b1f2509..3a45b697b247f 100644 --- a/aio/content/guide/service-worker-communications.md +++ b/aio/content/guide/service-worker-communications.md @@ -1,4 +1,4 @@ -# Service Worker Communication +# Service worker communication Importing `ServiceWorkerModule` into your `AppModule` doesn't just register the service worker, it also provides a few services you can use to interact with the service worker and control the caching of your app. diff --git a/aio/content/guide/service-worker-config.md b/aio/content/guide/service-worker-config.md index aacd04b1fb969..fbebe370fefbc 100644 --- a/aio/content/guide/service-worker-config.md +++ b/aio/content/guide/service-worker-config.md @@ -1,6 +1,6 @@ {@a glob} -# Service Worker Configuration +# Service worker configuration #### Prerequisites diff --git a/aio/content/guide/service-worker-devops.md b/aio/content/guide/service-worker-devops.md index 85c09f5b0196e..f9ae460a91524 100644 --- a/aio/content/guide/service-worker-devops.md +++ b/aio/content/guide/service-worker-devops.md @@ -1,4 +1,4 @@ -# Service Worker in Production +# Service worker in production This page is a reference for deploying and supporting production apps that use the Angular service worker. It explains how the Angular service worker fits into the larger production environment, the service worker's behavior under various conditions, and available recourses and fail-safes. diff --git a/aio/content/guide/service-worker-getting-started.md b/aio/content/guide/service-worker-getting-started.md index 915dbcccbbc05..ffe7c2a9f109d 100644 --- a/aio/content/guide/service-worker-getting-started.md +++ b/aio/content/guide/service-worker-getting-started.md @@ -1,4 +1,4 @@ -# Getting Started with Service Workers +# Getting started with service workers #### Prerequisites diff --git a/aio/content/guide/service-worker-intro.md b/aio/content/guide/service-worker-intro.md index b7bcf23f33afe..679ed0b9fc14b 100644 --- a/aio/content/guide/service-worker-intro.md +++ b/aio/content/guide/service-worker-intro.md @@ -1,4 +1,4 @@ -# Angular Service Worker Introduction +# Angular service worker introduction Service workers augment the traditional web deployment model and empower applications to deliver a user experience with the reliability and performance on par with natively-installed code. From b5fc3eb9dee6cbcdfa4cab52eee2d7e4e8995688 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Wed, 17 Jan 2018 14:43:18 +0200 Subject: [PATCH 12/47] docs: minor fixes (anchor tags, redundant whitespace, consistent code-snippets lang) (#21589) PR Close #21589 --- aio/content/guide/aot-compiler.md | 434 +++++++++++++------------- aio/content/guide/bootstrapping.md | 61 ++-- aio/content/guide/docs-style-guide.md | 7 +- aio/content/guide/http.md | 60 ++-- 4 files changed, 281 insertions(+), 281 deletions(-) diff --git a/aio/content/guide/aot-compiler.md b/aio/content/guide/aot-compiler.md index d72caaffb9619..8b53f57585dbc 100644 --- a/aio/content/guide/aot-compiler.md +++ b/aio/content/guide/aot-compiler.md @@ -78,172 +78,172 @@ With no templates to read and no risky client-side HTML or JavaScript evaluation there are fewer opportunities for injection attacks. {@a compiler-options} - - ## Angular Compiler Options - - You can control your app compilation by providing template compiler options in the `tsconfig.json` file along with the options supplied to the TypeScript compiler. The template compiler options are specified as members of - `"angularCompilerOptions"` object as shown below: - - ```json - { - "compilerOptions": { - "experimentalDecorators": true, - ... - }, - "angularCompilerOptions": { - "fullTemplateTypeCheck": true, - "preserveWhiteSpace": false, - ... - } + +## Angular Compiler Options + +You can control your app compilation by providing template compiler options in the `tsconfig.json` file along with the options supplied to the TypeScript compiler. The template compiler options are specified as members of +`"angularCompilerOptions"` object as shown below: + +```json +{ + "compilerOptions": { + "experimentalDecorators": true, + ... + }, + "angularCompilerOptions": { + "fullTemplateTypeCheck": true, + "preserveWhiteSpace": false, + ... } - ``` - - ### *skipMetadataEmit* - - This option tells the compiler not to produce `.metadata.json` files. - The option is `false` by default. - - `.metadata.json` files contain infomration needed by the template compiler from a `.ts` - file that is not included in the `.d.ts` file produced by the TypeScript compiler. This information contains, - for example, the content of annotations (such as a component's template) which TypeScript - emits to the `.js` file but not to the `.d.ts` file. - - This option should be set to `true` if using TypeScript's `--outFile` option, as the metadata files - are not valid for this style of TypeScript output. It is not recommeded to use `--outFile` with - Angular. Use a bundler, such as [webpack](https://webpack.js.org/), instead. - - This option can also be set to `true` when using factory summaries as the factory summaries - include a copy of the information that is in the `.metadata.json` file. - - ### *strictMetadataEmit* - - This option tells the template compiler to report an error to the `.metadata.json` - file if `"skipMetadataEmit"` is `false` . This option is `false` by default. This should only be used when `"skipMetadataEmit"` is `false` and `"skipTemplateCodeGen"` is `true`. - - It is intended to validate the `.metadata.json` files emitted for bundling with an `npm` package. The validation is overly strict and can emit errors for metadata that would never produce an error when used by the template compiler. You can choose to suppress the error emitted by this option for an exported symbol by including `@dynamic` in the comment documenting the symbol. - - It is valid for `.metadata.json` files to contain errors. The template compiler reports these errors - if the metadata is used to determine the contents of an annotation. The metadata - collector cannot predict the symbols that are designed to use in an annotation, so it will preemptively - include error nodes in the metadata for the exported symbols. The template compiler can then use the error - nodes to report an error if these symbols are used. If the client of a library intends to use a symbol in an annotation, the template compiler will not normally report - this until the client uses the symbol. This option allows detecting these errors during the build phase of - the library and is used, for example, in producing Angular libraries themselves. - - ### *skipTemplateCodegen* - - This option tells the compiler to suppress emitting `.ngfactory.js` and `.ngstyle.js` files. When set, - this turns off most of the template compiler and disables reporting template diagnostics. - This option can be used to instruct the - template compiler to produce `.metadata.json` files for distribution with an `npm` package while - avoiding the production of `.ngfactory.js` and `.ngstyle.js` files that cannot be distributed to - `npm`. - - ### *strictInjectionParameters* - - When set to `true`, this options tells the compiler to report an error for a parameter supplied - whose injection type cannot be determined. When this value option is not provided or is `false`, constructor parameters of classes marked with `@Injectable` whose type cannot be resolved will - produce a warning. - - *Note*: It is recommended to change this option explicitly to `true` as this option will default to `true` in the future. - - ### *flatModuleOutFile* - - When set to `true`, this option tells the template compiler to generate a flat module - index of the given file name and the corresponding flat module metadata. Use this option when creating - flat modules that are packaged similarly to `@angular/core` and `@angular/common`. When this option - is used, the `package.json` for the library should refer - to the generated flat module index instead of the library index file. With this - option only one `.metadata.json` file is produced that contains all the metadata necessary - for symbols exported from the library index. In the generated `.ngfactory.js` files, the flat - module index is used to import symbols that includes both the public API from the library index - as well as shrowded internal symbols. - - By default the `.ts` file supplied in the `files` field is assumed to be library index. - If more than one `.ts` file is specified, `libraryIndex` is used to select the file to use. - If more than one `.ts` file is supplied without a `libraryIndex`, an error is produced. A flat module - index `.d.ts` and `.js` will be created with the given `flatModuleOutFile` name in the same - location as the library index `.d.ts` file. For example, if a library uses - `public_api.ts` file as the library index of the module, the `tsconfig.json` `files` field - would be `["public_api.ts"]`. The `flatModuleOutFile` options could then be set to, for - example `"index.js"`, which produces `index.d.ts` and `index.metadata.json` files. The - library's `package.json`'s `module` field would be `"index.js"` and the `typings` field - would be `"index.d.ts"`. - - ### *flatModuleId* - - This option specifies the preferred module id to use for importing a flat module. - References generated by the template compiler will use this module name when importing symbols - from the flat module. - This is only meaningful when `flatModuleOutFile` is also supplied. Otherwise the compiler ignores - this option. - - ### *generateCodeForLibraries* - - This option tells the template compiler to generate factory files (`.ngfactory.js` and `.ngstyle.js`) - for `.d.ts` files with a corresponding `.metadata.json` file. This option defaults to - `true`. When this option is `false`, factory files are generated only for `.ts` files. - - This option should be set to `false` when using factory summaries. - - ### *fullTemplateTypeCheck* - - This option tells the compiler to enable the [binding expression validation](#binding-expresion-validation) - phase of the template compiler which uses TypeScript to validate binding expressions. - - This option is `false` by default. - - *Note*: It is recommended to set this to `true` as this option will default to `true` in the future. - - ### *annotateForClosureCompiler* - - This option tells the compiler to use [Tsickle](https://github.com/angular/tsickle) to annotate the emitted - JavaScript with [JsDoc](http://usejsdoc.org/) comments needed by the - [Closure Compiler](https://github.com/google/closure-compiler). This option defaults to `false`. - - ### *annotationsAs* - - Use this option to modify how the Angular specific annotations are emitted to improve tree-shaking. Non-Angular - annotations and decorators are unnaffected. Default is `static fields`. - - value | description - ----------------|------------------------------------------------------------- - `decorators` | Leave the Decorators in-place. This makes compilation faster. TypeScript will emit calls to the __decorate helper. Use `--emitDecoratorMetadata` for runtime reflection. However, the resulting code will not properly tree-shake. - `static fields` | Replace decorators with a static field in the class. Allows advanced tree-shakers like [Closure Compiler](https://github.com/google/closure-compiler) to remove unused classes. - - ### *trace* - - This tells the compiler to print extra information while compiling templates. - - ### *enableLegacyTemplate* - - The use of `