From 0c344715e50ed3a3b3d1ee539dbd0d160965a376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matias=20Niemel=C3=A4?= Date: Mon, 24 Sep 2018 14:51:54 -0700 Subject: [PATCH] feat(ivy): expose a series of helpful application inspection tools (#25919) PR Close #25919 --- integration/cli-hello-world/package.json | 10 +- integration/cli-hello-world/yarn.lock | 580 ++++++++++++++---- .../core/src/render3/context_discovery.ts | 17 +- packages/core/src/render3/discovery_utils.ts | 143 +++++ packages/core/src/render3/instructions.ts | 6 +- .../bundle.golden_symbols.json | 4 +- .../core/test/render3/discovery_utils_spec.ts | 269 ++++++++ 7 files changed, 894 insertions(+), 135 deletions(-) create mode 100644 packages/core/src/render3/discovery_utils.ts create mode 100644 packages/core/test/render3/discovery_utils_spec.ts diff --git a/integration/cli-hello-world/package.json b/integration/cli-hello-world/package.json index 2486ce07da..6e37c39d64 100644 --- a/integration/cli-hello-world/package.json +++ b/integration/cli-hello-world/package.json @@ -3,13 +3,13 @@ "version": "0.0.0", "license": "MIT", "scripts": { - "build": "ng build --prod --progress false", + "build": "ng build --prod --progress=false", "e2e": "ng e2e", "lint": "ng lint", "ng": "ng", - "postinstall": "webdriver-manager update --gecko false --standalone false $CHROMEDRIVER_VERSION_ARG", + "postinstall": "webdriver-manager update --gecko=false --standalone=false $CHROMEDRIVER_VERSION_ARG", "start": "ng serve", - "test": "ng test && ng e2e --webdriver-update=false && ng e2e --prod --webdriver-update=false" + "test": "ng test --progress=false && ng e2e --webdriver-update=false && ng e2e --prod --webdriver-update=false" }, "private": true, "dependencies": { @@ -28,7 +28,7 @@ }, "devDependencies": { "@angular-devkit/build-angular": "~0.5.0", - "@angular/cli": "^6.0.0-rc.5", + "@angular/cli": "7.0.0-beta.4", "@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli", "@angular/language-service": "file:../../dist/packages-dist/language-service", "@types/jasmine": "~2.8.3", @@ -47,4 +47,4 @@ "tslint": "~5.9.1", "typescript": "file:../../node_modules/typescript" } -} +} \ No newline at end of file diff --git a/integration/cli-hello-world/yarn.lock b/integration/cli-hello-world/yarn.lock index 038b912b3b..c47d995ee7 100644 --- a/integration/cli-hello-world/yarn.lock +++ b/integration/cli-hello-world/yarn.lock @@ -9,6 +9,13 @@ "@angular-devkit/core" "0.5.7" rxjs "^6.0.0-beta.3" +"@angular-devkit/architect@0.9.0-beta.4": + version "0.9.0-beta.4" + resolved "https://registry.yarnpkg.com/@angular-devkit/architect/-/architect-0.9.0-beta.4.tgz#4b1fda15f6fbc11f0bc95ba7ac9db140d8554403" + dependencies: + "@angular-devkit/core" "7.0.0-beta.4" + rxjs "6.2.2" + "@angular-devkit/build-angular@~0.5.0": version "0.5.7" resolved "https://registry.yarnpkg.com/@angular-devkit/build-angular/-/build-angular-0.5.7.tgz#a28f3fa88a8b62720cd7b96583d0ed3e2ec353dd" @@ -84,94 +91,100 @@ rxjs "^6.0.0-beta.3" source-map "^0.5.6" -"@angular-devkit/schematics@0.5.7": - version "0.5.7" - resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-0.5.7.tgz#a3780798147451d2455960060c22d7b499655e4a" +"@angular-devkit/core@7.0.0-beta.4": + version "7.0.0-beta.4" + resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-7.0.0-beta.4.tgz#404b6ebb99b9a96b0f7586de9945392b669174cf" dependencies: - "@angular-devkit/core" "0.5.7" - "@ngtools/json-schema" "^1.1.0" - rxjs "^6.0.0-beta.3" + ajv "6.5.3" + chokidar "2.0.4" + fast-json-stable-stringify "2.0.0" + rxjs "6.2.2" + source-map "0.7.3" + +"@angular-devkit/schematics@7.0.0-beta.4": + version "7.0.0-beta.4" + resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-7.0.0-beta.4.tgz#a3bb50e0b61c97efa9bb9a35806308bc31d4bddb" + dependencies: + "@angular-devkit/core" "7.0.0-beta.4" + rxjs "6.2.2" "@angular/animations@file:../../dist/packages-dist/animations": - version "6.0.0-rc.5" + version "7.0.0-beta.6-23ec88ef2" dependencies: tslib "^1.9.0" -"@angular/cli@^6.0.0-rc.5": - version "6.0.0-rc.5" - resolved "https://registry.yarnpkg.com/@angular/cli/-/cli-6.0.0-rc.5.tgz#7eeb00697342b7e0412abcdf0b3c3a4c6b85dd56" +"@angular/cli@7.0.0-beta.4": + version "7.0.0-beta.4" + resolved "https://registry.yarnpkg.com/@angular/cli/-/cli-7.0.0-beta.4.tgz#c306d420acdaaf0cf64292c3899c4cc0f9f361cf" dependencies: - "@angular-devkit/architect" "0.5.7" - "@angular-devkit/core" "0.5.7" - "@angular-devkit/schematics" "0.5.7" - "@schematics/angular" "0.5.7" - "@schematics/update" "0.5.7" - chalk "~2.2.0" - fs-extra "^4.0.0" - node-modules-path "^1.0.0" - opn "~5.1.0" - resolve "^1.1.7" - rxjs "^6.0.0-turbo-rc.4" - semver "^5.1.0" - silent-error "^1.0.0" - symbol-observable "^1.2.0" - yargs-parser "^9.0.2" + "@angular-devkit/architect" "0.9.0-beta.4" + "@angular-devkit/core" "7.0.0-beta.4" + "@angular-devkit/schematics" "7.0.0-beta.4" + "@schematics/angular" "7.0.0-beta.4" + "@schematics/update" "0.9.0-beta.4" + inquirer "6.2.0" + opn "5.3.0" + rxjs "6.2.2" + semver "5.5.1" + symbol-observable "1.2.0" "@angular/common@file:../../dist/packages-dist/common": - version "6.0.0-rc.5" + version "7.0.0-beta.6-23ec88ef2" dependencies: tslib "^1.9.0" "@angular/compiler-cli@file:../../dist/packages-dist/compiler-cli": - version "6.0.0-rc.5" + version "7.0.0-beta.6-23ec88ef2" dependencies: + canonical-path "0.0.2" chokidar "^1.4.2" + convert-source-map "^1.5.1" + dependency-graph "^0.7.2" + magic-string "^0.25.0" minimist "^1.2.0" reflect-metadata "^0.1.2" - tsickle "^0.29.0" + shelljs "^0.8.1" + source-map "^0.6.1" + yargs "9.0.1" "@angular/compiler@file:../../dist/packages-dist/compiler": - version "6.0.0-rc.5" + version "7.0.0-beta.6-23ec88ef2" dependencies: tslib "^1.9.0" "@angular/core@file:../../dist/packages-dist/core": - version "6.0.0-rc.5" + version "7.0.0-beta.6-23ec88ef2" dependencies: tslib "^1.9.0" "@angular/forms@file:../../dist/packages-dist/forms": - version "6.0.0-rc.5" + version "7.0.0-beta.6-23ec88ef2" dependencies: tslib "^1.9.0" "@angular/http@file:../../dist/packages-dist/http": - version "6.0.0-rc.5" + version "7.0.0-beta.6-23ec88ef2" dependencies: tslib "^1.9.0" "@angular/language-service@file:../../dist/packages-dist/language-service": - version "6.0.0-rc.5" + version "7.0.0-beta.6-23ec88ef2" "@angular/platform-browser-dynamic@file:../../dist/packages-dist/platform-browser-dynamic": - version "6.0.0-rc.5" + version "7.0.0-beta.6-23ec88ef2" dependencies: tslib "^1.9.0" "@angular/platform-browser@file:../../dist/packages-dist/platform-browser": - version "6.0.0-rc.5" + version "7.0.0-beta.6-23ec88ef2" dependencies: tslib "^1.9.0" "@angular/router@file:../../dist/packages-dist/router": - version "6.0.0-rc.5" + version "7.0.0-beta.6-23ec88ef2" dependencies: tslib "^1.9.0" -"@ngtools/json-schema@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@ngtools/json-schema/-/json-schema-1.1.0.tgz#c3a0c544d62392acc2813a42c8a0dc6f58f86922" - "@ngtools/webpack@6.0.0-rc.5": version "6.0.0-rc.5" resolved "https://registry.yarnpkg.com/@ngtools/webpack/-/webpack-6.0.0-rc.5.tgz#841c7cc8cde31e195e46703fcd925330f3cb2727" @@ -180,23 +193,24 @@ tree-kill "^1.0.0" webpack-sources "^1.1.0" -"@schematics/angular@0.5.7": - version "0.5.7" - resolved "https://registry.yarnpkg.com/@schematics/angular/-/angular-0.5.7.tgz#4260ffc2728453697a42a58560666775f31bc74c" +"@schematics/angular@7.0.0-beta.4": + version "7.0.0-beta.4" + resolved "https://registry.yarnpkg.com/@schematics/angular/-/angular-7.0.0-beta.4.tgz#3fbb05b49ec0ef2daf142580751ef4e40e5c0eeb" dependencies: - "@angular-devkit/core" "0.5.7" - "@angular-devkit/schematics" "0.5.7" - typescript ">=2.6.2 <2.8" + "@angular-devkit/core" "7.0.0-beta.4" + "@angular-devkit/schematics" "7.0.0-beta.4" + typescript "3.0.1" -"@schematics/update@0.5.7": - version "0.5.7" - resolved "https://registry.yarnpkg.com/@schematics/update/-/update-0.5.7.tgz#9ae1ab70cc77a0d14c0148df2737dbcd3988fedd" +"@schematics/update@0.9.0-beta.4": + version "0.9.0-beta.4" + resolved "https://registry.yarnpkg.com/@schematics/update/-/update-0.9.0-beta.4.tgz#ec7539202047b752434bce65064d653a37afe538" dependencies: - "@angular-devkit/core" "0.5.7" - "@angular-devkit/schematics" "0.5.7" - rxjs "^6.0.0-beta.3" - semver "^5.3.0" - semver-intersect "^1.1.2" + "@angular-devkit/core" "7.0.0-beta.4" + "@angular-devkit/schematics" "7.0.0-beta.4" + npm-registry-client "8.6.0" + rxjs "6.2.2" + semver "5.5.1" + semver-intersect "1.4.0" "@types/jasmine@*": version "2.8.5" @@ -310,6 +324,15 @@ ajv-keywords@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.1.0.tgz#ac2b27939c543e95d2c06e7f7f5c27be4aa543be" +ajv@6.5.3: + version "6.5.3" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.5.3.tgz#71a569d189ecf4f4f321224fecb166f071dd90f9" + dependencies: + fast-deep-equal "^2.0.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + ajv@^4.9.1: version "4.11.8" resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536" @@ -357,6 +380,10 @@ amqplib@^0.5.2: readable-stream "1.x >=1.1.9" safe-buffer "^5.0.1" +ansi-escapes@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.1.0.tgz#f73207bb81207d75fd6c83f125af26eea378ca30" + ansi-html@0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/ansi-html/-/ansi-html-0.0.7.tgz#813584021962a9e9e6fd039f940d12f56ca7859e" @@ -1040,6 +1067,10 @@ builtin-status-codes@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" +builtins@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/builtins/-/builtins-1.0.3.tgz#cb94faeb61c8696451db36534e1422f94f0aee88" + bytes@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" @@ -1127,6 +1158,10 @@ caniuse-lite@^1.0.30000817, caniuse-lite@^1.0.30000821: version "1.0.30000824" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000824.tgz#de3bc1ba0bff4937302f8cb2a8632a8cc1c07f9a" +canonical-path@0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/canonical-path/-/canonical-path-0.0.2.tgz#e31eb937a8c93ee2a01df1839794721902874574" + caseless@~0.11.0: version "0.11.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.11.0.tgz#715b96ea9841593cc33067923f5ec60ebda4f7d7" @@ -1152,6 +1187,14 @@ chalk@^1.1.1, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" +chalk@^2.0.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.2.tgz#250dc96b07491bfd601e648d66ddf5f60c7a5c65" @@ -1160,7 +1203,7 @@ chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.3.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@~2.2.0, chalk@~2.2.2: +chalk@~2.2.2: version "2.2.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.2.2.tgz#4403f5cf18f35c05f51fbdf152bf588f956cf7cb" dependencies: @@ -1168,6 +1211,29 @@ chalk@~2.2.0, chalk@~2.2.2: escape-string-regexp "^1.0.5" supports-color "^4.0.0" +chardet@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" + +chokidar@2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.0.4.tgz#356ff4e2b0e8e43e322d18a372460bbcf3accd26" + dependencies: + anymatch "^2.0.0" + async-each "^1.0.0" + braces "^2.3.0" + glob-parent "^3.1.0" + inherits "^2.0.1" + is-binary-path "^1.0.0" + is-glob "^4.0.0" + lodash.debounce "^4.0.8" + normalize-path "^2.1.1" + path-is-absolute "^1.0.0" + readdirp "^2.0.0" + upath "^1.0.5" + optionalDependencies: + fsevents "^1.2.2" + chokidar@^1.4.1, chokidar@^1.4.2, chokidar@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468" @@ -1239,6 +1305,16 @@ clean-css@4.1.x, clean-css@^4.1.11: dependencies: source-map "0.5.x" +cli-cursor@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" + dependencies: + restore-cursor "^2.0.0" + +cli-width@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" + cliui@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" @@ -1388,7 +1464,7 @@ concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" -concat-stream@^1.5.0: +concat-stream@^1.5.0, concat-stream@^1.5.2: version "1.6.2" resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" dependencies: @@ -1444,6 +1520,12 @@ convert-source-map@^1.5.0: version "1.5.1" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.1.tgz#b8278097b9bc229365de5c62cf5fcaed8b5599e5" +convert-source-map@^1.5.1: + version "1.6.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.6.0.tgz#51b537a8c43e0f04dec1993bffcdd504e758ac20" + dependencies: + safe-buffer "~5.1.1" + convert-source-map@~1.1.0: version "1.1.3" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.1.3.tgz#4829c877e9fe49b3161f3bf3673888e204699860" @@ -1493,7 +1575,7 @@ core-js@^2.4.0: resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.4.tgz#f2c8bf181f2a80b92f360121429ce63a2f0aeae0" "core-js@file:../../node_modules/core-js": - version "2.5.1" + version "2.5.7" core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" @@ -1658,7 +1740,7 @@ debug@*, debug@^3.1.0: dependencies: ms "2.0.0" -debug@2, debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.6, debug@^2.6.8, debug@~2.6.4, debug@~2.6.6, debug@~2.6.9: +debug@2, debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.6, debug@^2.6.8, debug@~2.6.4, debug@~2.6.6, debug@~2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" dependencies: @@ -1682,6 +1764,10 @@ deep-equal@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5" +deep-extend@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" + deep-extend@~0.4.0: version "0.4.2" resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f" @@ -1773,6 +1859,10 @@ depd@~1.1.1, depd@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" +dependency-graph@^0.7.2: + version "0.7.2" + resolved "https://registry.yarnpkg.com/dependency-graph/-/dependency-graph-0.7.2.tgz#91db9de6eb72699209d88aea4c1fd5221cac1c49" + deps-sort@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/deps-sort/-/deps-sort-2.0.0.tgz#091724902e84658260eb910748cccd1af6e21fb5" @@ -2258,6 +2348,14 @@ extend@3, extend@^3.0.0, extend@~3.0.0, extend@~3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" +external-editor@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.0.3.tgz#5866db29a97826dbe4bf3afd24070ead9ea43a27" + dependencies: + chardet "^0.7.0" + iconv-lite "^0.4.24" + tmp "^0.0.33" + extglob@^0.3.1: version "0.3.2" resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" @@ -2289,7 +2387,11 @@ fast-deep-equal@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz#c053477817c86b51daa853c81e059b733d023614" -fast-json-stable-stringify@^2.0.0: +fast-deep-equal@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" + +fast-json-stable-stringify@2.0.0, fast-json-stable-stringify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" @@ -2313,6 +2415,12 @@ faye-websocket@~0.11.0: dependencies: websocket-driver ">=0.5.1" +figures@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" + dependencies: + escape-string-regexp "^1.0.5" + file-loader@^1.1.11: version "1.1.11" resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-1.1.11.tgz#6fe886449b0f2a936e43cabaac0cdbfb369506f8" @@ -2491,13 +2599,11 @@ fs-access@^1.0.0: dependencies: null-check "^1.0.0" -fs-extra@^4.0.0: - version "4.0.3" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94" +fs-minipass@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.5.tgz#06c277218454ec288df77ada54a03b8702aacb9d" dependencies: - graceful-fs "^4.1.2" - jsonfile "^4.0.0" - universalify "^0.1.0" + minipass "^2.2.1" fs-write-stream-atomic@^1.0.8: version "1.0.10" @@ -2519,6 +2625,13 @@ fsevents@^1.0.0, fsevents@^1.1.2: nan "^2.3.0" node-pre-gyp "^0.6.39" +fsevents@^1.2.2: + version "1.2.4" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.4.tgz#f41dcb1af2582af3692da36fc55cbd8e1041c426" + dependencies: + nan "^2.9.2" + node-pre-gyp "^0.10.0" + fstream-ignore@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/fstream-ignore/-/fstream-ignore-1.0.5.tgz#9c31dae34767018fe1d249b24dada67d092da105" @@ -2904,6 +3017,10 @@ hosted-git-info@^2.1.4: version "2.6.0" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.6.0.tgz#23235b29ab230c576aab0d4f13fc046b0b038222" +hosted-git-info@^2.6.0: + version "2.7.1" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" + hpack.js@^2.1.6: version "2.1.6" resolved "https://registry.yarnpkg.com/hpack.js/-/hpack.js-2.1.6.tgz#87774c0949e513f42e84575b3c45681fade2a0b2" @@ -3051,6 +3168,12 @@ iconv-lite@0.4.19: version "0.4.19" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" +iconv-lite@^0.4.24, iconv-lite@^0.4.4: + version "0.4.24" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + dependencies: + safer-buffer ">= 2.1.2 < 3" + ieee754@^1.1.4: version "1.1.11" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.11.tgz#c16384ffe00f5b7835824e67b6f2bd44a5229455" @@ -3059,6 +3182,12 @@ iferr@^0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/iferr/-/iferr-0.1.5.tgz#c60eed69e6d8fdb6b3104a1fcbca1c192dc5b501" +ignore-walk@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.1.tgz#a83e62e7d272ac0e3b551aaa82831a19b69f82f8" + dependencies: + minimatch "^3.0.4" + ignore@^3.3.5: version "3.3.7" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.7.tgz#612289bfb3c220e186a58118618d5be8c1bab021" @@ -3125,6 +3254,24 @@ inline-source-map@~0.6.0: dependencies: source-map "~0.5.3" +inquirer@6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.2.0.tgz#51adcd776f661369dc1e894859c2560a224abdd8" + dependencies: + ansi-escapes "^3.0.0" + chalk "^2.0.0" + cli-cursor "^2.1.0" + cli-width "^2.0.0" + external-editor "^3.0.0" + figures "^2.0.0" + lodash "^4.17.10" + mute-stream "0.0.7" + run-async "^2.2.0" + rxjs "^6.1.0" + string-width "^2.1.0" + strip-ansi "^4.0.0" + through "^2.3.6" + insert-module-globals@^7.0.0: version "7.0.1" resolved "https://registry.yarnpkg.com/insert-module-globals/-/insert-module-globals-7.0.1.tgz#c03bf4e01cb086d5b5e5ace8ad0afe7889d638c3" @@ -3144,6 +3291,10 @@ internal-ip@1.2.0: dependencies: meow "^3.3.0" +interpret@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.1.0.tgz#7ed1b1410c6a0e0f78cf95d3b8440c63f78b8614" + invariant@^2.2.2: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" @@ -3370,6 +3521,10 @@ is-primitive@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" +is-promise@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" + is-property@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" @@ -3605,6 +3760,10 @@ json-schema-traverse@^0.3.0: version "0.3.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + json-schema@0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" @@ -3633,12 +3792,6 @@ json5@^0.5.0: version "0.5.1" resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" -jsonfile@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" - optionalDependencies: - graceful-fs "^4.1.6" - jsonify@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" @@ -3876,6 +4029,10 @@ lodash.clonedeep@^4.3.2, lodash.clonedeep@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" +lodash.debounce@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" + lodash.memoize@~3.0.3: version "3.0.4" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-3.0.4.tgz#2dcbd2c287cbc0a55cc42328bd0c736150d53e3f" @@ -3896,6 +4053,10 @@ lodash@^4.15.0, lodash@^4.5.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" +lodash@^4.17.10: + version "4.17.11" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" + log-symbols@^2.1.0: version "2.2.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" @@ -3973,6 +4134,12 @@ lru-cache@~2.6.5: version "2.6.5" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-2.6.5.tgz#e56d6354148ede8d7707b58d143220fd08df0fd5" +magic-string@^0.25.0: + version "0.25.1" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.1.tgz#b1c248b399cd7485da0fe7385c2fc7011843266e" + dependencies: + sourcemap-codec "^1.4.1" + mailcomposer@4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/mailcomposer/-/mailcomposer-4.0.1.tgz#0e1c44b2a07cf740ee17dc149ba009f19cadfeb4" @@ -4177,6 +4344,19 @@ minimist@~0.0.1: version "0.0.10" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" +minipass@^2.2.1, minipass@^2.3.3: + version "2.3.4" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.3.4.tgz#4768d7605ed6194d6d576169b9e12ef71e9d9957" + dependencies: + safe-buffer "^5.1.2" + yallist "^3.0.0" + +minizlib@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.1.0.tgz#11e13658ce46bc3a70a267aac58359d1e0c29ceb" + dependencies: + minipass "^2.2.1" + mississippi@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/mississippi/-/mississippi-2.0.0.tgz#3442a508fafc28500486feea99409676e4ee5a6f" @@ -4262,10 +4442,18 @@ multicast-dns@^6.0.1: dns-packet "^1.3.1" thunky "^1.0.2" +mute-stream@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + nan@^2.10.0, nan@^2.3.0: version "2.10.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.10.0.tgz#96d0cd610ebd58d4b4de9cc0c6828cda99c7548f" +nan@^2.9.2: + version "2.11.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.11.0.tgz#574e360e4d954ab16966ec102c0c049fd961a099" + nanomatch@^1.2.9: version "1.2.9" resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.9.tgz#879f7150cb2dab7a471259066c104eee6e0fa7c2" @@ -4283,6 +4471,14 @@ nanomatch@^1.2.9: snapdragon "^0.8.1" to-regex "^3.0.1" +needle@^2.2.1: + version "2.2.4" + resolved "https://registry.yarnpkg.com/needle/-/needle-2.2.4.tgz#51931bff82533b1928b7d1d69e01f1b00ffd2a4e" + dependencies: + debug "^2.1.2" + iconv-lite "^0.4.4" + sax "^1.2.4" + negotiator@0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9" @@ -4351,9 +4547,20 @@ node-libs-browser@^2.0.0: util "^0.10.3" vm-browserify "0.0.4" -node-modules-path@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/node-modules-path/-/node-modules-path-1.0.1.tgz#40096b08ce7ad0ea14680863af449c7c75a5d1c8" +node-pre-gyp@^0.10.0: + version "0.10.3" + resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.10.3.tgz#3070040716afdc778747b61b6887bf78880b80fc" + dependencies: + detect-libc "^1.0.2" + mkdirp "^0.5.1" + needle "^2.2.1" + nopt "^4.0.1" + npm-packlist "^1.1.6" + npmlog "^4.0.2" + rc "^1.2.7" + rimraf "^2.6.1" + semver "^5.3.0" + tar "^4" node-pre-gyp@^0.6.39: version "0.6.39" @@ -4461,7 +4668,7 @@ nopt@^4.0.1: abbrev "1" osenv "^0.1.4" -normalize-package-data@^2.3.2, normalize-package-data@^2.3.4: +normalize-package-data@^2.3.2, normalize-package-data@^2.3.4, "normalize-package-data@~1.0.1 || ^2.0.0": version "2.4.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" dependencies: @@ -4480,13 +4687,51 @@ normalize-range@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/normalize-range/-/normalize-range-0.1.2.tgz#2d10c06bdfd312ea9777695a4d28439456b75942" +npm-bundled@^1.0.1: + version "1.0.5" + resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.0.5.tgz#3c1732b7ba936b3a10325aef616467c0ccbcc979" + +"npm-package-arg@^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-6.1.0.tgz#15ae1e2758a5027efb4c250554b85a737db7fcc1" + dependencies: + hosted-git-info "^2.6.0" + osenv "^0.1.5" + semver "^5.5.0" + validate-npm-package-name "^3.0.0" + +npm-packlist@^1.1.6: + version "1.1.11" + resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.1.11.tgz#84e8c683cbe7867d34b1d357d893ce29e28a02de" + dependencies: + ignore-walk "^3.0.1" + npm-bundled "^1.0.1" + +npm-registry-client@8.6.0: + version "8.6.0" + resolved "https://registry.yarnpkg.com/npm-registry-client/-/npm-registry-client-8.6.0.tgz#7f1529f91450732e89f8518e0f21459deea3e4c4" + dependencies: + concat-stream "^1.5.2" + graceful-fs "^4.1.6" + normalize-package-data "~1.0.1 || ^2.0.0" + npm-package-arg "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0" + once "^1.3.3" + request "^2.74.0" + retry "^0.10.0" + safe-buffer "^5.1.1" + semver "2 >=2.2.1 || 3.x || 4 || 5" + slide "^1.1.3" + ssri "^5.2.4" + optionalDependencies: + npmlog "2 || ^3.1.0 || ^4.0.0" + npm-run-path@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" dependencies: path-key "^2.0.0" -"npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.0, npmlog@^4.0.2: +"npmlog@0 || 1 || 2 || 3 || 4", "npmlog@2 || ^3.1.0 || ^4.0.0", npmlog@^4.0.0, npmlog@^4.0.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" dependencies: @@ -4583,18 +4828,18 @@ once@1.x, once@^1.3.0, once@^1.3.1, once@^1.3.3, once@^1.4.0: dependencies: wrappy "1" -opn@^5.1.0: +onetime@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" + dependencies: + mimic-fn "^1.0.0" + +opn@5.3.0, opn@^5.1.0: version "5.3.0" resolved "https://registry.yarnpkg.com/opn/-/opn-5.3.0.tgz#64871565c863875f052cfdf53d3e3cb5adb53b1c" dependencies: is-wsl "^1.1.0" -opn@~5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/opn/-/opn-5.1.0.tgz#72ce2306a17dbea58ff1041853352b4a8fc77519" - dependencies: - is-wsl "^1.1.0" - optimist@^0.6.1, optimist@~0.6.0: version "0.6.1" resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" @@ -4649,7 +4894,7 @@ os-tmpdir@^1.0.0, os-tmpdir@~1.0.1, os-tmpdir@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" -osenv@0, osenv@^0.1.4: +osenv@0, osenv@^0.1.4, osenv@^0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" dependencies: @@ -5177,6 +5422,15 @@ rc@^1.1.7: minimist "^1.2.0" strip-json-comments "~2.0.1" +rc@^1.2.7: + version "1.2.8" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" + dependencies: + deep-extend "^0.6.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~2.0.1" + read-cache@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/read-cache/-/read-cache-1.0.0.tgz#e664ef31161166c9751cdbe8dbcf86b5fb58f774" @@ -5281,6 +5535,12 @@ readdirp@^2.0.0: readable-stream "^2.0.2" set-immediate-shim "^1.0.1" +rechoir@^0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" + dependencies: + resolve "^1.1.6" + redent@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde" @@ -5564,16 +5824,33 @@ resolve@^1.1.3, resolve@^1.1.4, resolve@^1.3.2: dependencies: path-parse "^1.0.5" +resolve@^1.1.6: + version "1.8.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26" + dependencies: + path-parse "^1.0.5" + resolve@^1.1.7, resolve@^1.5.0: version "1.6.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.6.0.tgz#0fbd21278b27b4004481c395349e7aba60a9ff5c" dependencies: path-parse "^1.0.5" +restore-cursor@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" + dependencies: + onetime "^2.0.0" + signal-exit "^3.0.2" + ret@~0.1.10: version "0.1.15" resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" +retry@^0.10.0: + version "0.10.1" + resolved "https://registry.yarnpkg.com/retry/-/retry-0.10.1.tgz#e76388d217992c252750241d3d3956fed98d8ff4" + right-align@^0.1.1: version "0.1.3" resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" @@ -5593,13 +5870,31 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^2.0.0" inherits "^2.0.1" +run-async@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" + dependencies: + is-promise "^2.1.0" + run-queue@^1.0.0, run-queue@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/run-queue/-/run-queue-1.0.3.tgz#e848396f057d223f24386924618e25694161ec47" dependencies: aproba "^1.1.1" -rxjs@^6.0.0-beta.3, rxjs@^6.0.0-turbo-rc.4, "rxjs@file:../../node_modules/rxjs": +rxjs@6.2.2: + version "6.2.2" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.2.2.tgz#eb75fa3c186ff5289907d06483a77884586e1cf9" + dependencies: + tslib "^1.9.0" + +rxjs@^6.0.0-beta.3, rxjs@^6.1.0: + version "6.3.2" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.3.2.tgz#6a688b16c4e6e980e62ea805ec30648e1c60907f" + dependencies: + tslib "^1.9.0" + +"rxjs@file:../../node_modules/rxjs": version "6.0.0" dependencies: tslib "^1.9.0" @@ -5608,12 +5903,20 @@ safe-buffer@5.1.1, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, s version "5.1.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" +safe-buffer@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + safe-regex@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" dependencies: ret "~0.1.10" +"safer-buffer@>= 2.1.2 < 3": + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + sass-graph@^2.2.4: version "2.2.4" resolved "https://registry.yarnpkg.com/sass-graph/-/sass-graph-2.2.4.tgz#13fbd63cd1caf0908b9fd93476ad43a51d1e0b49" @@ -5647,7 +5950,7 @@ sax@0.6.x: version "0.6.1" resolved "https://registry.yarnpkg.com/sax/-/sax-0.6.1.tgz#563b19c7c1de892e09bfc4f2fc30e3c27f0952b9" -sax@>=0.6.0: +sax@>=0.6.0, sax@^1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" @@ -5706,13 +6009,17 @@ semver-dsl@^1.0.1: dependencies: semver "^5.3.0" -semver-intersect@^1.1.2: - version "1.3.1" - resolved "https://registry.yarnpkg.com/semver-intersect/-/semver-intersect-1.3.1.tgz#8fa84a9e1028bd239e4530d1a3e181e698d884ba" +semver-intersect@1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/semver-intersect/-/semver-intersect-1.4.0.tgz#bdd9c06bedcdd2fedb8cd352c3c43ee8c61321f3" dependencies: semver "^5.0.0" -"semver@2 || 3 || 4 || 5", semver@^5.0.0, semver@^5.1.0, semver@^5.3.0: +"semver@2 >=2.2.1 || 3.x || 4 || 5", semver@5.5.1, semver@^5.5.0: + version "5.5.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.1.tgz#7dfdd8814bdb7cabc7be0fb1d734cfb66c940477" + +"semver@2 || 3 || 4 || 5", semver@^5.0.0, semver@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" @@ -5853,11 +6160,19 @@ shell-quote@^1.6.1: array-reduce "~0.0.0" jsonify "~0.0.0" -signal-exit@^3.0.0: +shelljs@^0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.2.tgz#345b7df7763f4c2340d584abb532c5f752ca9e35" + dependencies: + glob "^7.0.0" + interpret "^1.0.0" + rechoir "^0.6.2" + +signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" -silent-error@^1.0.0, silent-error@^1.1.0: +silent-error@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/silent-error/-/silent-error-1.1.0.tgz#2209706f1c850a9f1d10d0d840918b46f26e1bc9" dependencies: @@ -5873,6 +6188,10 @@ slash@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" +slide@^1.1.3: + version "1.1.6" + resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" + smart-buffer@^1.0.13, smart-buffer@^1.0.4: version "1.1.15" resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-1.1.15.tgz#7f114b5b65fab3e2a35aa775bb12f0d1c649bf16" @@ -6048,6 +6367,10 @@ source-map@0.5.x, source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7, sourc version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" +source-map@0.7.3: + version "0.7.3" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" + source-map@^0.4.2, source-map@^0.4.4, source-map@~0.4.1: version "0.4.4" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" @@ -6064,6 +6387,10 @@ source-map@~0.2.0: dependencies: amdefine ">=0.0.4" +sourcemap-codec@^1.4.1: + version "1.4.3" + resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.3.tgz#0ba615b73ec35112f63c2f2d9e7c3f87282b0e33" + spdx-correct@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.0.0.tgz#05a5b4d7153a195bc92c3c425b69f3b2a9524c82" @@ -6243,7 +6570,7 @@ string-width@^1.0.1, string-width@^1.0.2: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -string-width@^2.0.0: +string-width@^2.0.0, string-width@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" dependencies: @@ -6360,7 +6687,7 @@ supports-color@^5.1.0, supports-color@^5.3.0: dependencies: has-flag "^3.0.0" -symbol-observable@^1.2.0: +symbol-observable@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" @@ -6395,6 +6722,18 @@ tar@^2.0.0, tar@^2.2.1: fstream "^1.0.2" inherits "2" +tar@^4: + version "4.4.6" + resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.6.tgz#63110f09c00b4e60ac8bcfe1bf3c8660235fbc9b" + dependencies: + chownr "^1.0.1" + fs-minipass "^1.2.5" + minipass "^2.3.3" + minizlib "^1.1.0" + mkdirp "^0.5.0" + safe-buffer "^5.1.2" + yallist "^3.0.2" + through2@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be" @@ -6402,9 +6741,9 @@ through2@^2.0.0: readable-stream "^2.1.5" xtend "~4.0.1" -"through@>=2.2.7 <3", through@X.X.X: +"through@>=2.2.7 <3", through@X.X.X, through@^2.3.6: version "2.3.8" - resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + resolved "http://registry.npmjs.org/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" thunkify@~2.1.1: version "2.1.2" @@ -6440,7 +6779,7 @@ tmp@0.0.30: dependencies: os-tmpdir "~1.0.1" -tmp@0.0.33, tmp@0.0.x: +tmp@0.0.33, tmp@0.0.x, tmp@^0.0.33: version "0.0.33" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" dependencies: @@ -6532,15 +6871,6 @@ tsconfig@^7.0.0: strip-bom "^3.0.0" strip-json-comments "^2.0.0" -tsickle@^0.29.0: - version "0.29.0" - resolved "https://registry.yarnpkg.com/tsickle/-/tsickle-0.29.0.tgz#812806554bb46c1aa16eb0fe2a051da95ca8f5a4" - dependencies: - minimist "^1.2.0" - mkdirp "^0.5.1" - source-map "^0.6.0" - source-map-support "^0.5.0" - tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0: version "1.9.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8" @@ -6607,12 +6937,16 @@ typedarray@^0.0.6, typedarray@~0.0.5: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" -"typescript@>=2.6.2 <2.8", typescript@~2.7.2: - version "2.7.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.7.2.tgz#2d615a1ef4aee4f574425cdff7026edf81919836" +typescript@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.0.1.tgz#43738f29585d3a87575520a4b93ab6026ef11fdb" "typescript@file:../../node_modules/typescript": + version "3.0.1" + +typescript@~2.7.2: version "2.7.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.7.2.tgz#2d615a1ef4aee4f574425cdff7026edf81919836" uglify-es@^3.3.4: version "3.3.9" @@ -6695,10 +7029,6 @@ unique-slug@^2.0.0: dependencies: imurmurhash "^0.1.4" -universalify@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.1.tgz#fa71badd4437af4c148841e3b3b165f9e9e590b7" - unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" @@ -6710,7 +7040,7 @@ unset-value@^1.0.0: has-value "^0.3.1" isobject "^3.0.0" -upath@^1.0.0: +upath@^1.0.0, upath@^1.0.5: version "1.1.0" resolved "https://registry.yarnpkg.com/upath/-/upath-1.1.0.tgz#35256597e46a581db4793d0ce47fa9aebfc9fabd" @@ -6724,6 +7054,12 @@ uri-js@^3.0.2: dependencies: punycode "^2.1.0" +uri-js@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" + dependencies: + punycode "^2.1.0" + urix@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" @@ -6824,6 +7160,12 @@ validate-npm-package-license@^3.0.1: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" +validate-npm-package-name@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz#5fa912d81eb7d0c74afc140de7317f0ca7df437e" + dependencies: + builtins "^1.0.3" + vary@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" @@ -7134,6 +7476,10 @@ yallist@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" +yallist@^3.0.0, yallist@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.2.tgz#8452b4bb7e83c7c188d8041c1a837c773d6d8bb9" + yargs-parser@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-5.0.0.tgz#275ecf0d7ffe05c77e64e7c86e4cd94bf0e1228a" @@ -7146,12 +7492,6 @@ yargs-parser@^7.0.0: dependencies: camelcase "^4.1.0" -yargs-parser@^9.0.2: - version "9.0.2" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-9.0.2.tgz#9ccf6a43460fe4ed40a9bb68f48d43b8a68cc077" - dependencies: - camelcase "^4.1.0" - yargs@9.0.1: version "9.0.1" resolved "https://registry.yarnpkg.com/yargs/-/yargs-9.0.1.tgz#52acc23feecac34042078ee78c0c007f5085db4c" diff --git a/packages/core/src/render3/context_discovery.ts b/packages/core/src/render3/context_discovery.ts index 04deded6de..8b300f8245 100644 --- a/packages/core/src/render3/context_discovery.ts +++ b/packages/core/src/render3/context_discovery.ts @@ -352,7 +352,8 @@ function getLNodeFromViewData(lViewData: LViewData, lElementIndex: number): LEle * Returns a collection of directive index values that are used on the element * (which is referenced by the lNodeIndex) */ -function discoverDirectiveIndices(lViewData: LViewData, lNodeIndex: number): number[]|null { +export function discoverDirectiveIndices( + lViewData: LViewData, lNodeIndex: number, includeComponents?: boolean): number[]|null { const directivesAcrossView = lViewData[DIRECTIVES]; const tNode = lViewData[TVIEW].data[lNodeIndex] as TNode; if (directivesAcrossView && directivesAcrossView.length) { @@ -373,12 +374,20 @@ function discoverDirectiveIndices(lViewData: LViewData, lNodeIndex: number): num return null; } -function discoverDirectives(lViewData: LViewData, directiveIndices: number[]): number[]|null { +/** + * Returns a list of directives extracted from the given view based on the + * provided list of directive index values. + * + * @param lViewData The target view data + * @param indices A collection of directive index values which will be used to + * figure out the directive instances + */ +export function discoverDirectives(lViewData: LViewData, indices: number[]): number[]|null { const directives: any[] = []; const directiveInstances = lViewData[DIRECTIVES]; if (directiveInstances) { - for (let i = 0; i < directiveIndices.length; i++) { - const directiveIndex = directiveIndices[i]; + for (let i = 0; i < indices.length; i++) { + const directiveIndex = indices[i]; const directive = directiveInstances[directiveIndex]; directives.push(directive); } diff --git a/packages/core/src/render3/discovery_utils.ts b/packages/core/src/render3/discovery_utils.ts new file mode 100644 index 0000000000..31d18edcfc --- /dev/null +++ b/packages/core/src/render3/discovery_utils.ts @@ -0,0 +1,143 @@ +/** + * @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 {Injector} from '../di/injector'; + +import {assertDefined} from './assert'; +import {LContext, discoverDirectiveIndices, discoverDirectives, getContext, isComponentInstance, readPatchedLViewData} from './context_discovery'; +import {LElementNode, TNode, TNodeFlags} from './interfaces/node'; +import {CONTEXT, FLAGS, INJECTOR, LViewData, LViewFlags, PARENT, RootContext, TVIEW} from './interfaces/view'; + + +/** + * NOTE: The following functions might not be ideal for core usage in Angular... + * + * Each function below is designed + */ + +/** + * Returns the component instance associated with the target. + * + * If a DOM is used then it will return the component that + * owns the view where the element is situated. + * If a component instance is used then it will return the + * instance of the parent component depending on where + * the component instance is exists in a template. + * If a directive instance is used then it will return the + * component that contains that directive in it's template. + */ +export function getComponent(target: {}): T|null { + const context = loadContext(target) !; + + if (context.component === undefined) { + let lViewData = context.lViewData; + while (lViewData) { + const ctx = lViewData ![CONTEXT] !as{}; + if (ctx && isComponentInstance(ctx)) { + context.component = ctx; + break; + } + lViewData = lViewData ![PARENT] !; + } + if (context.component === undefined) { + context.component = null; + } + } + + return context.component as T; +} + +/** + * Returns the host component instance associated with the target. + * + * This will only return a component instance of the DOM node + * contains an instance of a component on it. + */ +export function getHostComponent(target: {}): T|null { + const context = loadContext(target); + const tNode = context.lViewData[TVIEW].data[context.lNodeIndex] as TNode; + if (tNode.flags & TNodeFlags.isComponent) { + const lNode = context.lViewData[context.lNodeIndex] as LElementNode; + return lNode.data ![CONTEXT] as any as T; + } + return null; +} + +/** + * Returns the `RootContext` instance that is associated with + * the application where the target is situated. + */ +export function getRootContext(target: {}): RootContext { + const context = loadContext(target) !; + const rootLViewData = getRootView(context.lViewData); + return rootLViewData[CONTEXT] as RootContext; +} + +/** + * Returns a list of all the components in the application + * that are have been bootstrapped. + */ +export function getRootComponents(target: {}): any[] { + return [...getRootContext(target).components]; +} + +/** + * Returns the injector instance that is associated with + * the element, component or directive. + */ +export function getInjector(target: {}): Injector|null { + const context = loadContext(target) !; + return context.lViewData[INJECTOR] || null; +} + +/** + * Returns a list of all the directives that are associated + * with the underlying target element. + */ +export function getDirectives(target: {}): Array<{}> { + const context = loadContext(target) !; + + if (context.directives === undefined) { + context.directiveIndices = discoverDirectiveIndices(context.lViewData, context.lNodeIndex); + context.directives = context.directiveIndices ? + discoverDirectives(context.lViewData, context.directiveIndices) : + null; + } + + return context.directives || []; +} + +function loadContext(target: {}): LContext { + const context = getContext(target); + if (!context) { + throw new Error( + ngDevMode ? 'Unable to find the given context data for the given target' : + 'Invalid ng target'); + } + return context; +} + +/** + * Retrieve the root view from any component by walking the parent `LViewData` until + * reaching the root `LViewData`. + * + * @param componentOrView any component or view + */ +export function getRootView(componentOrView: LViewData | {}): LViewData { + let lViewData: LViewData; + if (Array.isArray(componentOrView)) { + ngDevMode && assertDefined(componentOrView, 'lViewData'); + lViewData = componentOrView as LViewData; + } else { + ngDevMode && assertDefined(componentOrView, 'component'); + lViewData = readPatchedLViewData(componentOrView) !; + } + while (lViewData && !(lViewData[FLAGS] & LViewFlags.IsRoot)) { + lViewData = lViewData[PARENT] !; + } + return lViewData; +} diff --git a/packages/core/src/render3/instructions.ts b/packages/core/src/render3/instructions.ts index d20e18098b..87667b7903 100644 --- a/packages/core/src/render3/instructions.ts +++ b/packages/core/src/render3/instructions.ts @@ -11,9 +11,9 @@ import './ng_dev_mode'; import {QueryList} from '../linker'; import {Sanitizer} from '../sanitization/security'; import {StyleSanitizeFn} from '../sanitization/style_sanitizer'; - import {assertDefined, assertEqual, assertLessThan, assertNotEqual} from './assert'; import {attachPatchData, getLElementFromComponent, readElementValue, readPatchedLViewData} from './context_discovery'; +import {getRootView} from './discovery_utils'; import {throwCyclicDependencyError, throwErrorIfNoChangesMode, throwMultipleComponentError} from './errors'; import {executeHooks, executeInitHooks, queueInitHooks, queueLifecycleHooks} from './hooks'; import {ACTIVE_INDEX, LContainer, RENDER_PARENT, VIEWS} from './interfaces/container'; @@ -28,9 +28,7 @@ import {assertNodeOfPossibleTypes, assertNodeType} from './node_assert'; import {appendChild, appendProjectedNode, createTextNode, findComponentView, getContainerNode, getHostElementNode, getLViewChild, getParentOrContainerNode, getRenderParent, insertView, removeView} from './node_manipulation'; import {isNodeMatchingSelectorList, matchingSelectorIndex} from './node_selector_matcher'; import {StylingContext, allocStylingContext, createStylingContextTemplate, renderStyling as renderElementStyles, updateClassProp as updateElementClassProp, updateStyleProp as updateElementStyleProp, updateStylingMap} from './styling'; -import {assertDataInRangeInternal, getLNode, getRootContext, getRootView, isContentQueryHost, isDifferent, loadElementInternal, loadInternal, stringify} from './util'; -import {ViewRef} from './view_ref'; - +import {assertDataInRangeInternal, getLNode, isContentQueryHost, isDifferent, loadElementInternal, loadInternal, stringify} from './util'; /** diff --git a/packages/core/test/bundling/animation_world/bundle.golden_symbols.json b/packages/core/test/bundling/animation_world/bundle.golden_symbols.json index 647efb12f3..5f542c7f2a 100644 --- a/packages/core/test/bundling/animation_world/bundle.golden_symbols.json +++ b/packages/core/test/bundling/animation_world/bundle.golden_symbols.json @@ -654,10 +654,10 @@ "name": "getRendererFactory" }, { - "name": "getRootContext" + "name": "getRootContext$1" }, { - "name": "getRootView" + "name": "getRootView$1" }, { "name": "getStyleSanitizer" diff --git a/packages/core/test/render3/discovery_utils_spec.ts b/packages/core/test/render3/discovery_utils_spec.ts new file mode 100644 index 0000000000..eec9ca2a59 --- /dev/null +++ b/packages/core/test/render3/discovery_utils_spec.ts @@ -0,0 +1,269 @@ +/** + * @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 {StaticInjector} from '../../src/di/injector'; +import {getComponent, getDirectives, getHostComponent, getInjector, getRootComponents} from '../../src/render3/discovery_utils'; +import {RenderFlags, defineComponent, defineDirective} from '../../src/render3/index'; +import {element} from '../../src/render3/instructions'; + +import {ComponentFixture} from './render_util'; + +describe('discovery utils', () => { + describe('getComponent()', () => { + it('should return the component instance for a DOM element', () => { + class InnerComp { + static ngComponentDef = defineComponent({ + type: InnerComp, + selectors: [['inner-comp']], + factory: () => new InnerComp(), + consts: 1, + vars: 0, + template: (rf: RenderFlags, ctx: InnerComp) => { + if (rf & RenderFlags.Create) { + element(0, 'div'); + } + } + }); + } + + class Comp { + static ngComponentDef = defineComponent({ + type: Comp, + selectors: [['comp']], + factory: () => new Comp(), + consts: 1, + vars: 0, + template: (rf: RenderFlags, ctx: Comp) => { + if (rf & RenderFlags.Create) { + element(0, 'inner-comp'); + } + }, + directives: [InnerComp] + }); + } + + const fixture = new ComponentFixture(Comp); + fixture.update(); + + const hostElm = fixture.hostElement; + const innerCompElm = hostElm.querySelector('inner-comp'); + const component = fixture.component; + + expect(getComponent(innerCompElm !) !).toBe(component); + expect(getComponent(hostElm) !).toBeFalsy(); + }); + }); + + describe('getRootComponents()', () => { + it('should return a list of the root components of the application from an element', () => { + let innerComp: InnerComp; + + class InnerComp { + static ngComponentDef = defineComponent({ + type: InnerComp, + selectors: [['inner-comp']], + factory: () => innerComp = new InnerComp(), + consts: 1, + vars: 0, + template: (rf: RenderFlags, ctx: InnerComp) => { + if (rf & RenderFlags.Create) { + element(0, 'div'); + } + } + }); + } + + class Comp { + static ngComponentDef = defineComponent({ + type: Comp, + selectors: [['comp']], + factory: () => new Comp(), + consts: 1, + vars: 0, + template: (rf: RenderFlags, ctx: Comp) => { + if (rf & RenderFlags.Create) { + element(0, 'inner-comp'); + } + }, + directives: [InnerComp] + }); + } + + const fixture = new ComponentFixture(Comp); + fixture.update(); + + const hostElm = fixture.hostElement; + const innerElm = hostElm.querySelector('inner-comp') !; + const divElm = hostElm.querySelector('div') !; + const component = fixture.component; + + expect(getRootComponents(hostElm) !).toEqual([component]); + expect(getRootComponents(innerElm) !).toEqual([component]); + expect(getRootComponents(divElm) !).toEqual([component]); + }); + }); + + describe('getDirectives()', () => { + it('should return a list of the directives that are on the given element', () => { + let myDir1Instance: MyDir1|null = null; + let myDir2Instance: MyDir2|null = null; + let myDir3Instance: MyDir2|null = null; + + class MyDir1 { + static ngDirectiveDef = defineDirective({ + type: MyDir1, + selectors: [['', 'my-dir-1', '']], + factory: () => myDir1Instance = new MyDir1() + }); + } + + class MyDir2 { + static ngDirectiveDef = defineDirective({ + type: MyDir2, + selectors: [['', 'my-dir-2', '']], + factory: () => myDir2Instance = new MyDir2() + }); + } + + class MyDir3 { + static ngDirectiveDef = defineDirective({ + type: MyDir3, + selectors: [['', 'my-dir-3', '']], + factory: () => myDir3Instance = new MyDir2() + }); + } + + class Comp { + static ngComponentDef = defineComponent({ + type: Comp, + selectors: [['comp']], + factory: () => new Comp(), + consts: 2, + vars: 0, + template: (rf: RenderFlags, ctx: Comp) => { + if (rf & RenderFlags.Create) { + element(0, 'div', ['my-dir-1', '', 'my-dir-2', '']); + element(1, 'div', ['my-dir-3']); + } + }, + directives: [MyDir1, MyDir2, MyDir3] + }); + } + + const fixture = new ComponentFixture(Comp); + fixture.update(); + + const hostElm = fixture.hostElement; + const elements = hostElm.querySelectorAll('div'); + + const elm1 = elements[0]; + const elm1Dirs = getDirectives(elm1); + expect(elm1Dirs).toContain(myDir1Instance !); + expect(elm1Dirs).toContain(myDir2Instance !); + + const elm2 = elements[1]; + const elm2Dirs = getDirectives(elm2); + expect(elm2Dirs).toContain(myDir3Instance !); + }); + }); + + describe('getHostComponent()', () => { + it('should return the component instance for a DOM element', () => { + let innerComp: InnerComp; + + class InnerComp { + static ngComponentDef = defineComponent({ + type: InnerComp, + selectors: [['inner-comp']], + factory: () => innerComp = new InnerComp(), + consts: 1, + vars: 0, + template: (rf: RenderFlags, ctx: InnerComp) => { + if (rf & RenderFlags.Create) { + element(0, 'div'); + } + } + }); + } + + class Comp { + static ngComponentDef = defineComponent({ + type: Comp, + selectors: [['comp']], + factory: () => new Comp(), + consts: 1, + vars: 0, + template: (rf: RenderFlags, ctx: Comp) => { + if (rf & RenderFlags.Create) { + element(0, 'inner-comp'); + } + }, + directives: [InnerComp] + }); + } + + const fixture = new ComponentFixture(Comp); + fixture.update(); + + const hostElm = fixture.hostElement; + const innerElm = hostElm.querySelector('inner-comp') !; + const divElm = hostElm.querySelector('div') !; + const component = fixture.component; + + expect(getHostComponent(hostElm) !).toBe(component); + expect(getHostComponent(innerElm) !).toBe(innerComp !); + expect(getHostComponent(divElm) !).toBeFalsy(); + }); + }); + + describe('getInjector()', () => { + it('should return the instance of the injector that was passed into the component', () => { + class Comp { + static ngComponentDef = defineComponent({ + type: Comp, + selectors: [['comp']], + factory: () => new Comp(), + consts: 1, + vars: 0, + template: (rf: RenderFlags, ctx: Comp) => { + if (rf & RenderFlags.Create) { + element(0, 'div'); + } + } + }); + } + + const injector = new StaticInjector([]); + const fixture = new ComponentFixture(Comp, {injector}); + fixture.update(); + + expect(getInjector(fixture.hostElement) !).toBe(injector); + }); + + it('should return null when there is no injector passed into a component', () => { + class Comp { + static ngComponentDef = defineComponent({ + type: Comp, + selectors: [['comp']], + factory: () => new Comp(), + consts: 1, + vars: 0, + template: (rf: RenderFlags, ctx: Comp) => { + if (rf & RenderFlags.Create) { + element(0, 'div'); + } + } + }); + } + + const fixture = new ComponentFixture(Comp); + fixture.update(); + + expect(getInjector(fixture.hostElement)).toEqual(null); + }); + }); +});