Compare commits
96 Commits
labs/route
...
5.2.0
Author | SHA1 | Date | |
---|---|---|---|
04dd9713f0 | |||
48d579b2ae | |||
3db91ffd96 | |||
229b76cfde | |||
80a5b91575 | |||
9728dce048 | |||
463e2872a6 | |||
fa03ae14b0 | |||
27196b676b | |||
6040ee39eb | |||
74dbf7bad5 | |||
7269fe5203 | |||
8e80db4982 | |||
e99475260f | |||
b15d50af9b | |||
db55e86e91 | |||
a2f3f4550d | |||
d2cfc6a719 | |||
fecf768f43 | |||
2fc4cf67be | |||
f9436f7a5b | |||
e726d81822 | |||
6cd4b1b41c | |||
24df08efc7 | |||
4f1a571ba6 | |||
c8d2e0a3bc | |||
b5934fc582 | |||
2402224b4e | |||
03d16fcd24 | |||
dcc3eba962 | |||
6588ca8a6c | |||
81823e89cd | |||
ef78538a06 | |||
ccea37256e | |||
cdc66f6164 | |||
5bceb89a7f | |||
2582eca265 | |||
3e47ea27f5 | |||
d365077dfa | |||
bc7a6d7b00 | |||
9f538a6cac | |||
3750ea9dff | |||
afd89ed8d9 | |||
a62371c0eb | |||
c516bc3b35 | |||
8bf1305490 | |||
d8abf70f1f | |||
efd9c09456 | |||
a66cd526c3 | |||
a0ffdf1ef2 | |||
83d207d0a7 | |||
83c1383701 | |||
c66283ad66 | |||
ae97920fe2 | |||
533a010b28 | |||
6b81d1c9b9 | |||
fefc081e1b | |||
bdee1f4a25 | |||
40dfe39e64 | |||
3d50fd7cac | |||
cc1058f6e1 | |||
47e251a80a | |||
47bcb5bc35 | |||
f3fc74ab67 | |||
86a36eaadd | |||
5ba1cf1063 | |||
07b81ae741 | |||
5a7bf36723 | |||
66528a21f6 | |||
a77757277b | |||
4f05d022c1 | |||
5df343169e | |||
764fea1344 | |||
bbdea96a66 | |||
d1de587ce0 | |||
147aec43bd | |||
1f5049f30c | |||
09e3839994 | |||
19eeba2281 | |||
6cc8f2298e | |||
83b27bac17 | |||
b462f49ce7 | |||
1a9064ba2b | |||
5bc869cb24 | |||
8fdb1e09c1 | |||
f3d38ce053 | |||
05953b3b83 | |||
f75296e04e | |||
0867e85163 | |||
93b00cceb6 | |||
0fa818b318 | |||
bc66d27938 | |||
6a5818454f | |||
27fc458ef6 | |||
0487a9f140 | |||
871ece6123 |
@ -12,8 +12,8 @@
|
||||
## IMPORTANT
|
||||
# If you change the `docker_image` version, also change the `cache_key` suffix and the version of
|
||||
# `com_github_bazelbuild_buildtools` in the `/WORKSPACE` file.
|
||||
var_1: &docker_image angular/ngcontainer:0.0.8
|
||||
var_2: &cache_key angular-{{ .Branch }}-{{ checksum "yarn.lock" }}-0.0.8
|
||||
var_1: &docker_image angular/ngcontainer:0.1.0
|
||||
var_2: &cache_key angular-{{ .Branch }}-{{ checksum "yarn.lock" }}-0.1.0
|
||||
|
||||
# Settings common to each job
|
||||
anchor_1: &job_defaults
|
||||
@ -38,7 +38,10 @@ jobs:
|
||||
# Then we don't need any exclude pattern to avoid checking those files
|
||||
- run: 'buildifier -mode=check $(find . -type f \( -name BUILD.bazel -or -name BUILD \)) ||
|
||||
(echo "BUILD files not formatted. Please run ''yarn buildifier''" ; exit 1)'
|
||||
|
||||
# Run the skylark linter to check our Bazel rules
|
||||
- run: 'find . -type f -name "*.bzl" |
|
||||
xargs java -jar /usr/local/bin/Skylint_deploy.jar ||
|
||||
(echo -e "\n.bzl files have lint errors. Please run ''yarn skylint''"; exit 1)'
|
||||
- restore_cache:
|
||||
key: *cache_key
|
||||
|
||||
@ -47,12 +50,13 @@ jobs:
|
||||
|
||||
build:
|
||||
<<: *job_defaults
|
||||
resource_class: large
|
||||
steps:
|
||||
- checkout:
|
||||
<<: *post_checkout
|
||||
- restore_cache:
|
||||
key: *cache_key
|
||||
|
||||
|
||||
- run: bazel info release
|
||||
- run: bazel run @yarn//:yarn
|
||||
# Use bazel query so that we explicitly ask for all buildable targets to be built as well
|
||||
|
@ -15,7 +15,6 @@
|
||||
# hansl - Hans Larsen
|
||||
# IgorMinar - Igor Minar
|
||||
# jasonaden - Jason Aden
|
||||
# juleskremer - Jules Kremer
|
||||
# kara - Kara Erickson
|
||||
# matsko - Matias Niemelä
|
||||
# mhevery - Misko Hevery
|
||||
@ -35,14 +34,32 @@ group_defaults:
|
||||
enabled: true
|
||||
approve_by_comment:
|
||||
enabled: false
|
||||
# see http://docs.pullapprove.com/groups/author_approval/
|
||||
author_approval:
|
||||
# If the author is a reviewer on the PR, they will automatically have an "approved" status.
|
||||
auto: true
|
||||
|
||||
groups:
|
||||
# Require all PRs to have at least one approval from *someone*
|
||||
all:
|
||||
users: all
|
||||
required: 1
|
||||
# In this group, your self-approval does not count
|
||||
author_approval:
|
||||
auto: false
|
||||
ignored: true
|
||||
files:
|
||||
include:
|
||||
- "*"
|
||||
|
||||
root:
|
||||
conditions:
|
||||
files:
|
||||
include:
|
||||
- "*"
|
||||
exclude:
|
||||
- "WORKSPACE"
|
||||
- "BUILD.bazel"
|
||||
- ".circleci/*"
|
||||
- "aio/*"
|
||||
- "integration/*"
|
||||
@ -70,6 +87,7 @@ groups:
|
||||
- "*.bazel"
|
||||
- "*.bzl"
|
||||
- "packages/bazel/*"
|
||||
- "tools/bazel.rc"
|
||||
users:
|
||||
- alexeagle #primary
|
||||
- chuckjaz
|
||||
@ -85,6 +103,7 @@ groups:
|
||||
- "*.lock"
|
||||
- "tools/*"
|
||||
exclude:
|
||||
- "tools/bazel.rc"
|
||||
- "tools/public_api_guard/*"
|
||||
- "aio/*"
|
||||
users:
|
||||
@ -280,7 +299,7 @@ groups:
|
||||
files:
|
||||
- "packages/benchpress/*"
|
||||
users:
|
||||
# needs primary
|
||||
- alxhub # primary
|
||||
# needs secondary
|
||||
- IgorMinar #fallback
|
||||
- mhevery #fallback
|
||||
@ -308,9 +327,8 @@ groups:
|
||||
- "aio/content/navigation.json"
|
||||
- "aio/content/license.md"
|
||||
users:
|
||||
- juleskremer #primary
|
||||
- Foxandxss
|
||||
- stephenfluin
|
||||
- Foxandxss
|
||||
- petebacondarwin
|
||||
- gkalpak
|
||||
- IgorMinar #fallback
|
||||
@ -324,7 +342,6 @@ groups:
|
||||
- "aio/content/navigation.json"
|
||||
- "aio/content/license.md"
|
||||
users:
|
||||
- juleskremer #primary
|
||||
- stephenfluin
|
||||
- petebacondarwin
|
||||
- gkalpak
|
||||
|
@ -1,5 +1,7 @@
|
||||
language: node_js
|
||||
sudo: false
|
||||
# Work-around for https://github.com/travis-ci/travis-ci/issues/8836#issuecomment-356362524.
|
||||
# (Restore `sudo: false` once that is resolved.)
|
||||
sudo: required
|
||||
dist: trusty
|
||||
node_js:
|
||||
- '8.9.1'
|
||||
|
27
BUILD.bazel
27
BUILD.bazel
@ -1,6 +1,8 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
exports_files(["tsconfig.json"])
|
||||
exports_files([
|
||||
"tsconfig.json",
|
||||
])
|
||||
|
||||
# This rule belongs in node_modules/BUILD
|
||||
# It's here as a workaround for
|
||||
@ -38,3 +40,26 @@ filegroup(
|
||||
"*.d.ts",
|
||||
]]),
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "web_test_bootstrap_scripts",
|
||||
# do not sort
|
||||
srcs = [
|
||||
"//:node_modules/reflect-metadata/Reflect.js",
|
||||
"//:node_modules/zone.js/dist/zone.js",
|
||||
"//:node_modules/zone.js/dist/async-test.js",
|
||||
"//:node_modules/zone.js/dist/sync-test.js",
|
||||
"//:node_modules/zone.js/dist/fake-async-test.js",
|
||||
"//:node_modules/zone.js/dist/proxy.js",
|
||||
"//:node_modules/zone.js/dist/jasmine-patch.js",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "angularjs",
|
||||
# do not sort
|
||||
srcs = [
|
||||
"//:node_modules/angular/angular.js",
|
||||
"//:node_modules/angular-mocks/angular-mocks.js",
|
||||
],
|
||||
)
|
||||
|
41
CHANGELOG.md
41
CHANGELOG.md
@ -1,3 +1,42 @@
|
||||
<a name="5.2.0"></a>
|
||||
# [5.2.0](https://github.com/angular/angular/compare/5.2.0-rc.0...5.2.0) (2018-01-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **bazel:** Give correct module names for ES6 output ([#21320](https://github.com/angular/angular/issues/21320)) ([9728dce](https://github.com/angular/angular/commit/9728dce)), closes [#21022](https://github.com/angular/angular/issues/21022)
|
||||
* **benchpress:** forward compat with selenium_webdriver 3.6.0 ([#21399](https://github.com/angular/angular/issues/21399)) ([6040ee3](https://github.com/angular/angular/commit/6040ee3))
|
||||
* **benchpress:** work around missing events from Chrome 63 ([#21396](https://github.com/angular/angular/issues/21396)) ([fa03ae1](https://github.com/angular/angular/commit/fa03ae1))
|
||||
* **common:** export currencies via `getCurrencySymbol` ([#20983](https://github.com/angular/angular/issues/20983)) ([fecf768](https://github.com/angular/angular/commit/fecf768))
|
||||
|
||||
|
||||
<a name="5.2.0-rc.0"></a>
|
||||
# [5.2.0-rc.0](https://github.com/angular/angular/compare/5.2.0-beta.1...5.2.0-rc.0) (2018-01-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **animations:** avoid infinite loop with multiple blocked sub triggers ([#21119](https://github.com/angular/angular/issues/21119)) ([86a36ea](https://github.com/angular/angular/commit/86a36ea))
|
||||
* **animations:** renaming issue with DOMAnimation. ([#21125](https://github.com/angular/angular/issues/21125)) ([871ece6](https://github.com/angular/angular/commit/871ece6))
|
||||
* **common:** handle JS floating point errors in percent pipe ([#20329](https://github.com/angular/angular/issues/20329)) ([07b81ae](https://github.com/angular/angular/commit/07b81ae)), closes [#20136](https://github.com/angular/angular/issues/20136)
|
||||
* **language-service:** ignore null metadatas ([#20557](https://github.com/angular/angular/issues/20557)) ([3e47ea2](https://github.com/angular/angular/commit/3e47ea2)), closes [#20260](https://github.com/angular/angular/issues/20260)
|
||||
* **router:** fix wildcard route with lazy loaded module (again) ([#18139](https://github.com/angular/angular/issues/18139)) ([5ba1cf1](https://github.com/angular/angular/commit/5ba1cf1)), closes [#13848](https://github.com/angular/angular/issues/13848)
|
||||
|
||||
|
||||
|
||||
<a name="5.1.3"></a>
|
||||
## [5.1.3](https://github.com/angular/angular/compare/5.1.2...5.1.3) (2018-01-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **animations:** avoid infinite loop with multiple blocked sub triggers ([#21119](https://github.com/angular/angular/issues/21119)) ([3e34fa8](https://github.com/angular/angular/commit/3e34fa8))
|
||||
* **animations:** renaming issue with DOMAnimation. ([#21125](https://github.com/angular/angular/issues/21125)) ([d1f4500](https://github.com/angular/angular/commit/d1f4500))
|
||||
* **common:** handle JS floating point errors in percent pipe ([#20329](https://github.com/angular/angular/issues/20329)) ([fa0e8ef](https://github.com/angular/angular/commit/fa0e8ef)), closes [#20136](https://github.com/angular/angular/issues/20136)
|
||||
* **language-service:** ignore null metadatas ([#20557](https://github.com/angular/angular/issues/20557)) ([48a1f32](https://github.com/angular/angular/commit/48a1f32)), closes [#20260](https://github.com/angular/angular/issues/20260)
|
||||
* **router:** fix wildcard route with lazy loaded module (again) ([#18139](https://github.com/angular/angular/issues/18139)) ([8c99175](https://github.com/angular/angular/commit/8c99175)), closes [#13848](https://github.com/angular/angular/issues/13848)
|
||||
|
||||
|
||||
<a name="5.2.0-beta.1"></a>
|
||||
# [5.2.0-beta.1](https://github.com/angular/angular/compare/5.2.0-beta.0...5.2.0-beta.1) (2017-12-20)
|
||||
|
||||
@ -60,7 +99,7 @@
|
||||
* **compiler-cli:** disable checkTypes in emit. ([#20828](https://github.com/angular/angular/issues/20828)) ([160a154](https://github.com/angular/angular/commit/160a154))
|
||||
* **compiler-cli:** fix swallowed Error messages ([#20846](https://github.com/angular/angular/issues/20846)) ([6727336](https://github.com/angular/angular/commit/6727336))
|
||||
* **compiler-cli:** merge [@fileoverview](https://github.com/fileoverview) comments. ([#20870](https://github.com/angular/angular/issues/20870)) ([be9a737](https://github.com/angular/angular/commit/be9a737))
|
||||
* **router:** NavigatonError and NavigationCancel should be emitted after resetting the URL ([#20803](https://github.com/angular/angular/issues/20803)) ([baeec4d](https://github.com/angular/angular/commit/baeec4d))
|
||||
* **router:** NavigationError and NavigationCancel should be emitted after resetting the URL ([#20803](https://github.com/angular/angular/issues/20803)) ([baeec4d](https://github.com/angular/angular/commit/baeec4d))
|
||||
|
||||
|
||||
|
||||
|
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2014-2017 Google, Inc. http://angular.io
|
||||
Copyright (c) 2014-2018 Google, Inc. http://angular.io
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -2,8 +2,6 @@
|
||||
[](https://circleci.com/gh/angular/angular/tree/master)
|
||||
[](https://www.browserstack.com/automate/public-build/LzF3RzBVVGt6VWE2S0hHaC9uYllOZz09LS1BVjNTclBKV0x4eVRlcjA4QVY1M0N3PT0=--eb4ce8c8dc2c1c5b2b5352d473ee12a73ac20e06)
|
||||
[](https://gitter.im/angular/angular?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](http://issuestats.com/github/angular/angular)
|
||||
[](http://issuestats.com/github/angular/angular)
|
||||
[](https://www.npmjs.com/@angular/core)
|
||||
|
||||
|
||||
|
17
WORKSPACE
17
WORKSPACE
@ -10,18 +10,19 @@ git_repository(
|
||||
|
||||
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories")
|
||||
|
||||
check_bazel_version("0.8.1")
|
||||
check_bazel_version("0.9.0")
|
||||
node_repositories(package_json = ["//:package.json"])
|
||||
|
||||
git_repository(
|
||||
name = "build_bazel_rules_typescript",
|
||||
remote = "https://github.com/bazelbuild/rules_typescript.git",
|
||||
tag = "0.6.0",
|
||||
# tag = "0.7.1+",
|
||||
commit = "89d2c75066bea3d9c942f29dd1d2ea543c58d6d5"
|
||||
)
|
||||
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_repositories")
|
||||
load("@build_bazel_rules_typescript//:setup.bzl", "ts_setup_workspace")
|
||||
|
||||
ts_repositories()
|
||||
ts_setup_workspace()
|
||||
|
||||
local_repository(
|
||||
name = "angular",
|
||||
@ -53,3 +54,11 @@ load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_too
|
||||
go_rules_dependencies()
|
||||
|
||||
go_register_toolchains()
|
||||
|
||||
# Fetching the Bazel source code allows us to compile the Skylark linter
|
||||
http_archive(
|
||||
name = "io_bazel",
|
||||
url = "https://github.com/bazelbuild/bazel/archive/9755c72b48866ed034bd28aa033e9abd27431b1e.zip",
|
||||
strip_prefix = "bazel-9755c72b48866ed034bd28aa033e9abd27431b1e",
|
||||
sha256 = "5b8443fc3481b5fcd9e7f348e1dd93c1397f78b223623c39eb56494c55f41962",
|
||||
)
|
||||
|
@ -130,7 +130,7 @@ function tests() {
|
||||
it('can get RouterLinks from template', () => {
|
||||
expect(links.length).toBe(3, 'should have 3 links');
|
||||
expect(links[0].linkParams).toBe('/dashboard', '1st link should go to Dashboard');
|
||||
expect(links[1].linkParams).toBe('/heroes', '1st link should go to Heroes');
|
||||
expect(links[1].linkParams).toBe('/heroes', '2nd link should go to Heroes');
|
||||
});
|
||||
|
||||
it('can click Heroes link in template', () => {
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
The Angular Ahead-of-Time (AOT) compiler converts your Angular HTML and TypeScript code into efficient JavaScript code during the build phase _before_ the browser downloads and runs that code.
|
||||
|
||||
This guide explains how to build with the AOT compiler and how to write Angular metadata that AOT can compile.
|
||||
This guide explains how to build with the AOT compiler using different compiler options and how to write Angular metadata that AOT can compile.
|
||||
|
||||
<div class="l-sub-section">
|
||||
|
||||
@ -77,6 +77,174 @@ AOT compiles HTML templates and components into JavaScript files long before the
|
||||
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,
|
||||
...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### *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 `<template>` element was deprecated starting in Angular 4.0 in favor of using
|
||||
`<ng-template>` to avoid colliding with the DOM's element of the same name. Setting this option to
|
||||
`true` enables the use of the deprecated `<template>` element . This option
|
||||
is `false` by default. This option might be required by some third-party Angular libraries.
|
||||
|
||||
### *disableExpressionLowering*
|
||||
|
||||
The Angular template compiler transforms code that is used, or could be used, in an annotation
|
||||
to allow it to be imported from template factory modules. See
|
||||
[metadata rewriting](#metadata-rewriting) for more information.
|
||||
|
||||
Setting this option to `false` disables this rewriting, requiring the rewriting to be
|
||||
done manually.
|
||||
|
||||
### *preserveWhitespaces*
|
||||
|
||||
This option tells the compiler whether to remove blank text nodes from compiled templates.
|
||||
This option is `true` by default.
|
||||
|
||||
*Note*: It is recommended to set this explicitly to `false` as it emits smaller template factory modules and might be set to `false` by default in the future.
|
||||
|
||||
### *allowEmptyCodegenFiles*
|
||||
|
||||
Tells the compiler to generate all the possible generated files even if they are empty. This option is
|
||||
`false` by default. This is an option used by `bazel` build rules and is needed to simplify
|
||||
how `bazel` rules track file dependencies. It is not recommended to use this option outside of the `bazel`
|
||||
rules.
|
||||
|
||||
## Angular Metadata and AOT
|
||||
|
||||
The Angular **AOT compiler** extracts and interprets **metadata** about the parts of the application that Angular is supposed to manage.
|
||||
@ -212,6 +380,7 @@ export function serverFactory() {
|
||||
|
||||
Beginning in version 5, the compiler automatically performs this rewritting while emitting the `.js` file.
|
||||
|
||||
{@a function-calls}
|
||||
### Limited function calls
|
||||
|
||||
The _collector_ can represent a function call or object creation with `new` as long as the syntax is valid. The _collector_ only cares about proper syntax.
|
||||
@ -411,6 +580,7 @@ The Angular [`RouterModule`](api/router/RouterModule) exports two macro static m
|
||||
Review the [source code](https://github.com/angular/angular/blob/master/packages/router/src/router_module.ts#L139 "RouterModule.forRoot source code")
|
||||
for these methods to see how macros can simplify configuration of complex [NgModules](guide/ngmodule).
|
||||
|
||||
{@ metadata-rewriting}
|
||||
### Metadata rewriting
|
||||
|
||||
The compiler treats object literals containing the fields `useClass`, `useValue`, `useFactory`, and `data` specially. The compiler converts the expression initializing one of these fields into an exported variable, which replaces the expression. This process of rewriting these expressions removes all the restrictions on what can be in them because
|
||||
@ -961,7 +1131,155 @@ This error can occur if you use an expression in the `extends` clause of a class
|
||||
Chuck: After reviewing your PR comment I'm still at a loss. See [comment there](https://github.com/angular/angular/pull/17712#discussion_r132025495).
|
||||
|
||||
-->
|
||||
{@a binding-expresion-validation}
|
||||
|
||||
## Phase 3: binding expression validation
|
||||
|
||||
In the validation phase, the Angular template compiler uses the TypeScript compiler to validate the
|
||||
binding expressions in templates. Enable this phase explicity by adding the compiler
|
||||
option `"fullTemplateTypeCheck"` in the `"angularCompilerOptions"` of the project's `tsconfig.json` (see
|
||||
[Angular Compiler Options](#compiler-options)).
|
||||
|
||||
Template validation produces error messages when a type error is detected in a template binding
|
||||
expression, similar to how type errors are reported by the TypeScript compiler against code in a `.ts`
|
||||
file.
|
||||
|
||||
For example, consider the following component:
|
||||
|
||||
```ts
|
||||
@Component({
|
||||
selector: 'my-component',
|
||||
template: '{{person.addresss.street}}'
|
||||
})
|
||||
class MyComponent {
|
||||
person?: Person;
|
||||
}
|
||||
```
|
||||
|
||||
This will produce the following error:
|
||||
|
||||
```
|
||||
my.component.ts.MyComponent.html(1,1): : Property 'addresss' does not exist on type 'Person'. Did you mean 'address'?
|
||||
```
|
||||
|
||||
The file name reported in the error message, `my.component.ts.MyComponent.html`, is a synthetic file
|
||||
generated by the template compiler that holds contents of the `MyComponent` class template.
|
||||
Compiler never writes this file to disk. The line and column numbers are relative to the template string
|
||||
in the `@Component` annotation of the class, `MyComponent` in this case. If a component uses
|
||||
`templateUrl` instead of `template`, the errors are reported in the HTML file refereneced by the
|
||||
`templateUrl` instead of a synthetic file.
|
||||
|
||||
The error location is the beginning of the text node that contains the interpolation expression with
|
||||
the error. If the error is in an attribute binding such as `[value]="person.address.street"`, the error
|
||||
location is the location of the attribute that contains the error.
|
||||
|
||||
The validation uses the TypeScript type checker and the options supplied to the TypeScript compiler to control
|
||||
how detailed the type validation is. For example, if the `strictTypeChecks` is specified, the error ```my.component.ts.MyComponent.html(1,1): : Object is possibly 'undefined'``` is reported as well as the above error message.
|
||||
|
||||
### Type narrowing
|
||||
|
||||
The expression used in an `ngIf` directive is used to narrow type unions in the Angular
|
||||
template compiler, the same way the `if` expression does in TypeScript. For example, to avoid
|
||||
`Object is possibly 'undefined'` error in the template above, modify it to only emit the
|
||||
interpolation if the value of `person` is initialized as shown below:
|
||||
|
||||
```ts
|
||||
@Component({
|
||||
selector: 'my-component',
|
||||
template: '<span *ngIf="person"> {{person.addresss.street}} </span>'
|
||||
})
|
||||
class MyComponent {
|
||||
person?: Person;
|
||||
}
|
||||
```
|
||||
|
||||
Using `*ngIf` allows the TypeScript compiler to infer that the `person` used in the
|
||||
binding expression will never be `undefined`.
|
||||
|
||||
#### Custom `ngIf` like directives
|
||||
|
||||
Directives that behave like `*ngIf` can declare that they want the same treatment by including
|
||||
a static member marker that is a signal to the template compiler to treat them
|
||||
like `*ngIf`. This static member for `*ngIf` is:
|
||||
|
||||
```ts
|
||||
public static ngIfUseIfTypeGuard: void;
|
||||
```
|
||||
|
||||
This declares that the input property `ngIf` of the `NgIf` directive should be treated as a
|
||||
guard to the use of its template, implying that the template will only be instantiated if
|
||||
the `ngIf` input property is true.
|
||||
|
||||
|
||||
### Non-null type assertion operator
|
||||
|
||||
Use the [non-null type assertion operator](guide/template-syntax#non-null-assertion-operator)
|
||||
to suppress the `Object is possibly 'undefined'` error when it is incovienent to use
|
||||
`*ngIf` or when some constraint in the component ensures that the expression is always
|
||||
non-null when the binding expression is interpolated.
|
||||
|
||||
In the following example, the `person` and `address` properties are always set together,
|
||||
implying that `address` is always non-null if `person` is non-null. There is no convenient
|
||||
way to describe this constraint to TypeScript and the template compiler, but the error
|
||||
is suppressed in the example by using `address!.street`.
|
||||
|
||||
```ts
|
||||
@Component({
|
||||
selector: 'my-component',
|
||||
template: '<span *ngIf="person"> {{person.name}} lives on {{address!.street}} </span>'
|
||||
})
|
||||
class MyComponent {
|
||||
person?: Person;
|
||||
address?: Address;
|
||||
|
||||
setData(person: Person, address: Address) {
|
||||
this.person = person;
|
||||
this.address = address;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The non-null assertion operator should be used sparingly as refactoring of the component
|
||||
might break this constraint.
|
||||
|
||||
In this example it is recommended to include the checking of `address`
|
||||
in the `*ngIf`as shown below:
|
||||
|
||||
```ts
|
||||
@Component({
|
||||
selector: 'my-component',
|
||||
template: '<span *ngIf="person && address"> {{person.name}} lives on {{address.street}} </span>'
|
||||
})
|
||||
class MyComponent {
|
||||
person?: Person;
|
||||
address?: Address;
|
||||
|
||||
setData(person: Person, address: Address) {
|
||||
this.person = person;
|
||||
this.address = address;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Disabling type checking using `$any()`
|
||||
|
||||
Disable checking of a binding expression by surrounding the expression
|
||||
in a call to the [`$any()` cast pseudo-function](guide/template-syntax).
|
||||
The compiler treats it as a cast to the `any` type just like in TypeScript when a `<any>`
|
||||
or `as any` cast is used.
|
||||
|
||||
In the following example, the error `Property addresss does not exist` is suppressed
|
||||
by casting `person` to the `any` type.
|
||||
|
||||
```ts
|
||||
@Component({
|
||||
selector: 'my-component',
|
||||
template: '{{$any(person).addresss.street}}'
|
||||
})
|
||||
class MyComponent {
|
||||
person?: Person;
|
||||
}
|
||||
```
|
||||
## Summary
|
||||
|
||||
* What the AOT compiler does and why it is important.
|
||||
@ -970,3 +1288,5 @@ Chuck: After reviewing your PR comment I'm still at a loss. See [comment there](
|
||||
* Other restrictions on metadata definition.
|
||||
* Macro-functions and macro-static methods.
|
||||
* Compiler errors related to metadata.
|
||||
* Validation of binding expressions
|
||||
|
||||
|
@ -371,7 +371,7 @@ and to
|
||||
|
||||
Angular developers may encounter a
|
||||
<a href="https://en.wikipedia.org/wiki/Cross-origin_resource_sharing" title="Cross-origin resource sharing">
|
||||
<i>cross-origin resource sharing</i></a> error when making a service request (typically a data service request).
|
||||
<i>cross-origin resource sharing</i></a> error when making a service request (typically a data service request)
|
||||
to a server other than the application's own host server.
|
||||
Browsers forbid such requests unless the server permits them explicitly.
|
||||
|
||||
|
@ -273,6 +273,8 @@ has a single `intercept()` method. Here is a simple interceptor which does nothi
|
||||
import {Injectable} from '@angular/core';
|
||||
import {HttpEvent, HttpInterceptor, HttpHandler, HttpRequest} from '@angular/common/http';
|
||||
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
|
||||
@Injectable()
|
||||
export class NoopInterceptor implements HttpInterceptor {
|
||||
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
||||
@ -297,6 +299,8 @@ Simply declaring the `NoopInterceptor` above doesn't cause your app to use it. Y
|
||||
import {NgModule} from '@angular/core';
|
||||
import {HTTP_INTERCEPTORS} from '@angular/common/http';
|
||||
|
||||
import {NoopInterceptor} from 'noop.interceptor.ts';
|
||||
|
||||
@NgModule({
|
||||
providers: [{
|
||||
provide: HTTP_INTERCEPTORS,
|
||||
@ -547,12 +551,12 @@ In order to prevent collisions in environments where multiple Angular apps share
|
||||
|
||||
### Configuring custom cookie/header names
|
||||
|
||||
If your backend service uses different names for the XSRF token cookie or header, use `HttpClientXsrfModule.withConfig()` to override the defaults.
|
||||
If your backend service uses different names for the XSRF token cookie or header, use `HttpClientXsrfModule.withOptions()` to override the defaults.
|
||||
|
||||
```javascript
|
||||
imports: [
|
||||
HttpClientModule,
|
||||
HttpClientXsrfModule.withConfig({
|
||||
HttpClientXsrfModule.withOptions({
|
||||
cookieName: 'My-Xsrf-Cookie',
|
||||
headerName: 'My-Xsrf-Header',
|
||||
}),
|
||||
|
@ -200,8 +200,8 @@ versions are safe to use, so existing tabs continue to run from
|
||||
cache, but new loads of the app will be served from the network.
|
||||
|
||||
* `SAFE_MODE`: the service worker cannot guarantee the safety of
|
||||
using cached data. Either an unexpected error occurred or all c
|
||||
ached versions are invalid. All traffic will be served from the
|
||||
using cached data. Either an unexpected error occurred or all
|
||||
cached versions are invalid. All traffic will be served from the
|
||||
network, running as little service worker code as possible.
|
||||
|
||||
In both cases, the parenthetical annotation provides the
|
||||
|
@ -2,7 +2,7 @@
|
||||
@description
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2014-2017 Google, Inc.
|
||||
Copyright (c) 2014-2018 Google, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -121,7 +121,7 @@ Import the `HeroService` instead.
|
||||
<code-example path="toh-pt4/src/app/heroes/heroes.component.ts" title="src/app/heroes/heroes.component.ts (import HeroService)" region="hero-service-import">
|
||||
</code-example>
|
||||
|
||||
Replace the the definition of the `heroes` property with a simple declaration.
|
||||
Replace the definition of the `heroes` property with a simple declaration.
|
||||
|
||||
<code-example path="toh-pt4/src/app/heroes/heroes.component.ts" region="heroes">
|
||||
</code-example>
|
||||
|
@ -58,6 +58,7 @@ describe('site App', function() {
|
||||
expect(page.getScrollTop()).toBeGreaterThan(0);
|
||||
|
||||
page.getNavItem(/api/i).click();
|
||||
browser.waitForAngular();
|
||||
expect(page.locationPath()).toBe('/api');
|
||||
expect(page.getScrollTop()).toBe(0);
|
||||
});
|
||||
@ -69,6 +70,7 @@ describe('site App', function() {
|
||||
expect(page.getScrollTop()).toBeGreaterThan(0);
|
||||
|
||||
page.getNavItem(/security/i).click();
|
||||
browser.waitForAngular();
|
||||
expect(page.locationPath()).toBe('/guide/security');
|
||||
expect(page.getScrollTop()).toBe(0);
|
||||
});
|
||||
|
@ -84,7 +84,7 @@
|
||||
"rxjs": "^5.5.2",
|
||||
"tslib": "^1.7.1",
|
||||
"web-animations-js": "^2.2.5",
|
||||
"zone.js": "0.8.16"
|
||||
"zone.js": "^0.8.19"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/cli": "^1.6.0-rc.0",
|
||||
|
@ -4,18 +4,18 @@
|
||||
"gzip7": {
|
||||
"inline": 941,
|
||||
"main": 116124,
|
||||
"polyfills": 11860
|
||||
"polyfills": 13102
|
||||
},
|
||||
"gzip9": {
|
||||
"inline": 941,
|
||||
"main": 115954,
|
||||
"polyfills": 11858
|
||||
"polyfills": 13104
|
||||
},
|
||||
"uncompressed": {
|
||||
"inline": 1558,
|
||||
"main": 456432,
|
||||
"polyfills": 37070
|
||||
"polyfills": 40684
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -723,14 +723,14 @@ describe('AppComponent', () => {
|
||||
expect(TestBed.get(LocationService).replace).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should redirect to `docs` if deployment mode is `next` and not at a docs page', () => {
|
||||
it('should not redirect if deployment mode is `next`', () => {
|
||||
createTestingModule('', 'next');
|
||||
initializeTest();
|
||||
expect(TestBed.get(LocationService).replace).toHaveBeenCalledWith('docs');
|
||||
expect(TestBed.get(LocationService).replace).not.toHaveBeenCalled();
|
||||
|
||||
createTestingModule('resources', 'next');
|
||||
initializeTest();
|
||||
expect(TestBed.get(LocationService).replace).toHaveBeenCalledWith('docs');
|
||||
expect(TestBed.get(LocationService).replace).not.toHaveBeenCalled();
|
||||
|
||||
createTestingModule('guide/aot-compiler', 'next');
|
||||
initializeTest();
|
||||
@ -757,7 +757,7 @@ describe('AppComponent', () => {
|
||||
expect(TestBed.get(LocationService).replace).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not redirect to `docs` if deployment mode is `stable` and not at a docs page', () => {
|
||||
it('should not redirect to `docs` if deployment mode is `stable`', () => {
|
||||
createTestingModule('', 'stable');
|
||||
initializeTest();
|
||||
expect(TestBed.get(LocationService).replace).not.toHaveBeenCalled();
|
||||
|
@ -121,9 +121,9 @@ export class AppComponent implements OnInit {
|
||||
this.documentService.currentDocument.first().subscribe(doc => this.updateHostClassesForDoc(doc));
|
||||
|
||||
this.locationService.currentPath.subscribe(path => {
|
||||
// Redirect to docs if we are in not in stable mode and are not hitting a docs page
|
||||
// Redirect to docs if we are in archive mode and are not hitting a docs page
|
||||
// (i.e. we have arrived at a marketing page)
|
||||
if (this.deployment.mode !== 'stable' && !/^(docs$|api|guide|tutorial)/.test(path)) {
|
||||
if (this.deployment.mode === 'archive' && !/^(docs$|api|guide|tutorial)/.test(path)) {
|
||||
this.locationService.replace('docs');
|
||||
}
|
||||
if (path === this.currentPath) {
|
||||
|
@ -43,15 +43,15 @@ export class ApiListComponent implements OnInit {
|
||||
// API types
|
||||
types: Option[] = [
|
||||
{ value: 'all', title: 'All' },
|
||||
{ value: 'directive', title: 'Directive' },
|
||||
{ value: 'pipe', title: 'Pipe'},
|
||||
{ value: 'decorator', title: 'Decorator' },
|
||||
{ value: 'class', title: 'Class' },
|
||||
{ value: 'interface', title: 'Interface' },
|
||||
{ value: 'function', title: 'Function' },
|
||||
{ value: 'const', title: 'Const'},
|
||||
{ value: 'decorator', title: 'Decorator' },
|
||||
{ value: 'directive', title: 'Directive' },
|
||||
{ value: 'enum', title: 'Enum' },
|
||||
{ value: 'type-alias', title: 'Type Alias' },
|
||||
{ value: 'const', title: 'Const'}
|
||||
{ value: 'function', title: 'Function' },
|
||||
{ value: 'interface', title: 'Interface' },
|
||||
{ value: 'pipe', title: 'Pipe'},
|
||||
{ value: 'type-alias', title: 'Type Alias' }
|
||||
];
|
||||
|
||||
statuses: Option[] = [
|
||||
|
@ -536,7 +536,7 @@ describe('DocViewerComponent', () => {
|
||||
expect(swapViewsSpy).not.toHaveBeenCalled();
|
||||
expect(docViewer.nextViewContainer.innerHTML).toBe('');
|
||||
expect(logger.output.error).toEqual([
|
||||
['[DocViewer]: Error preparing document \'foo\'.', error],
|
||||
[`[DocViewer] Error preparing document 'foo': ${error.stack}`],
|
||||
]);
|
||||
});
|
||||
|
||||
@ -555,7 +555,7 @@ describe('DocViewerComponent', () => {
|
||||
expect(swapViewsSpy).not.toHaveBeenCalled();
|
||||
expect(docViewer.nextViewContainer.innerHTML).toBe('');
|
||||
expect(logger.output.error).toEqual([
|
||||
['[DocViewer]: Error preparing document \'bar\'.', error],
|
||||
[`[DocViewer] Error preparing document 'bar': ${error.stack}`],
|
||||
]);
|
||||
});
|
||||
|
||||
@ -574,7 +574,7 @@ describe('DocViewerComponent', () => {
|
||||
expect(swapViewsSpy).not.toHaveBeenCalled();
|
||||
expect(docViewer.nextViewContainer.innerHTML).toBe('');
|
||||
expect(logger.output.error).toEqual([
|
||||
['[DocViewer]: Error preparing document \'baz\'.', error],
|
||||
[`[DocViewer] Error preparing document 'baz': ${error.stack}`],
|
||||
]);
|
||||
});
|
||||
|
||||
@ -593,7 +593,23 @@ describe('DocViewerComponent', () => {
|
||||
expect(swapViewsSpy).toHaveBeenCalledTimes(1);
|
||||
expect(docViewer.nextViewContainer.innerHTML).toBe('');
|
||||
expect(logger.output.error).toEqual([
|
||||
['[DocViewer]: Error preparing document \'qux\'.', error],
|
||||
[`[DocViewer] Error preparing document 'qux': ${error.stack}`],
|
||||
]);
|
||||
});
|
||||
|
||||
it('when something fails with non-Error', async () => {
|
||||
const error = 'Typical string error';
|
||||
swapViewsSpy.and.callFake(() => {
|
||||
expect(docViewer.nextViewContainer.innerHTML).not.toBe('');
|
||||
throw error;
|
||||
});
|
||||
|
||||
await doRender('Some content', 'qux');
|
||||
|
||||
expect(swapViewsSpy).toHaveBeenCalledTimes(1);
|
||||
expect(docViewer.nextViewContainer.innerHTML).toBe('');
|
||||
expect(logger.output.error).toEqual([
|
||||
[`[DocViewer] Error preparing document 'qux': ${error}`],
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
@ -153,8 +153,9 @@ export class DocViewerComponent implements DoCheck, OnDestroy {
|
||||
.switchMap(() => this.swapViews(addTitleAndToc))
|
||||
.do(() => this.docRendered.emit())
|
||||
.catch(err => {
|
||||
const errorMessage = (err instanceof Error) ? err.stack : err;
|
||||
this.logger.error(`[DocViewer] Error preparing document '${doc.id}': ${errorMessage}`);
|
||||
this.nextViewContainer.innerHTML = '';
|
||||
this.logger.error(`[DocViewer]: Error preparing document '${doc.id}'.`, err);
|
||||
return this.void$;
|
||||
});
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Powered by Google ©2010-2017.
|
||||
Powered by Google ©2010-2018.
|
||||
Code licensed under an <a href="license" title="License text" >MIT-style License</a>.
|
||||
Documentation licensed under
|
||||
<a href="http://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>.
|
||||
|
@ -11,8 +11,9 @@ interface StringMap { [index: string]: string; }
|
||||
export function getAttrs(el: HTMLElement | ElementRef): StringMap {
|
||||
const attrs: NamedNodeMap = el instanceof ElementRef ? el.nativeElement.attributes : el.attributes;
|
||||
const attrMap = {};
|
||||
Object.keys(attrs).forEach(key =>
|
||||
attrMap[(attrs[key] as Attr).name.toLowerCase()] = (attrs[key] as Attr).value);
|
||||
for (const attr of attrs as any /* cast due to https://github.com/Microsoft/TypeScript/issues/2695 */) {
|
||||
attrMap[attr.name.toLowerCase()] = attr.value;
|
||||
}
|
||||
return attrMap;
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,11 @@ exports.config = {
|
||||
'./e2e/**/*.e2e-spec.ts'
|
||||
],
|
||||
capabilities: {
|
||||
'browserName': 'chrome'
|
||||
'browserName': 'chrome',
|
||||
// For Travis CI only
|
||||
chromeOptions: {
|
||||
binary: process.env.CHROME_BIN
|
||||
}
|
||||
},
|
||||
directConnect: true,
|
||||
baseUrl: 'http://localhost:4200/',
|
||||
|
@ -45,7 +45,7 @@ class PlunkerBuilder {
|
||||
}
|
||||
|
||||
_buildCopyrightStrings() {
|
||||
var copyright = 'Copyright 2017 Google Inc. All Rights Reserved.\n'
|
||||
var copyright = 'Copyright 2017-2018 Google Inc. All Rights Reserved.\n'
|
||||
+ 'Use of this source code is governed by an MIT-style license that\n'
|
||||
+ 'can be found in the LICENSE file at http://angular.io/license';
|
||||
var pad = '\n\n';
|
||||
@ -152,6 +152,7 @@ class PlunkerBuilder {
|
||||
// Matches main.ts or main.1.ts
|
||||
if (/^main(?:[.-]\w+)?\.ts$/.test(relativeFileName)) {
|
||||
content = fileTranslator.translate(content, mainTsRules);
|
||||
relativeFileName = 'main.ts';
|
||||
}
|
||||
|
||||
if (relativeFileName == 'systemjs.config.extras.js') {
|
||||
|
@ -1,5 +1,16 @@
|
||||
/**
|
||||
* Use this tag to ensure that dgeni does not include this code item
|
||||
* in the rendered docs.
|
||||
*
|
||||
* The `@internal` tag indicates to the compiler not to include the
|
||||
* item in the public typings file.
|
||||
* Use the `@nodoc` alias if you only want to hide the item from the
|
||||
* docs but not from the typings file.
|
||||
*/
|
||||
module.exports = function() {
|
||||
return {
|
||||
name: 'internal', transforms: function() { return true; }
|
||||
name: 'internal',
|
||||
aliases: ['nodoc'],
|
||||
transforms: function() { return true; }
|
||||
};
|
||||
};
|
||||
|
@ -9424,10 +9424,10 @@ zip-stream@~0.6.0:
|
||||
lodash "~3.10.1"
|
||||
readable-stream "~1.0.26"
|
||||
|
||||
zone.js@0.8.16:
|
||||
version "0.8.16"
|
||||
resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.8.16.tgz#ac31b6c418f88c0f918ad6acd8a402aca9313abb"
|
||||
|
||||
zone.js@^0.8.14:
|
||||
version "0.8.18"
|
||||
resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.8.18.tgz#8cecb3977fcd1b3090562ff4570e2847e752b48d"
|
||||
|
||||
zone.js@^0.8.19:
|
||||
version "0.8.19"
|
||||
resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.8.19.tgz#a4b522cd9e8b7b616a638c297d720d4c7f292f71"
|
||||
|
2
build.sh
2
build.sh
@ -206,7 +206,7 @@ minify() {
|
||||
base_file=$( basename "${file}" )
|
||||
if [[ "${base_file}" =~ $regex && "${base_file##*.}" != "map" ]]; then
|
||||
local out_file=$(dirname "${file}")/${BASH_REMATCH[1]}.min.js
|
||||
$UGLIFYJS -c --screw-ie8 --comments -o ${out_file} --source-map ${out_file}.map --source-map-include-sources ${file}
|
||||
$UGLIFYJS -c --screw-ie8 --comments -o ${out_file} --source-map ${out_file}.map --prefix relative --source-map-include-sources ${file}
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
@ -50,3 +50,26 @@ keeps the outputs up-to-date as you save sources. Note this is
|
||||
new as of May 2017 and not very stable yet.
|
||||
|
||||
[ibazel]: https://github.com/bazelbuild/bazel-watcher
|
||||
|
||||
## Testing Angular
|
||||
|
||||
- Test package in node: `bazel test packages/core/test:test`
|
||||
- Test package in karma: `bazel test packages/core/test:test_web`
|
||||
- Test all packages: `bazel test packages/...`
|
||||
|
||||
You can use [ibazel] to get a "watch mode" that continuously
|
||||
keeps the outputs up-to-date as you save sources.
|
||||
|
||||
### Debugging a Node Test
|
||||
|
||||
- Open chrome at: [chrome://inspect](chrome://inspect)
|
||||
- Click on `Open dedicated DevTools for Node` to launch a debugger.
|
||||
- Run test: `bazel test packages/core/test:test --config=debug`
|
||||
|
||||
The process should automatically connect to the debugger.
|
||||
|
||||
### Debugging a Karma Test
|
||||
|
||||
- Run test: `bazel run packages/core/test:test_web`
|
||||
- Open chrome at: [http://localhost:9876/debug.html](http://localhost:9876/debug.html)
|
||||
- Open chrome inspector
|
||||
|
@ -7,30 +7,11 @@ Caretaker is responsible for merging PRs into the individual branches and intern
|
||||
- Draining the queue of PRs ready to be merged. (PRs with [`PR action: merge`](https://github.com/angular/angular/pulls?q=is%3Aopen+is%3Apr+label%3A%22PR+action%3A+merge%22) label)
|
||||
- Assigining [new issues](https://github.com/angular/angular/issues?q=is%3Aopen+is%3Aissue+no%3Alabel) to individual component authors.
|
||||
|
||||
## Setup
|
||||
|
||||
### Set `upstream` to fetch PRs into your local repo
|
||||
|
||||
Use this conmmands to configure your `git` to fetch PRs into your local repo.
|
||||
|
||||
```
|
||||
git remote add upstream git@github.com:angular/angular.git
|
||||
git config --add remote.upstream.fetch +refs/pull/*/head:refs/remotes/upstream/pr/*
|
||||
```
|
||||
|
||||
|
||||
## Merging the PR
|
||||
|
||||
A PR needs to have `PR action: merge` and `PR target: *` labels to be considered
|
||||
ready to merge. Merging is performed by running `merge-pr` with a PR number to merge.
|
||||
|
||||
NOTE: before running `merge-pr` ensure that you have synced all of the PRs
|
||||
locally by running:
|
||||
|
||||
```
|
||||
$ git fetch upstream
|
||||
```
|
||||
|
||||
To merge a PR run:
|
||||
|
||||
```
|
||||
@ -40,6 +21,7 @@ $ ./scripts/github/merge-pr 1234
|
||||
The `merge-pr` script will:
|
||||
- Ensure that all approriate labels are on the PR.
|
||||
- That the current branch (`master` or `?.?.x` patch) mathches the `PR target: *` label.
|
||||
- Fetches the latest PR code from the `angular/angular` repo.
|
||||
- It will `cherry-pick` all of the SHAs from the PR into the current branch.
|
||||
- It will rewrite commit history by automatically adding `Close #1234` and `(#1234)` into the commit message.
|
||||
|
||||
@ -53,8 +35,8 @@ $ ./scripts/github/merge-pr 1234
|
||||
======================
|
||||
GitHub Merge PR Steps
|
||||
======================
|
||||
git cherry-pick upstream/pr/1234~1..upstream/pr/1234
|
||||
git filter-branch -f --msg-filter "/usr/local/google/home/misko/angular-pr/scripts/github/utils/github.closes 1234" HEAD~1..HEAD
|
||||
git cherry-pick angular/pr/1234~1..angular/pr/1234
|
||||
git filter-branch -f --msg-filter "/home/misko/angular/scripts/github/utils/github.closes 1234" HEAD~1..HEAD
|
||||
```
|
||||
|
||||
If the `cherry-pick` command fails than resolve conflicts and use `git cherry-pick --continue` once ready. After the `cherry-pick` is done cut&paste and run the `filter-branch` command to properly rewrite the messages
|
||||
|
@ -1,4 +1,34 @@
|
||||
{
|
||||
"cli-hello-world":{"master":{"gzip7":{"inline":847,"main":42533,"polyfills":20207},"gzip9":{"inline":847,"main":42483,"polyfills":20204},"uncompressed":{"inline":1447,"main":154295,"polyfills":61254}}},
|
||||
"hello_world__closure":{"master":{"gzip7":{"bundle":32793},"gzip9":{"bundle":32758},"uncompressed":{"bundle":100661}}}
|
||||
"cli-hello-world": {
|
||||
"master": {
|
||||
"gzip7": {
|
||||
"inline": 847,
|
||||
"main": 42144,
|
||||
"polyfills": 20207
|
||||
},
|
||||
"gzip9": {
|
||||
"inline": 847,
|
||||
"main": 42083,
|
||||
"polyfills": 20204
|
||||
},
|
||||
"uncompressed": {
|
||||
"inline": 1447,
|
||||
"main": 151639,
|
||||
"polyfills": 61254
|
||||
}
|
||||
}
|
||||
},
|
||||
"hello_world__closure": {
|
||||
"master": {
|
||||
"gzip7": {
|
||||
"bundle": 32793
|
||||
},
|
||||
"gzip9": {
|
||||
"bundle": 32758
|
||||
},
|
||||
"uncompressed": {
|
||||
"bundle": 100661
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,12 +14,13 @@ node_repositories(package_json = ["//:package.json"])
|
||||
git_repository(
|
||||
name = "build_bazel_rules_typescript",
|
||||
remote = "https://github.com/bazelbuild/rules_typescript.git",
|
||||
tag = "0.6.0",
|
||||
# tag = "0.6.0",
|
||||
commit = "89d2c75066bea3d9c942f29dd1d2ea543c58d6d5"
|
||||
)
|
||||
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_repositories")
|
||||
load("@build_bazel_rules_typescript//:setup.bzl", "ts_setup_workspace")
|
||||
|
||||
ts_repositories()
|
||||
ts_setup_workspace()
|
||||
|
||||
local_repository(
|
||||
name = "angular",
|
||||
|
@ -5,7 +5,7 @@
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"postinstall": "webdriver-manager update --gecko false --standalone false $CHROMEDRIVER_VERSION_ARG",
|
||||
"test": "concurrently \"npm run serve\" \"npm run protractor\" --kill-others --success first",
|
||||
"test": "concurrently \"yarn serve\" \"yarn protractor\" --kill-others --success first",
|
||||
"serve": "lite-server -c bs-config.e2e.json",
|
||||
"preprotractor": "tsc -p e2e",
|
||||
"protractor": "protractor protractor.config.js"
|
||||
@ -17,7 +17,7 @@
|
||||
"@angular/platform-browser": "file:../../dist/packages-dist/platform-browser",
|
||||
"@angular/platform-browser-dynamic": "file:../../dist/packages-dist/platform-browser-dynamic",
|
||||
"core-js": "2.4.1",
|
||||
"plugin-typescript": "6.0.4",
|
||||
"plugin-typescript": "8.0.0",
|
||||
"rxjs": "file:../../node_modules/rxjs",
|
||||
"systemjs": "0.20.2",
|
||||
"typescript": "file:../../node_modules/typescript",
|
||||
|
@ -13,13 +13,16 @@ import * as coreTesting from '@angular/core/testing';
|
||||
import * as forms from '@angular/forms';
|
||||
import * as http from '@angular/http';
|
||||
import * as httpTesting from '@angular/http/testing';
|
||||
import * as platformBrowserDynamic from '@angular/platform-browser-dynamic';
|
||||
import * as platformBrowser from '@angular/platform-browser';
|
||||
import * as platformBrowserTesting from '@angular/platform-browser/testing';
|
||||
import * as platformBrowserDynamic from '@angular/platform-browser-dynamic';
|
||||
import * as platformServer from '@angular/platform-server';
|
||||
import * as platformServerTesting from '@angular/platform-server/testing';
|
||||
import * as platformWebworker from '@angular/platform-webworker';
|
||||
import * as platformWebworkerDynamic from '@angular/platform-webworker-dynamic';
|
||||
import * as router from '@angular/router';
|
||||
import * as routerTesting from '@angular/router/testing';
|
||||
import * as serviceWorker from '@angular/service-worker';
|
||||
import * as upgrade from '@angular/upgrade';
|
||||
|
||||
export default {
|
||||
@ -35,7 +38,10 @@ export default {
|
||||
platformBrowserDynamic,
|
||||
platformServer,
|
||||
platformServerTesting,
|
||||
platformWebworker,
|
||||
platformWebworkerDynamic,
|
||||
router,
|
||||
routerTesting,
|
||||
upgrade
|
||||
serviceWorker,
|
||||
upgrade,
|
||||
};
|
||||
|
@ -14,7 +14,10 @@
|
||||
"@angular/platform-browser": "file:../../dist/packages-dist/platform-browser",
|
||||
"@angular/platform-browser-dynamic": "file:../../dist/packages-dist/platform-browser-dynamic",
|
||||
"@angular/platform-server": "file:../../dist/packages-dist/platform-server",
|
||||
"@angular/platform-webworker": "file:../../dist/packages-dist/platform-webworker",
|
||||
"@angular/platform-webworker-dynamic": "file:../../dist/packages-dist/platform-webworker-dynamic",
|
||||
"@angular/router": "file:../../dist/packages-dist/router",
|
||||
"@angular/service-worker": "file:../../dist/packages-dist/service-worker",
|
||||
"@angular/upgrade": "file:../../dist/packages-dist/upgrade",
|
||||
"@types/jasmine": "2.5.41",
|
||||
"rxjs": "file:../../node_modules/rxjs",
|
||||
|
@ -13,13 +13,16 @@ import * as coreTesting from '@angular/core/testing';
|
||||
import * as forms from '@angular/forms';
|
||||
import * as http from '@angular/http';
|
||||
import * as httpTesting from '@angular/http/testing';
|
||||
import * as platformBrowserDynamic from '@angular/platform-browser-dynamic';
|
||||
import * as platformBrowser from '@angular/platform-browser';
|
||||
import * as platformBrowserTesting from '@angular/platform-browser/testing';
|
||||
import * as platformBrowserDynamic from '@angular/platform-browser-dynamic';
|
||||
import * as platformServer from '@angular/platform-server';
|
||||
import * as platformServerTesting from '@angular/platform-server/testing';
|
||||
import * as platformWebworker from '@angular/platform-webworker';
|
||||
import * as platformWebworkerDynamic from '@angular/platform-webworker-dynamic';
|
||||
import * as router from '@angular/router';
|
||||
import * as routerTesting from '@angular/router/testing';
|
||||
import * as serviceWorker from '@angular/service-worker';
|
||||
import * as upgrade from '@angular/upgrade';
|
||||
|
||||
export default {
|
||||
@ -35,7 +38,10 @@ export default {
|
||||
platformBrowserDynamic,
|
||||
platformServer,
|
||||
platformServerTesting,
|
||||
platformWebworker,
|
||||
platformWebworkerDynamic,
|
||||
router,
|
||||
routerTesting,
|
||||
upgrade
|
||||
serviceWorker,
|
||||
upgrade,
|
||||
};
|
||||
|
@ -14,7 +14,10 @@
|
||||
"@angular/platform-browser": "file:../../dist/packages-dist/platform-browser",
|
||||
"@angular/platform-browser-dynamic": "file:../../dist/packages-dist/platform-browser-dynamic",
|
||||
"@angular/platform-server": "file:../../dist/packages-dist/platform-server",
|
||||
"@angular/platform-webworker": "file:../../dist/packages-dist/platform-webworker",
|
||||
"@angular/platform-webworker-dynamic": "file:../../dist/packages-dist/platform-webworker-dynamic",
|
||||
"@angular/router": "file:../../dist/packages-dist/router",
|
||||
"@angular/service-worker": "file:../../dist/packages-dist/service-worker",
|
||||
"@angular/upgrade": "file:../../dist/packages-dist/upgrade",
|
||||
"@types/jasmine": "2.5.41",
|
||||
"rxjs": "file:../../node_modules/rxjs",
|
||||
|
47
integration/typings_test_ts26/include-all.ts
Normal file
47
integration/typings_test_ts26/include-all.ts
Normal file
@ -0,0 +1,47 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import * as compiler from '@angular/compiler';
|
||||
import * as compilerTesting from '@angular/compiler/testing';
|
||||
import * as core from '@angular/core';
|
||||
import * as coreTesting from '@angular/core/testing';
|
||||
import * as forms from '@angular/forms';
|
||||
import * as http from '@angular/http';
|
||||
import * as httpTesting from '@angular/http/testing';
|
||||
import * as platformBrowser from '@angular/platform-browser';
|
||||
import * as platformBrowserTesting from '@angular/platform-browser/testing';
|
||||
import * as platformBrowserDynamic from '@angular/platform-browser-dynamic';
|
||||
import * as platformServer from '@angular/platform-server';
|
||||
import * as platformServerTesting from '@angular/platform-server/testing';
|
||||
import * as platformWebworker from '@angular/platform-webworker';
|
||||
import * as platformWebworkerDynamic from '@angular/platform-webworker-dynamic';
|
||||
import * as router from '@angular/router';
|
||||
import * as routerTesting from '@angular/router/testing';
|
||||
import * as serviceWorker from '@angular/service-worker';
|
||||
import * as upgrade from '@angular/upgrade';
|
||||
|
||||
export default {
|
||||
compiler,
|
||||
compilerTesting,
|
||||
core,
|
||||
coreTesting,
|
||||
forms,
|
||||
http,
|
||||
httpTesting,
|
||||
platformBrowser,
|
||||
platformBrowserTesting,
|
||||
platformBrowserDynamic,
|
||||
platformServer,
|
||||
platformServerTesting,
|
||||
platformWebworker,
|
||||
platformWebworkerDynamic,
|
||||
router,
|
||||
routerTesting,
|
||||
serviceWorker,
|
||||
upgrade,
|
||||
};
|
30
integration/typings_test_ts26/package.json
Normal file
30
integration/typings_test_ts26/package.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "angular-integration",
|
||||
"description": "Assert that users with TypeScript 2.6 can type-check an Angular application",
|
||||
"version": "0.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@angular/animations": "file:../../dist/packages-dist/animations",
|
||||
"@angular/common": "file:../../dist/packages-dist/common",
|
||||
"@angular/compiler": "file:../../dist/packages-dist/compiler",
|
||||
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
|
||||
"@angular/core": "file:../../dist/packages-dist/core",
|
||||
"@angular/forms": "file:../../dist/packages-dist/forms",
|
||||
"@angular/http": "file:../../dist/packages-dist/http",
|
||||
"@angular/platform-browser": "file:../../dist/packages-dist/platform-browser",
|
||||
"@angular/platform-browser-dynamic": "file:../../dist/packages-dist/platform-browser-dynamic",
|
||||
"@angular/platform-server": "file:../../dist/packages-dist/platform-server",
|
||||
"@angular/platform-webworker": "file:../../dist/packages-dist/platform-webworker",
|
||||
"@angular/platform-webworker-dynamic": "file:../../dist/packages-dist/platform-webworker-dynamic",
|
||||
"@angular/router": "file:../../dist/packages-dist/router",
|
||||
"@angular/service-worker": "file:../../dist/packages-dist/service-worker",
|
||||
"@angular/upgrade": "file:../../dist/packages-dist/upgrade",
|
||||
"@types/jasmine": "2.5.41",
|
||||
"rxjs": "file:../../node_modules/rxjs",
|
||||
"typescript": "2.6.x",
|
||||
"zone.js": "file:../../node_modules/zone.js"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tsc"
|
||||
}
|
||||
}
|
24
integration/typings_test_ts26/tsconfig.json
Normal file
24
integration/typings_test_ts26/tsconfig.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../../dist/typings_test_ts26/",
|
||||
"rootDir": ".",
|
||||
"target": "es5",
|
||||
"lib": [
|
||||
"es5",
|
||||
"dom",
|
||||
"es2015.collection",
|
||||
"es2015.iterable",
|
||||
"es2015.promise"
|
||||
],
|
||||
"types": [],
|
||||
"strictNullChecks": true
|
||||
},
|
||||
"files": [
|
||||
"include-all.ts",
|
||||
"node_modules/@types/jasmine/index.d.ts"
|
||||
]
|
||||
}
|
@ -53,6 +53,7 @@ module.exports = function(config) {
|
||||
],
|
||||
|
||||
exclude: [
|
||||
'dist/all/@angular/_testing_init/**',
|
||||
'dist/all/@angular/**/e2e_test/**',
|
||||
'dist/all/@angular/**/*node_only_spec.js',
|
||||
'dist/all/@angular/benchpress/**',
|
||||
|
@ -56,6 +56,24 @@ describe('largetable benchmark perf', () => {
|
||||
}).then(done, done.fail);
|
||||
});
|
||||
|
||||
it('should run for render3', (done) => {
|
||||
runTableBenchmark({
|
||||
id: `largeTable.render3.${worker.id}`,
|
||||
url: 'all/benchmarks/src/largetable/render3/index.html',
|
||||
ignoreBrowserSynchronization: true,
|
||||
worker: worker
|
||||
}).then(done, done.fail);
|
||||
});
|
||||
|
||||
it('should run for iv', (done) => {
|
||||
runTableBenchmark({
|
||||
id: `largeTable.iv.${worker.id}`,
|
||||
url: 'all/benchmarks/src/largetable/iv/index.html',
|
||||
ignoreBrowserSynchronization: true,
|
||||
worker: worker
|
||||
}).then(done, done.fail);
|
||||
});
|
||||
|
||||
it('should run for the baseline', (done) => {
|
||||
runTableBenchmark({
|
||||
id: `largeTable.baseline.${worker.id}`,
|
||||
|
@ -25,6 +25,20 @@ describe('largetable benchmark spec', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should work for render3', () => {
|
||||
testTableBenchmark({
|
||||
url: 'all/benchmarks/src/largetable/render3/index.html',
|
||||
ignoreBrowserSynchronization: true,
|
||||
});
|
||||
});
|
||||
|
||||
it('should work for iv', () => {
|
||||
testTableBenchmark({
|
||||
url: 'all/benchmarks/src/largetable/iv/index.html',
|
||||
ignoreBrowserSynchronization: true,
|
||||
});
|
||||
});
|
||||
|
||||
it('should work for the baseline', () => {
|
||||
testTableBenchmark({
|
||||
url: 'all/benchmarks/src/largetable/baseline/index.html',
|
||||
|
@ -49,6 +49,24 @@ export const Benchmarks: Benchmark[] = [
|
||||
url: 'all/benchmarks/src/tree/ng2_switch/index.html',
|
||||
buttons: CreateDestroyButtons,
|
||||
},
|
||||
{
|
||||
id: `deepTree.ng2.render3`,
|
||||
url: 'all/benchmarks/src/tree/render3/index.html',
|
||||
buttons: CreateDestroyDetectChangesButtons,
|
||||
ignoreBrowserSynchronization: true,
|
||||
},
|
||||
{
|
||||
id: `deepTree.ng2.render3_function`,
|
||||
url: 'all/benchmarks/src/tree/render3_function/index.html',
|
||||
buttons: CreateDestroyDetectChangesButtons,
|
||||
ignoreBrowserSynchronization: true,
|
||||
},
|
||||
{
|
||||
id: `deepTree.iv`,
|
||||
url: 'all/benchmarks/src/tree/iv/index.html',
|
||||
buttons: CreateDestroyDetectChangesButtons,
|
||||
ignoreBrowserSynchronization: true,
|
||||
},
|
||||
{
|
||||
id: `deepTree.baseline`,
|
||||
url: 'all/benchmarks/src/tree/baseline/index.html',
|
||||
|
31
modules/benchmarks/src/largetable/iv/index.html
Normal file
31
modules/benchmarks/src/largetable/iv/index.html
Normal file
@ -0,0 +1,31 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<h2>Params</h2>
|
||||
<form>
|
||||
Cols:
|
||||
<input type="number" name="cols" placeholder="cols" value="40">
|
||||
<br>
|
||||
Rows:
|
||||
<input type="number" name="rows" placeholder="rows" value="200">
|
||||
<br>
|
||||
<button>Apply</button>
|
||||
</form>
|
||||
|
||||
<h2>IV Largetable Benchmark</h2>
|
||||
<p>
|
||||
<button id="destroyDom">destroyDom</button>
|
||||
<button id="createDom">createDom</button>
|
||||
<button id="updateDomProfile">profile updateDom</button>
|
||||
<button id="createDomProfile">profile createDom</button>
|
||||
</p>
|
||||
|
||||
<div>
|
||||
<largetable id="root"></largetable>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="largetable.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
9
modules/benchmarks/src/largetable/iv/largetable.js
Normal file
9
modules/benchmarks/src/largetable/iv/largetable.js
Normal file
File diff suppressed because one or more lines are too long
34
modules/benchmarks/src/largetable/render3/index.html
Normal file
34
modules/benchmarks/src/largetable/render3/index.html
Normal file
@ -0,0 +1,34 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<h2>Params</h2>
|
||||
<form>
|
||||
Cols:
|
||||
<input type="number" name="cols" placeholder="cols" value="40">
|
||||
<br>
|
||||
Rows:
|
||||
<input type="number" name="rows" placeholder="rows" value="200">
|
||||
<br>
|
||||
<button>Apply</button>
|
||||
</form>
|
||||
|
||||
<h2>Render3 Largetable Benchmark</h2>
|
||||
<p>
|
||||
<button id="destroyDom">destroyDom</button>
|
||||
<button id="createDom">createDom</button>
|
||||
<button id="updateDomProfile">profile updateDom</button>
|
||||
<button id="createDomProfile">profile createDom</button>
|
||||
</p>
|
||||
|
||||
<div>
|
||||
<largetable id="root"></largetable>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var mainUrl = window.location.search.split(/[?&]main=([^&]+)/)[1]
|
||||
|| '../../bootstrap_ng2.js';
|
||||
document.write('<script src="' + mainUrl + '">\u003c/script>');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
28
modules/benchmarks/src/largetable/render3/index.ts
Normal file
28
modules/benchmarks/src/largetable/render3/index.ts
Normal file
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {ɵrenderComponent as renderComponent} from '@angular/core';
|
||||
|
||||
import {bindAction, profile} from '../../util';
|
||||
|
||||
import {LargeTableComponent, createDom, destroyDom} from './table';
|
||||
|
||||
function noop() {}
|
||||
|
||||
export function main() {
|
||||
let component: LargeTableComponent;
|
||||
if (typeof window !== 'undefined') {
|
||||
component = renderComponent<LargeTableComponent>(LargeTableComponent);
|
||||
bindAction('#createDom', () => createDom(component));
|
||||
bindAction('#destroyDom', () => destroyDom(component));
|
||||
bindAction('#updateDomProfile', profile(() => createDom(component), noop, 'update'));
|
||||
bindAction(
|
||||
'#createDomProfile',
|
||||
profile(() => createDom(component), () => destroyDom(component), 'create'));
|
||||
}
|
||||
}
|
81
modules/benchmarks/src/largetable/render3/table.ts
Normal file
81
modules/benchmarks/src/largetable/render3/table.ts
Normal file
@ -0,0 +1,81 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {ɵC as C, ɵE as E, ɵT as T, ɵV as V, ɵb as b, ɵc as c, ɵcR as cR, ɵcr as cr, ɵdefineComponent as defineComponent, ɵdetectChanges as detectChanges, ɵe as e, ɵs as s, ɵt as t, ɵv as v} from '@angular/core';
|
||||
import {ComponentDef} from '@angular/core/src/render3/definition_interfaces';
|
||||
|
||||
import {TableCell, buildTable, emptyTable} from '../util';
|
||||
|
||||
export class LargeTableComponent {
|
||||
data: TableCell[][] = emptyTable;
|
||||
|
||||
/** @nocollapse */
|
||||
static ngComponentDef: ComponentDef<LargeTableComponent> = defineComponent({
|
||||
type: LargeTableComponent,
|
||||
tag: 'largetable',
|
||||
template: function(ctx: LargeTableComponent, cm: boolean) {
|
||||
if (cm) {
|
||||
E(0, 'table');
|
||||
{
|
||||
E(1, 'tbody');
|
||||
{
|
||||
C(2);
|
||||
c();
|
||||
}
|
||||
e();
|
||||
}
|
||||
e();
|
||||
}
|
||||
cR(2);
|
||||
{
|
||||
for (let row of ctx.data) {
|
||||
let cm1 = V(1);
|
||||
{
|
||||
if (cm1) {
|
||||
E(0, 'tr');
|
||||
C(1);
|
||||
c();
|
||||
e();
|
||||
}
|
||||
cR(1);
|
||||
{
|
||||
for (let cell of row) {
|
||||
let cm2 = V(2);
|
||||
{
|
||||
if (cm2) {
|
||||
E(0, 'td');
|
||||
{ T(1); }
|
||||
e();
|
||||
}
|
||||
s(0, 'background-color', b(cell.row % 2 ? '' : 'grey'));
|
||||
t(1, b(cell.value));
|
||||
}
|
||||
v();
|
||||
}
|
||||
}
|
||||
cr();
|
||||
}
|
||||
v();
|
||||
}
|
||||
}
|
||||
cr();
|
||||
},
|
||||
factory: () => new LargeTableComponent(),
|
||||
inputs: {data: 'data'}
|
||||
});
|
||||
}
|
||||
|
||||
export function destroyDom(component: LargeTableComponent) {
|
||||
component.data = emptyTable;
|
||||
detectChanges(component);
|
||||
}
|
||||
|
||||
export function createDom(component: LargeTableComponent) {
|
||||
component.data = buildTable();
|
||||
detectChanges(component);
|
||||
}
|
30
modules/benchmarks/src/tree/iv/index.html
Normal file
30
modules/benchmarks/src/tree/iv/index.html
Normal file
@ -0,0 +1,30 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<h2>Params</h2>
|
||||
<form>
|
||||
Depth:
|
||||
<input type="number" name="depth" placeholder="depth" value="9">
|
||||
<br>
|
||||
<button>Apply</button>
|
||||
</form>
|
||||
|
||||
<h2>IV Tree Benchmark</h2>
|
||||
<p>
|
||||
<button id="destroyDom">destroyDom</button>
|
||||
<button id="createDom">createDom</button>
|
||||
<button id="detectChanges">detectChanges</button>
|
||||
<button id="updateDomProfile">profile updateDom</button>
|
||||
<button id="createDomProfile">profile createDom</button>
|
||||
<button id="detectChangesProfile">profile detectChanges</button>
|
||||
</p>
|
||||
|
||||
<div>
|
||||
Change detection runs:<span id="numberOfChecks"></span>
|
||||
</div>
|
||||
<div id="root"></div>
|
||||
|
||||
<script type="text/javascript" src="tree.js"></script>
|
||||
</body>
|
||||
</html>
|
9
modules/benchmarks/src/tree/iv/tree.js
Normal file
9
modules/benchmarks/src/tree/iv/tree.js
Normal file
File diff suppressed because one or more lines are too long
36
modules/benchmarks/src/tree/render3/index.html
Normal file
36
modules/benchmarks/src/tree/render3/index.html
Normal file
@ -0,0 +1,36 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<h2>Params</h2>
|
||||
<form>
|
||||
Depth:
|
||||
<input type="number" name="depth" placeholder="depth" value="9">
|
||||
<br>
|
||||
<button>Apply</button>
|
||||
</form>
|
||||
|
||||
<h2>Render3 Tree Benchmark</h2>
|
||||
<p>
|
||||
<button id="destroyDom">destroyDom</button>
|
||||
<button id="createDom">createDom</button>
|
||||
<button id="detectChanges">detectChanges</button>
|
||||
<button id="updateDomProfile">profile updateDom</button>
|
||||
<button id="createDomProfile">profile createDom</button>
|
||||
<button id="detectChangesProfile">profile detectChanges</button>
|
||||
</p>
|
||||
|
||||
<div>
|
||||
Change detection runs:<span id="numberOfChecks"></span>
|
||||
</div>
|
||||
<div>
|
||||
<tree id="root"></tree>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var mainUrl = window.location.search.split(/[?&]main=([^&]+)/)[1]
|
||||
|| '../../bootstrap_ng2.js';
|
||||
document.write('<script src="' + mainUrl + '">\u003c/script>');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
29
modules/benchmarks/src/tree/render3/index.ts
Normal file
29
modules/benchmarks/src/tree/render3/index.ts
Normal file
@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {ɵrenderComponent as renderComponent} from '@angular/core';
|
||||
import {bindAction, profile} from '../../util';
|
||||
import {TreeComponent, createDom, destroyDom, detectChanges} from './tree';
|
||||
|
||||
function noop() {}
|
||||
|
||||
export function main() {
|
||||
let component: TreeComponent;
|
||||
if (typeof window !== 'undefined') {
|
||||
component = renderComponent(TreeComponent);
|
||||
bindAction('#createDom', () => createDom(component));
|
||||
bindAction('#destroyDom', () => destroyDom(component));
|
||||
bindAction('#detectChanges', () => detectChanges(component));
|
||||
bindAction(
|
||||
'#detectChangesProfile', profile(() => detectChanges(component), noop, 'detectChanges'));
|
||||
bindAction('#updateDomProfile', profile(() => createDom(component), noop, 'update'));
|
||||
bindAction(
|
||||
'#createDomProfile',
|
||||
profile(() => createDom(component), () => destroyDom(component), 'create'));
|
||||
}
|
||||
}
|
141
modules/benchmarks/src/tree/render3/tree.ts
Normal file
141
modules/benchmarks/src/tree/render3/tree.ts
Normal file
@ -0,0 +1,141 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {ɵC as C, ɵD as D, ɵE as E, ɵT as T, ɵV as V, ɵb as b, ɵb1 as b1, ɵc as c, ɵcR as cR, ɵcr as cr, ɵdefineComponent as defineComponent, ɵdetectChanges as _detectChanges, ɵe as e, ɵp as p, ɵs as s, ɵt as t, ɵv as v} from '@angular/core';
|
||||
import {ComponentDef} from '@angular/core/src/render3/definition_interfaces';
|
||||
|
||||
import {TreeNode, buildTree, emptyTree} from '../util';
|
||||
|
||||
export function destroyDom(component: TreeComponent) {
|
||||
component.data = emptyTree;
|
||||
_detectChanges(component);
|
||||
}
|
||||
|
||||
export function createDom(component: TreeComponent) {
|
||||
component.data = buildTree();
|
||||
_detectChanges(component);
|
||||
}
|
||||
|
||||
const numberOfChecksEl = document.getElementById('numberOfChecks') !;
|
||||
let detectChangesRuns = 0;
|
||||
export function detectChanges(component: TreeComponent) {
|
||||
for (let i = 0; i < 10; i++) {
|
||||
_detectChanges(component);
|
||||
}
|
||||
detectChangesRuns += 10;
|
||||
numberOfChecksEl.textContent = `${detectChangesRuns}`;
|
||||
}
|
||||
|
||||
export class TreeComponent {
|
||||
data: TreeNode = emptyTree;
|
||||
|
||||
/** @nocollapse */
|
||||
static ngComponentDef: ComponentDef<TreeComponent> = defineComponent({
|
||||
type: TreeComponent,
|
||||
tag: 'tree',
|
||||
template: function(ctx: TreeComponent, cm: boolean) {
|
||||
if (cm) {
|
||||
E(0, 'span');
|
||||
{ T(1); }
|
||||
e();
|
||||
C(2);
|
||||
c();
|
||||
C(3);
|
||||
c();
|
||||
}
|
||||
s(0, 'background-color', b(ctx.data.depth % 2 ? '' : 'grey'));
|
||||
t(1, b1(' ', ctx.data.value, ' '));
|
||||
cR(2);
|
||||
{
|
||||
if (ctx.data.left != null) {
|
||||
let cm0 = V(0);
|
||||
{
|
||||
if (cm0) {
|
||||
E(0, TreeComponent.ngComponentDef);
|
||||
{ D(1, TreeComponent.ngComponentDef.n(), TreeComponent.ngComponentDef); }
|
||||
e();
|
||||
}
|
||||
p(0, 'data', b(ctx.data.left));
|
||||
TreeComponent.ngComponentDef.h(1, 0);
|
||||
TreeComponent.ngComponentDef.r(1, 0);
|
||||
}
|
||||
v();
|
||||
}
|
||||
}
|
||||
cr();
|
||||
cR(3);
|
||||
{
|
||||
if (ctx.data.right != null) {
|
||||
let cm0 = V(0);
|
||||
{
|
||||
if (cm0) {
|
||||
E(0, TreeComponent.ngComponentDef);
|
||||
{ D(1, TreeComponent.ngComponentDef.n(), TreeComponent.ngComponentDef); }
|
||||
e();
|
||||
}
|
||||
p(0, 'data', b(ctx.data.right));
|
||||
TreeComponent.ngComponentDef.h(1, 0);
|
||||
TreeComponent.ngComponentDef.r(1, 0);
|
||||
}
|
||||
v();
|
||||
}
|
||||
}
|
||||
cr();
|
||||
},
|
||||
factory: () => new TreeComponent,
|
||||
inputs: {data: 'data'}
|
||||
});
|
||||
}
|
||||
|
||||
export class TreeFunction extends TreeComponent {
|
||||
data: TreeNode = emptyTree;
|
||||
|
||||
/** @nocollapse */
|
||||
static ngComponentDef: ComponentDef<TreeFunction> = defineComponent({
|
||||
type: TreeFunction,
|
||||
tag: 'tree',
|
||||
template: function(ctx: TreeFunction, cm: boolean) {
|
||||
// bit of a hack
|
||||
TreeTpl(ctx.data, cm);
|
||||
},
|
||||
factory: () => new TreeFunction,
|
||||
inputs: {data: 'data'}
|
||||
});
|
||||
}
|
||||
|
||||
export function TreeTpl(ctx: TreeNode, cm: boolean) {
|
||||
if (cm) {
|
||||
E(0, 'span');
|
||||
{ T(1); }
|
||||
e();
|
||||
C(2);
|
||||
c();
|
||||
C(3);
|
||||
c();
|
||||
}
|
||||
s(0, 'background-color', b(ctx.depth % 2 ? '' : 'grey'));
|
||||
t(1, b1(' ', ctx.value, ' '));
|
||||
cR(2);
|
||||
{
|
||||
if (ctx.left != null) {
|
||||
let cm0 = V(0);
|
||||
{ TreeTpl(ctx.left, cm0); }
|
||||
v();
|
||||
}
|
||||
}
|
||||
cr();
|
||||
cR(3);
|
||||
{
|
||||
if (ctx.right != null) {
|
||||
let cm0 = V(0);
|
||||
{ TreeTpl(ctx.right, cm0); }
|
||||
v();
|
||||
}
|
||||
}
|
||||
cr();
|
||||
}
|
36
modules/benchmarks/src/tree/render3_function/index.html
Normal file
36
modules/benchmarks/src/tree/render3_function/index.html
Normal file
@ -0,0 +1,36 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<h2>Params</h2>
|
||||
<form>
|
||||
Depth:
|
||||
<input type="number" name="depth" placeholder="depth" value="9">
|
||||
<br>
|
||||
<button>Apply</button>
|
||||
</form>
|
||||
|
||||
<h2>Render3 Tree Benchmark with functions</h2>
|
||||
<p>
|
||||
<button id="destroyDom">destroyDom</button>
|
||||
<button id="createDom">createDom</button>
|
||||
<button id="detectChanges">detectChanges</button>
|
||||
<button id="updateDomProfile">profile updateDom</button>
|
||||
<button id="createDomProfile">profile createDom</button>
|
||||
<button id="detectChangesProfile">profile detectChanges</button>
|
||||
</p>
|
||||
|
||||
<div>
|
||||
Change detection runs:<span id="numberOfChecks"></span>
|
||||
</div>
|
||||
<div>
|
||||
<tree id="root"></tree>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var mainUrl = window.location.search.split(/[?&]main=([^&]+)/)[1]
|
||||
|| '../../bootstrap_ng2.js';
|
||||
document.write('<script src="' + mainUrl + '">\u003c/script>');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
29
modules/benchmarks/src/tree/render3_function/index.ts
Normal file
29
modules/benchmarks/src/tree/render3_function/index.ts
Normal file
@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {ɵrenderComponent as renderComponent} from '@angular/core';
|
||||
import {bindAction, profile} from '../../util';
|
||||
import {TreeFunction, createDom, destroyDom, detectChanges} from '../render3/tree';
|
||||
|
||||
function noop() {}
|
||||
|
||||
export function main() {
|
||||
let component: TreeFunction;
|
||||
if (typeof window !== 'undefined') {
|
||||
component = renderComponent(TreeFunction);
|
||||
bindAction('#createDom', () => createDom(component));
|
||||
bindAction('#destroyDom', () => destroyDom(component));
|
||||
bindAction('#detectChanges', () => detectChanges(component));
|
||||
bindAction(
|
||||
'#detectChangesProfile', profile(() => detectChanges(component), noop, 'detectChanges'));
|
||||
bindAction('#updateDomProfile', profile(() => createDom(component), noop, 'update'));
|
||||
bindAction(
|
||||
'#createDomProfile',
|
||||
profile(() => createDom(component), () => destroyDom(component), 'create'));
|
||||
}
|
||||
}
|
11
package.json
11
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "angular-srcs",
|
||||
"version": "5.2.0-beta.1",
|
||||
"version": "5.2.0",
|
||||
"private": true,
|
||||
"branchPattern": "2.0.*",
|
||||
"description": "Angular - a web framework for modern web apps",
|
||||
@ -16,7 +16,10 @@
|
||||
"url": "https://github.com/angular/angular.git"
|
||||
},
|
||||
"scripts": {
|
||||
"buildifier": "bazel build @com_github_bazelbuild_buildtools//buildifier && find . -type f \\( -name BUILD -or -name BUILD.bazel \\) ! -path \"*/node_modules/*\" | xargs $(bazel info bazel-bin)/external/com_github_bazelbuild_buildtools/buildifier/buildifier",
|
||||
"preskylint": "bazel build --noshow_progress @io_bazel//src/tools/skylark/java/com/google/devtools/skylark/skylint:Skylint",
|
||||
"skylint": "find . -type f -name \"*.bzl\" ! -path \"*/node_modules/*\" ! -path \"./dist/*\" | xargs $(bazel info bazel-bin)/external/io_bazel/src/tools/skylark/java/com/google/devtools/skylark/skylint/Skylint",
|
||||
"prebuildifier": "bazel build --noshow_progress @com_github_bazelbuild_buildtools//buildifier",
|
||||
"buildifier": "find . -type f \\( -name BUILD -or -name BUILD.bazel \\) ! -path \"*/node_modules/*\" | xargs $(bazel info bazel-bin)/external/com_github_bazelbuild_buildtools/buildifier/buildifier",
|
||||
"preinstall": "node -e \"if(process.env.npm_execpath.indexOf('yarn') === -1) throw new Error('Please use Yarn instead of NPM to install dependencies. See: https://yarnpkg.com/lang/en/docs/install/')\"",
|
||||
"postinstall": "yarn update-webdriver",
|
||||
"update-webdriver": "webdriver-manager update --gecko false $CHROMEDRIVER_VERSION_ARG",
|
||||
@ -96,11 +99,11 @@
|
||||
"source-map-support": "0.4.18",
|
||||
"systemjs": "0.18.10",
|
||||
"ts-api-guardian": "0.2.2",
|
||||
"tsickle": "0.25.5",
|
||||
"tsickle": "0.26.0",
|
||||
"tslint": "5.7.0",
|
||||
"tslint-eslint-rules": "4.1.1",
|
||||
"tsutils": "2.12.1",
|
||||
"typescript": "2.5.x",
|
||||
"typescript": "2.6.x",
|
||||
"uglify-js": "2.8.29",
|
||||
"universal-analytics": "0.4.15",
|
||||
"vlq": "0.2.2",
|
||||
|
@ -6,7 +6,15 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
export interface DOMAnimation {
|
||||
/**
|
||||
* DOMAnimation represents the Animation Web API.
|
||||
*
|
||||
* It is an external API by the browser, and must thus use "declare interface",
|
||||
* to prevent renaming by Closure Compiler.
|
||||
*
|
||||
* @see https://developer.mozilla.org/de/docs/Web/API/Animation
|
||||
*/
|
||||
export declare interface DOMAnimation {
|
||||
cancel(): void;
|
||||
play(): void;
|
||||
pause(): void;
|
||||
|
@ -1,5 +1,3 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
|
@ -18,7 +18,7 @@ function createDiv() {
|
||||
return document.createElement('div');
|
||||
}
|
||||
|
||||
export function main() {
|
||||
{
|
||||
describe('Animation', () => {
|
||||
// these tests are only mean't to be run within the DOM (for now)
|
||||
if (typeof Element == 'undefined') return;
|
||||
|
@ -14,7 +14,7 @@ import {ENTER_CLASSNAME, LEAVE_CLASSNAME} from '../../src/util';
|
||||
import {MockAnimationDriver} from '../../testing';
|
||||
import {makeTrigger} from '../shared';
|
||||
|
||||
export function main() {
|
||||
{
|
||||
describe('AnimationTrigger', () => {
|
||||
// these tests are only mean't to be run within the DOM (for now)
|
||||
if (typeof Element == 'undefined') return;
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
import {WebAnimationsStyleNormalizer} from '../../../src/dsl/style_normalization/web_animations_style_normalizer';
|
||||
|
||||
export function main() {
|
||||
{
|
||||
describe('WebAnimationsStyleNormalizer', () => {
|
||||
const normalizer = new WebAnimationsStyleNormalizer();
|
||||
|
||||
|
@ -12,7 +12,7 @@ import {AnimationDriver} from '../../src/render/animation_driver';
|
||||
import {TimelineAnimationEngine} from '../../src/render/timeline_animation_engine';
|
||||
import {MockAnimationDriver, MockAnimationPlayer} from '../../testing/src/mock_animation_driver';
|
||||
|
||||
export function main() {
|
||||
(function() {
|
||||
const defaultDriver = new MockAnimationDriver();
|
||||
|
||||
function makeEngine(driver?: AnimationDriver, normalizer?: AnimationStyleNormalizer) {
|
||||
@ -93,7 +93,7 @@ export function main() {
|
||||
expect(player.keyframes).toEqual([{width: '*star*', offset: 0}, {width: '999px', offset: 1}]);
|
||||
});
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
function invokeAnimation(
|
||||
engine: TimelineAnimationEngine, element: any, steps: AnimationMetadata | AnimationMetadata[],
|
||||
|
@ -16,7 +16,7 @@ import {MockAnimationDriver, MockAnimationPlayer} from '../../testing/src/mock_a
|
||||
|
||||
const DEFAULT_NAMESPACE_ID = 'id';
|
||||
|
||||
export function main() {
|
||||
(function() {
|
||||
const driver = new MockAnimationDriver();
|
||||
|
||||
// these tests are only mean't to be run within the DOM
|
||||
@ -616,7 +616,7 @@ export function main() {
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
class SuffixNormalizer extends AnimationStyleNormalizer {
|
||||
constructor(private _suffix: string) { super(); }
|
||||
|
@ -8,7 +8,7 @@
|
||||
import {DOMAnimation} from '../../../src/render/web_animations/dom_animation';
|
||||
import {WebAnimationsPlayer} from '../../../src/render/web_animations/web_animations_player';
|
||||
|
||||
export function main() {
|
||||
{
|
||||
let element: any;
|
||||
let innerPlayer: MockDomAnimation|null = null;
|
||||
beforeEach(() => {
|
||||
|
@ -33,17 +33,17 @@ export class AnimationGroupPlayer implements AnimationPlayer {
|
||||
} else {
|
||||
this.players.forEach(player => {
|
||||
player.onDone(() => {
|
||||
if (++doneCount >= total) {
|
||||
if (++doneCount == total) {
|
||||
this._onFinish();
|
||||
}
|
||||
});
|
||||
player.onDestroy(() => {
|
||||
if (++destroyCount >= total) {
|
||||
if (++destroyCount == total) {
|
||||
this._onDestroy();
|
||||
}
|
||||
});
|
||||
player.onStart(() => {
|
||||
if (++startCount >= total) {
|
||||
if (++startCount == total) {
|
||||
this._onStart();
|
||||
}
|
||||
});
|
||||
@ -67,9 +67,9 @@ export class AnimationGroupPlayer implements AnimationPlayer {
|
||||
|
||||
private _onStart() {
|
||||
if (!this.hasStarted()) {
|
||||
this._started = true;
|
||||
this._onStartFns.forEach(fn => fn());
|
||||
this._onStartFns = [];
|
||||
this._started = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
|
@ -10,7 +10,7 @@ import {flushMicrotasks} from '../../core/testing/src/fake_async';
|
||||
import {NoopAnimationPlayer} from '../src/players/animation_player';
|
||||
import {scheduleMicroTask} from '../src/util';
|
||||
|
||||
export function main() {
|
||||
{
|
||||
describe('NoopAnimationPlayer', function() {
|
||||
it('should finish after the next microtask once started', fakeAsync(() => {
|
||||
const log: string[] = [];
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
import {scheduleMicroTask} from '../src/util';
|
||||
|
||||
export function main() {
|
||||
{
|
||||
describe('util', () => {
|
||||
it('should schedule a microtask and not call an async timeout', (done) => {
|
||||
let count = 0;
|
||||
|
@ -3,7 +3,10 @@
|
||||
# Use of this source code is governed by an MIT-style license that can be
|
||||
# found in the LICENSE file at https://angular.io/license
|
||||
""" Public API surface is re-exported here.
|
||||
|
||||
Users should not load files under "/src"
|
||||
"""
|
||||
|
||||
load("//src:ng_module.bzl", "ng_module")
|
||||
load("//src:ng_module.bzl", _ng_module = "ng_module")
|
||||
|
||||
ng_module = _ng_module
|
||||
|
@ -6,7 +6,7 @@
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@angular/compiler-cli": "0.0.0-PLACEHOLDER",
|
||||
"typescript": ">=2.4.2 <2.6"
|
||||
"typescript": ">=2.4.2 <2.7"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": "6.0.84"
|
||||
|
@ -2,6 +2,8 @@
|
||||
#
|
||||
# Use of this source code is governed by an MIT-style license that can be
|
||||
# found in the LICENSE file at https://angular.io/license
|
||||
"""Implementation of the ng_module rule.
|
||||
"""
|
||||
|
||||
load(":rules_typescript.bzl",
|
||||
"tsc_wrapped_tsconfig",
|
||||
@ -10,20 +12,17 @@ load(":rules_typescript.bzl",
|
||||
"compile_ts",
|
||||
"DEPS_ASPECTS",
|
||||
"ts_providers_dict_to_struct",
|
||||
"json_marshal",
|
||||
)
|
||||
|
||||
# Calculate the expected output of the template compiler for every source in
|
||||
# in the library. Most of these will be produced as empty files but it is
|
||||
# unknown, without parsing, which will be empty.
|
||||
def _expected_outs(ctx, label):
|
||||
def _expected_outs(ctx):
|
||||
devmode_js_files = []
|
||||
closure_js_files = []
|
||||
declaration_files = []
|
||||
summary_files = []
|
||||
|
||||
codegen_inputs = ctx.files.srcs
|
||||
|
||||
for src in ctx.files.srcs + ctx.files.assets:
|
||||
if src.short_path.endswith(".ts") and not src.short_path.endswith(".d.ts"):
|
||||
basename = src.short_path[len(ctx.label.package) + 1:-len(".ts")]
|
||||
@ -42,6 +41,9 @@ def _expected_outs(ctx, label):
|
||||
]
|
||||
summaries = []
|
||||
|
||||
else:
|
||||
continue
|
||||
|
||||
closure_js = [f.replace(".js", ".closure.js") for f in devmode_js]
|
||||
declarations = [f.replace(".js", ".d.ts") for f in devmode_js]
|
||||
|
||||
@ -61,7 +63,7 @@ def _expected_outs(ctx, label):
|
||||
)
|
||||
|
||||
def _ngc_tsconfig(ctx, files, srcs, **kwargs):
|
||||
outs = _expected_outs(ctx, ctx.label)
|
||||
outs = _expected_outs(ctx)
|
||||
if "devmode_manifest" in kwargs:
|
||||
expected_outs = outs.devmode_js + outs.declarations + outs.summaries
|
||||
else:
|
||||
@ -79,7 +81,7 @@ def _ngc_tsconfig(ctx, files, srcs, **kwargs):
|
||||
})
|
||||
|
||||
def _collect_summaries_aspect_impl(target, ctx):
|
||||
results = target.angular.summaries if hasattr(target, "angular") else depset()
|
||||
results = depset(target.angular.summaries if hasattr(target, "angular") else [])
|
||||
|
||||
# If we are visiting empty-srcs ts_library, this is a re-export
|
||||
srcs = ctx.rule.attr.srcs if hasattr(ctx.rule.attr, "srcs") else []
|
||||
@ -88,7 +90,7 @@ def _collect_summaries_aspect_impl(target, ctx):
|
||||
if not srcs:
|
||||
for dep in ctx.rule.attr.deps:
|
||||
if (hasattr(dep, "angular")):
|
||||
results += dep.angular.summaries
|
||||
results = depset(dep.angular.summaries, transitive = [results])
|
||||
|
||||
return struct(collect_summaries_aspect_result = results)
|
||||
|
||||
@ -104,10 +106,29 @@ _EXTRA_NODE_OPTIONS_FLAGS = [
|
||||
]
|
||||
|
||||
def ngc_compile_action(ctx, label, inputs, outputs, messages_out, config_file_path,
|
||||
locale=None, i18n_args=[]):
|
||||
locale=None, i18n_args=[]):
|
||||
"""Helper function to create the ngc action.
|
||||
|
||||
This is exposed for google3 to wire up i18n replay rules, and is not intended
|
||||
as part of the public API.
|
||||
|
||||
Args:
|
||||
ctx: skylark context
|
||||
label: the label of the ng_module being compiled
|
||||
inputs: passed to the ngc action's inputs
|
||||
outputs: passed to the ngc action's outputs
|
||||
messages_out: produced xmb files
|
||||
config_file_path: path to the tsconfig file
|
||||
locale: i18n locale, or None
|
||||
i18n_args: additional command-line arguments to ngc
|
||||
|
||||
Returns:
|
||||
the parameters of the compilation which will be used to replay the ngc action for i18N.
|
||||
"""
|
||||
|
||||
mnemonic = "AngularTemplateCompile"
|
||||
progress_message = "Compiling Angular templates (ngc) %s" % label
|
||||
supports_workers = "0"
|
||||
|
||||
if locale:
|
||||
mnemonic = "AngularI18NMerging"
|
||||
supports_workers = "0"
|
||||
@ -152,8 +173,6 @@ def ngc_compile_action(ctx, label, inputs, outputs, messages_out, config_file_pa
|
||||
progress_message = "Extracting Angular 2 messages (ng_xi18n)",
|
||||
mnemonic = "Angular2MessageExtractor")
|
||||
|
||||
# Return the parameters of the compilation which will be used to replay the
|
||||
# ngc action for i18N.
|
||||
if not locale and not ctx.attr.no_i18n:
|
||||
return struct(
|
||||
label = label,
|
||||
@ -162,46 +181,68 @@ def ngc_compile_action(ctx, label, inputs, outputs, messages_out, config_file_pa
|
||||
outputs = outputs,
|
||||
)
|
||||
|
||||
return None
|
||||
|
||||
def _compile_action(ctx, inputs, outputs, messages_out, config_file_path):
|
||||
summaries = depset()
|
||||
for dep in ctx.attr.deps:
|
||||
if hasattr(dep, "collect_summaries_aspect_result"):
|
||||
summaries += dep.collect_summaries_aspect_result
|
||||
|
||||
action_inputs = inputs + summaries.to_list() + ctx.files.assets
|
||||
# print("ASSETS", [a.path for a in ctx.files.assets])
|
||||
# print("INPUTS", ctx.label, [o.path for o in summaries if o.path.find("core/src") > 0])
|
||||
# Give the Angular compiler all the user-listed assets
|
||||
file_inputs = list(ctx.files.assets)
|
||||
|
||||
# The compiler only needs to see TypeScript sources from the npm dependencies,
|
||||
# but may need to look at package.json and ngsummary.json files as well.
|
||||
if hasattr(ctx.attr, "node_modules"):
|
||||
action_inputs += [f for f in ctx.files.node_modules
|
||||
if f.path.endswith(".ts") or f.path.endswith(".json")]
|
||||
file_inputs += [f for f in ctx.files.node_modules
|
||||
if f.path.endswith(".ts") or f.path.endswith(".json")]
|
||||
|
||||
# If the user supplies a tsconfig.json file, the Angular compiler needs to read it
|
||||
if hasattr(ctx.attr, "tsconfig") and ctx.file.tsconfig:
|
||||
action_inputs += [ctx.file.tsconfig]
|
||||
file_inputs.append(ctx.file.tsconfig)
|
||||
|
||||
# Collect the inputs and summary files from our deps
|
||||
action_inputs = depset(file_inputs,
|
||||
transitive = [inputs] + [dep.collect_summaries_aspect_result for dep in ctx.attr.deps
|
||||
if hasattr(dep, "collect_summaries_aspect_result")])
|
||||
|
||||
return ngc_compile_action(ctx, ctx.label, action_inputs, outputs, messages_out, config_file_path)
|
||||
|
||||
|
||||
def _prodmode_compile_action(ctx, inputs, outputs, config_file_path):
|
||||
outs = _expected_outs(ctx, ctx.label)
|
||||
outs = _expected_outs(ctx)
|
||||
return _compile_action(ctx, inputs, outputs + outs.closure_js, outs.i18n_messages, config_file_path)
|
||||
|
||||
def _devmode_compile_action(ctx, inputs, outputs, config_file_path):
|
||||
outs = _expected_outs(ctx, ctx.label)
|
||||
outs = _expected_outs(ctx)
|
||||
_compile_action(ctx, inputs, outputs + outs.devmode_js + outs.declarations + outs.summaries, None, config_file_path)
|
||||
|
||||
def _ts_expected_outs(ctx, label):
|
||||
# rules_typescript expects a function with two arguments, but our
|
||||
# implementation doesn't use the label
|
||||
_ignored = [label]
|
||||
return _expected_outs(ctx)
|
||||
|
||||
def ng_module_impl(ctx, ts_compile_actions):
|
||||
"""Implementation function for the ng_module rule.
|
||||
|
||||
This is exposed so that google3 can have its own entry point that re-uses this
|
||||
and is not meant as a public API.
|
||||
|
||||
Args:
|
||||
ctx: the skylark rule context
|
||||
ts_compile_actions: generates all the actions to run an ngc compilation
|
||||
|
||||
Returns:
|
||||
the result of the ng_module rule as a dict, suitable for
|
||||
conversion by ts_providers_dict_to_struct
|
||||
"""
|
||||
|
||||
providers = ts_compile_actions(
|
||||
ctx, is_library=True, compile_action=_prodmode_compile_action,
|
||||
devmode_compile_action=_devmode_compile_action,
|
||||
tsc_wrapped_tsconfig=_ngc_tsconfig,
|
||||
outputs = _expected_outs)
|
||||
outputs = _ts_expected_outs)
|
||||
|
||||
#addl_declarations = [_expected_outs(ctx)]
|
||||
#providers["typescript"]["declarations"] += addl_declarations
|
||||
#providers["typescript"]["transitive_declarations"] += addl_declarations
|
||||
outs = _expected_outs(ctx, ctx.label)
|
||||
outs = _expected_outs(ctx)
|
||||
providers["angular"] = {
|
||||
"summaries": _expected_outs(ctx, ctx.label).summaries
|
||||
"summaries": _expected_outs(ctx).summaries
|
||||
}
|
||||
providers["ngc_messages"] = outs.i18n_messages
|
||||
|
||||
@ -240,7 +281,7 @@ NG_MODULE_ATTRIBUTES = {
|
||||
|
||||
ng_module = rule(
|
||||
implementation = _ng_module_impl,
|
||||
attrs = COMMON_ATTRIBUTES + NG_MODULE_ATTRIBUTES + {
|
||||
attrs = dict(dict(COMMON_ATTRIBUTES, **NG_MODULE_ATTRIBUTES), **{
|
||||
"tsconfig": attr.label(allow_files = True, single_file = True),
|
||||
|
||||
# @// is special syntax for the "main" repository
|
||||
@ -249,6 +290,6 @@ ng_module = rule(
|
||||
"node_modules": attr.label(
|
||||
default = Label("@//:node_modules")
|
||||
),
|
||||
},
|
||||
}),
|
||||
outputs = COMMON_OUTPUTS,
|
||||
)
|
||||
|
@ -27,6 +27,8 @@ const ALLOW_NON_HERMETIC_READS = true;
|
||||
// Note: We compile the content of node_modules with plain ngc command line.
|
||||
const ALL_DEPS_COMPILED_WITH_BAZEL = false;
|
||||
|
||||
const NODE_MODULES = 'node_modules/';
|
||||
|
||||
export function main(args) {
|
||||
if (runAsWorker(args)) {
|
||||
runWorkerLoop(runOneBuild);
|
||||
@ -175,7 +177,11 @@ export function compile({allowNonHermeticReads, allDepsCompiledWithBazel = true,
|
||||
ngHost.amdModuleName) {
|
||||
return ngHost.amdModuleName({ fileName: importedFilePath } as ts.SourceFile);
|
||||
}
|
||||
return relativeToRootDirs(importedFilePath, compilerOpts.rootDirs).replace(EXT, '');
|
||||
const result = relativeToRootDirs(importedFilePath, compilerOpts.rootDirs).replace(EXT, '');
|
||||
if (result.startsWith(NODE_MODULES)) {
|
||||
return result.substr(NODE_MODULES.length);
|
||||
}
|
||||
return bazelOpts.workspaceName + '/' + result;
|
||||
};
|
||||
ngHost.toSummaryFileName = (fileName: string, referringSrcFileName: string) =>
|
||||
relativeToRootDirs(fileName, compilerOpts.rootDirs).replace(EXT, '');
|
||||
|
@ -1,12 +1,26 @@
|
||||
# Allows different paths for these imports in google3
|
||||
load("@build_bazel_rules_typescript//internal:build_defs.bzl", "tsc_wrapped_tsconfig")
|
||||
"""Allows different paths for these imports in google3.
|
||||
"""
|
||||
|
||||
load("@build_bazel_rules_typescript//internal:common/compilation.bzl",
|
||||
"COMMON_ATTRIBUTES",
|
||||
"COMMON_OUTPUTS",
|
||||
"compile_ts",
|
||||
"DEPS_ASPECTS",
|
||||
"ts_providers_dict_to_struct",
|
||||
load("@build_bazel_rules_typescript//internal:build_defs.bzl",
|
||||
_tsc_wrapped_tsconfig = "tsc_wrapped_tsconfig",
|
||||
)
|
||||
|
||||
load("@build_bazel_rules_typescript//internal:common/json_marshal.bzl", "json_marshal")
|
||||
load("@build_bazel_rules_typescript//internal:common/compilation.bzl",
|
||||
_COMMON_ATTRIBUTES = "COMMON_ATTRIBUTES",
|
||||
_COMMON_OUTPUTS = "COMMON_OUTPUTS",
|
||||
_compile_ts = "compile_ts",
|
||||
_DEPS_ASPECTS = "DEPS_ASPECTS",
|
||||
_ts_providers_dict_to_struct = "ts_providers_dict_to_struct",
|
||||
)
|
||||
|
||||
load("@build_bazel_rules_typescript//internal:common/json_marshal.bzl",
|
||||
_json_marshal = "json_marshal",
|
||||
)
|
||||
|
||||
tsc_wrapped_tsconfig = _tsc_wrapped_tsconfig
|
||||
COMMON_ATTRIBUTES = _COMMON_ATTRIBUTES
|
||||
COMMON_OUTPUTS = _COMMON_OUTPUTS
|
||||
compile_ts = _compile_ts
|
||||
DEPS_ASPECTS = _DEPS_ASPECTS
|
||||
ts_providers_dict_to_struct = _ts_providers_dict_to_struct
|
||||
json_marshal = _json_marshal
|
||||
|
@ -249,6 +249,9 @@ export class PerflogMetric extends Metric {
|
||||
// not all events have been received, no further processing for now
|
||||
return null;
|
||||
}
|
||||
if (markStartEvent.pid !== markEndEvent.pid) {
|
||||
result['invalid'] = 1;
|
||||
}
|
||||
|
||||
let gcTimeInScript = 0;
|
||||
let renderTimeInScript = 0;
|
||||
|
@ -63,7 +63,12 @@ export class Sampler {
|
||||
}
|
||||
return resultPromise.then((_) => this._driver.waitFor(this._execute))
|
||||
.then((_) => this._metric.endMeasure(this._prepare === Options.NO_PREPARE))
|
||||
.then((measureValues) => this._report(lastState, measureValues));
|
||||
.then((measureValues) => {
|
||||
if (!!measureValues['invalid']) {
|
||||
return lastState;
|
||||
}
|
||||
return this._report(lastState, measureValues);
|
||||
});
|
||||
}
|
||||
|
||||
private _report(state: SampleState, metricValues: {[key: string]: any}): Promise<SampleState> {
|
||||
|
@ -34,7 +34,9 @@ export class SeleniumWebDriverAdapter extends WebDriverAdapter {
|
||||
capabilities(): Promise<{[key: string]: any}> {
|
||||
return this._driver.getCapabilities().then((capsObject: any) => {
|
||||
const localData: {[key: string]: any} = {};
|
||||
capsObject.forEach((value: any, key: string) => { localData[key] = value; });
|
||||
for (const key of capsObject.keys()) {
|
||||
localData[key] = capsObject.get(key);
|
||||
}
|
||||
return localData;
|
||||
});
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ function assertEventsEqual(actualEvents: any[], expectedEvents: any[]) {
|
||||
}
|
||||
}
|
||||
|
||||
export function main() {
|
||||
{
|
||||
describe('convertPerfProfileToEvents', function() {
|
||||
it('should convert single instantaneous event', function() {
|
||||
const profileData = {
|
||||
|
@ -10,7 +10,7 @@ import {AsyncTestCompleter, describe, expect, inject, it} from '@angular/core/te
|
||||
|
||||
import {Injector, Metric, MultiMetric} from '../../index';
|
||||
|
||||
export function main() {
|
||||
(function() {
|
||||
function createMetric(ids: any[]) {
|
||||
const m = Injector
|
||||
.create([
|
||||
@ -49,7 +49,7 @@ export function main() {
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
class MockMetric extends Metric {
|
||||
constructor(private _id: string) { super(); }
|
||||
|
@ -12,7 +12,7 @@ import {AsyncTestCompleter, beforeEach, describe, expect, inject, it} from '@ang
|
||||
import {Injector, Metric, Options, PerfLogEvent, PerfLogFeatures, PerflogMetric, WebDriverExtension} from '../../index';
|
||||
import {TraceEventFactory} from '../trace_event_factory';
|
||||
|
||||
export function main() {
|
||||
(function() {
|
||||
let commandLog: any[];
|
||||
const eventFactory = new TraceEventFactory('timeline', 'pid0');
|
||||
|
||||
@ -537,6 +537,24 @@ export function main() {
|
||||
});
|
||||
}));
|
||||
|
||||
it('should mark a run as invalid if the start and end marks are different',
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
const otherProcessEventFactory = new TraceEventFactory('timeline', 'pid1');
|
||||
const metric = createMetric(
|
||||
[[
|
||||
eventFactory.markStart('benchpress0', 0), eventFactory.start('script', 0, null),
|
||||
eventFactory.end('script', 5, null),
|
||||
otherProcessEventFactory.start('script', 10, null),
|
||||
otherProcessEventFactory.end('script', 17, null),
|
||||
otherProcessEventFactory.markEnd('benchpress0', 20)
|
||||
]],
|
||||
null !);
|
||||
metric.beginMeasure().then((_) => metric.endMeasure(false)).then((data) => {
|
||||
expect(data['invalid']).toBe(1);
|
||||
async.done();
|
||||
});
|
||||
}));
|
||||
|
||||
it('should support scriptTime metric',
|
||||
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
|
||||
aggregate([
|
||||
@ -680,7 +698,7 @@ export function main() {
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
class MockDriverExtension extends WebDriverExtension {
|
||||
constructor(
|
||||
|
@ -11,7 +11,7 @@ import {AsyncTestCompleter, describe, expect, inject, it} from '@angular/core/te
|
||||
|
||||
import {Options, PerfLogEvent, PerfLogFeatures, UserMetric, WebDriverAdapter} from '../../index';
|
||||
|
||||
export function main() {
|
||||
(function() {
|
||||
let wdAdapter: MockDriverAdapter;
|
||||
|
||||
function createMetric(
|
||||
@ -63,7 +63,7 @@ export function main() {
|
||||
}), 600);
|
||||
});
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
class MockDriverAdapter extends WebDriverAdapter {
|
||||
data: any = {};
|
||||
|
@ -11,7 +11,7 @@ import {describe, expect, it} from '@angular/core/testing/src/testing_internal';
|
||||
|
||||
import {ConsoleReporter, Injector, MeasureValues, SampleDescription} from '../../index';
|
||||
|
||||
export function main() {
|
||||
{
|
||||
describe('console reporter', () => {
|
||||
let reporter: ConsoleReporter;
|
||||
let log: string[];
|
||||
|
@ -10,7 +10,7 @@ import {AsyncTestCompleter, describe, expect, inject, it} from '@angular/core/te
|
||||
|
||||
import {Injector, JsonFileReporter, MeasureValues, Options, SampleDescription} from '../../index';
|
||||
|
||||
export function main() {
|
||||
{
|
||||
describe('file reporter', () => {
|
||||
let loggedFile: any;
|
||||
|
||||
|
@ -10,7 +10,7 @@ import {AsyncTestCompleter, describe, expect, inject, it} from '@angular/core/te
|
||||
|
||||
import {Injector, MeasureValues, MultiReporter, Reporter} from '../../index';
|
||||
|
||||
export function main() {
|
||||
(function() {
|
||||
function createReporters(ids: any[]) {
|
||||
const r = Injector
|
||||
.create([
|
||||
@ -51,7 +51,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
class MockReporter extends Reporter {
|
||||
constructor(private _id: string) { super(); }
|
||||
|
@ -10,7 +10,7 @@ import {AsyncTestCompleter, describe, expect, inject, it} from '@angular/core/te
|
||||
|
||||
import {Injector, Metric, Options, Runner, SampleDescription, SampleState, Sampler, Validator, WebDriverAdapter} from '../index';
|
||||
|
||||
export function main() {
|
||||
{
|
||||
describe('runner', () => {
|
||||
let injector: Injector;
|
||||
let runner: Runner;
|
||||
|
@ -10,7 +10,7 @@ import {AsyncTestCompleter, describe, expect, inject, it} from '@angular/core/te
|
||||
|
||||
import {Injector, MeasureValues, Metric, Options, Reporter, Sampler, Validator, WebDriverAdapter} from '../index';
|
||||
|
||||
export function main() {
|
||||
{
|
||||
const EMPTY_EXECUTE = () => {};
|
||||
|
||||
describe('sampler', () => {
|
||||
|
@ -9,7 +9,7 @@
|
||||
import {describe, expect, it} from '@angular/core/testing/src/testing_internal';
|
||||
import {Statistic} from '../src/statistic';
|
||||
|
||||
export function main() {
|
||||
{
|
||||
describe('statistic', () => {
|
||||
|
||||
it('should calculate the mean', () => {
|
||||
|
@ -10,7 +10,7 @@ import {describe, expect, it} from '@angular/core/testing/src/testing_internal';
|
||||
|
||||
import {Injector, MeasureValues, RegressionSlopeValidator} from '../../index';
|
||||
|
||||
export function main() {
|
||||
{
|
||||
describe('regression slope validator', () => {
|
||||
let validator: RegressionSlopeValidator;
|
||||
|
||||
|
@ -10,7 +10,7 @@ import {describe, expect, it} from '@angular/core/testing/src/testing_internal';
|
||||
|
||||
import {Injector, MeasureValues, SizeValidator} from '../../index';
|
||||
|
||||
export function main() {
|
||||
{
|
||||
describe('size validator', () => {
|
||||
let validator: SizeValidator;
|
||||
|
||||
|
@ -10,7 +10,7 @@ import {AsyncTestCompleter, describe, expect, inject, it} from '@angular/core/te
|
||||
|
||||
import {Injector, Options, WebDriverExtension} from '../index';
|
||||
|
||||
export function main() {
|
||||
(function() {
|
||||
function createExtension(ids: any[], caps: any) {
|
||||
return new Promise<any>((res, rej) => {
|
||||
try {
|
||||
@ -45,7 +45,7 @@ export function main() {
|
||||
});
|
||||
}));
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
class MockExtension extends WebDriverExtension {
|
||||
constructor(public id: string) { super(); }
|
||||
|
@ -11,7 +11,7 @@ import {AsyncTestCompleter, describe, expect, iit, inject, it} from '@angular/co
|
||||
import {ChromeDriverExtension, Injector, Options, WebDriverAdapter, WebDriverExtension} from '../../index';
|
||||
import {TraceEventFactory} from '../trace_event_factory';
|
||||
|
||||
export function main() {
|
||||
{
|
||||
describe('chrome driver extension', () => {
|
||||
const CHROME45_USER_AGENT =
|
||||
'"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2499.0 Safari/537.36"';
|
||||
|
@ -11,7 +11,7 @@ import {AsyncTestCompleter, describe, expect, inject, it} from '@angular/core/te
|
||||
import {IOsDriverExtension, Injector, WebDriverAdapter, WebDriverExtension} from '../../index';
|
||||
import {TraceEventFactory} from '../trace_event_factory';
|
||||
|
||||
export function main() {
|
||||
{
|
||||
describe('ios driver extension', () => {
|
||||
let log: any[];
|
||||
let extension: IOsDriverExtension;
|
||||
|
@ -15,7 +15,7 @@ import {HttpClient} from '../src/client';
|
||||
import {HttpErrorResponse, HttpEventType, HttpResponse} from '../src/response';
|
||||
import {HttpClientTestingBackend} from '../testing/src/backend';
|
||||
|
||||
export function main() {
|
||||
{
|
||||
describe('HttpClient', () => {
|
||||
let client: HttpClient = null !;
|
||||
let backend: HttpClientTestingBackend = null !;
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
import {HttpHeaders} from '../src/headers';
|
||||
|
||||
export function main() {
|
||||
{
|
||||
describe('HttpHeaders', () => {
|
||||
|
||||
describe('initialization', () => {
|
||||
|
@ -24,7 +24,7 @@ function runOnlyCallback(home: any, data: Object) {
|
||||
|
||||
const SAMPLE_REQ = new HttpRequest<never>('JSONP', '/test');
|
||||
|
||||
export function main() {
|
||||
{
|
||||
describe('JsonpClientBackend', () => {
|
||||
let home = {};
|
||||
let document: MockDocument;
|
||||
|
@ -47,7 +47,7 @@ class InterceptorB extends TestInterceptor {
|
||||
constructor() { super('B'); }
|
||||
}
|
||||
|
||||
export function main() {
|
||||
{
|
||||
describe('HttpClientModule', () => {
|
||||
let injector: Injector;
|
||||
beforeEach(() => {
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
import {HttpParams} from '../src/params';
|
||||
|
||||
export function main() {
|
||||
{
|
||||
describe('HttpUrlEncodedParams', () => {
|
||||
describe('initialization', () => {
|
||||
it('should be empty at construction', () => {
|
||||
|
@ -15,7 +15,7 @@ import {HttpRequest} from '../src/request';
|
||||
const TEST_URL = 'http://angular.io';
|
||||
const TEST_STRING = `I'm a body!`;
|
||||
|
||||
export function main() {
|
||||
{
|
||||
describe('HttpRequest', () => {
|
||||
describe('constructor', () => {
|
||||
it('initializes url', () => {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user