From 496867df3226ba1f2689b5f870861d2be4783fec Mon Sep 17 00:00:00 2001 From: Joey Perrott Date: Mon, 22 Feb 2021 14:07:18 -0700 Subject: [PATCH] Update rules nodejs (#21928) * build: update to rules_nodejs@3.1.0 Update to use rules_nodejs@3.1.0 and update correseponding build rule usages and references * build: update load statements to load dev-infra via @npm// workspace Loading the dev-infra rules via the @npm// workspace as the private @npm_dev_infra_private repo is no longer published. * fix(cdk/schematics): update JSON.parse usages to cast the result as a type Update JSON.parse usages to be better typed rather than resulting in an any type. * fix(material/schematics): update JSON.parse usages to cast the result as a type Update JSON.parse usages to be better typed rather than resulting in an any type. --- .nvmrc | 1 + WORKSPACE | 50 +++----------- integration/size-test/index.bzl | 1 + package.json | 65 +++++++++++++++--- packages.bzl | 8 +++ src/cdk/schematics/ng-add/index.spec.ts | 8 ++- src/cdk/schematics/ng-add/package-config.ts | 8 ++- src/e2e-app/BUILD.bazel | 4 +- .../mdc-helpers/BUILD.bazel | 23 ++++++- src/material/schematics/ng-add/index.spec.ts | 10 ++- .../schematics/ng-add/package-config.ts | 8 ++- .../hammer-gestures-migration.ts | 6 +- .../v9/misc/hammer-migration-v9.spec.ts | 17 +++-- src/universal-app/BUILD.bazel | 5 ++ test/bazel-karma-local-config.js | 10 +-- .../cdk/testing/component-harness/BUILD.bazel | 2 +- test/benchmarks/material/button/BUILD.bazel | 2 +- test/benchmarks/material/card/BUILD.bazel | 2 +- test/benchmarks/material/checkbox/BUILD.bazel | 2 +- test/benchmarks/material/chips/BUILD.bazel | 2 +- .../material/form-field/BUILD.bazel | 2 +- test/benchmarks/material/menu/BUILD.bazel | 2 +- test/benchmarks/material/radio/BUILD.bazel | 2 +- .../material/slide-toggle/BUILD.bazel | 2 +- test/benchmarks/material/table/BUILD.bazel | 2 +- test/benchmarks/material/tabs/BUILD.bazel | 2 +- test/benchmarks/mdc/button/BUILD.bazel | 2 +- test/benchmarks/mdc/card/BUILD.bazel | 2 +- test/benchmarks/mdc/checkbox/BUILD.bazel | 2 +- test/benchmarks/mdc/chips/BUILD.bazel | 2 +- test/benchmarks/mdc/form-field/BUILD.bazel | 2 +- test/benchmarks/mdc/menu/BUILD.bazel | 2 +- test/benchmarks/mdc/radio/BUILD.bazel | 2 +- test/benchmarks/mdc/slide-toggle/BUILD.bazel | 2 +- test/benchmarks/mdc/table/BUILD.bazel | 2 +- test/benchmarks/mdc/tabs/BUILD.bazel | 2 +- tools/defaults.bzl | 8 +-- tools/dev-server/BUILD.bazel | 3 + tools/dgeni/BUILD.bazel | 3 + tools/example-module/BUILD.bazel | 3 + tools/highlight-files/BUILD.bazel | 6 ++ tools/markdown-to-html/BUILD.bazel | 2 + .../markdown-to-html/docs-marked-renderer.ts | 3 +- tools/package-docs-content/BUILD.bazel | 3 + ...escript_tsc_wrapped_worker_cache_fix.patch | 34 ---------- tools/postinstall/apply-patches.js | 3 - yarn.lock | 68 ++++++++++--------- 47 files changed, 236 insertions(+), 166 deletions(-) create mode 100644 .nvmrc delete mode 100644 tools/postinstall/@bazel_typescript_tsc_wrapped_worker_cache_fix.patch diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 000000000000..5c088ddb94af --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +12.14.1 diff --git a/WORKSPACE b/WORKSPACE index 2f012d4d7c72..65d226a78bd0 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -8,21 +8,18 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # Add NodeJS rules http_archive( name = "build_bazel_rules_nodejs", - sha256 = "b3521b29c7cb0c47a1a735cce7e7e811a4f80d8e3720cf3a1b624533e4bb7cb6", - urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/2.3.2/rules_nodejs-2.3.2.tar.gz"], + sha256 = "dd4dc46066e2ce034cba0c81aa3e862b27e8e8d95871f567359f7a534cccb666", + urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.1.0/rules_nodejs-3.1.0.tar.gz"], ) # Add sass rules http_archive( name = "io_bazel_rules_sass", - # Patch `rules_sass` to work around a bug that causes error messages to be not - # printed in worker mode: https://github.com/bazelbuild/rules_sass/issues/96. - # TODO(devversion): remove this patch once the Sass Node entry-point returns a `Promise`. - patches = ["//tools/postinstall:sass_worker_async.patch"], - sha256 = "cf28ff1bcfafb3c97f138bbc8ca9fe386e968ed3faaa9f8e6214abb5e88a2ecd", - strip_prefix = "rules_sass-1.29.0", + sha256 = "596ab3616d370135e0ecc710e103422e0aa3719f1c970303a0886b70c81ee819", + strip_prefix = "rules_sass-1.32.2", urls = [ - "https://github.com/bazelbuild/rules_sass/archive/1.29.0.zip", + "https://github.com/bazelbuild/rules_sass/archive/1.32.2.zip", + "https://mirror.bazel.build/github.com/bazelbuild/rules_sass/archive/1.32.2.zip", ], ) @@ -32,27 +29,12 @@ load("@build_bazel_rules_nodejs//:index.bzl", "check_bazel_version", "node_repos check_bazel_version("4.0.0") node_repositories( - node_repositories = { - "12.9.1-darwin_amd64": ("node-v12.9.1-darwin-x64.tar.gz", "node-v12.9.1-darwin-x64", "9aaf29d30056e2233fd15dfac56eec12e8342d91bb6c13d54fb5e599383dddb9"), - "12.9.1-linux_amd64": ("node-v12.9.1-linux-x64.tar.xz", "node-v12.9.1-linux-x64", "680a1263c9f5f91adadcada549f0a9c29f1b26d09658d2b501c334c3f63719e5"), - "12.9.1-windows_amd64": ("node-v12.9.1-win-x64.zip", "node-v12.9.1-win-x64", "6a4e54bda091bd02dbd8ff1b9f6671e036297da012a53891e3834d4bf4bed297"), - }, - node_urls = ["https://nodejs.org/dist/v{version}/{filename}"], - node_version = "12.9.1", - # We do not need to define a specific yarn version as bazel will respect the .yarnrc file - # and run the version of yarn defined at the set-path value. - # Since bazel runs yarn from the working directory of the package.json, and our .yarnrc - # file is in the same directory, it correctly discovers and respects it. Additionally, - # it ensures that the yarn environment variable to detect if yarn has already followed - # the set-path value is reset. + node_version = "12.14.1", + package_json = ["//:package.json"], ) yarn_install( name = "npm", - # Redirects Yarn `stdout` output to `stderr`. This ensures that stdout is not accidentally - # polluted when Bazel runs Yarn. Workaround until the upstream fix is available: - # https://github.com/bazelbuild/bazel/pull/10611. - args = ["1>&2"], # We add the postinstall patches file, and ngcc main fields update script here so # that Yarn will rerun whenever one of these files has been modified. data = [ @@ -64,19 +46,9 @@ yarn_install( yarn_lock = "//:yarn.lock", ) -# Install all bazel dependencies of the @ngdeps npm packages -load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies") +load("@npm//@bazel/protractor:package.bzl", "npm_bazel_protractor_dependencies") -install_bazel_dependencies( - # TODO(crisbeto): supress warnings for now so everything works like it has until now. - # Eventually we should remove it and re-test everything. - suppress_warning = True, -) - -# Fetch transitive dependencies which are needed to use the karma rules. -load("@npm//@bazel/karma:package.bzl", "npm_bazel_karma_dependencies") - -npm_bazel_karma_dependencies() +npm_bazel_protractor_dependencies() # Setup web testing. We need to setup a browser because the web testing rules for TypeScript need # a reference to a registered browser (ideally that's a hermetic version of a browser) @@ -130,6 +102,6 @@ rbe_autoconfig( # TODO(wagnermaciel): deduplicate browsers - this will load another version of chromium in the # repository. We probably want to use the chromium version loaded here (from dev-infra) as that # one has RBE improvements. -load("@npm_angular_dev_infra_private//browsers:browser_repositories.bzl", _dev_infra_browser_repositories = "browser_repositories") +load("@npm//@angular/dev-infra-private/browsers:browser_repositories.bzl", _dev_infra_browser_repositories = "browser_repositories") _dev_infra_browser_repositories() diff --git a/integration/size-test/index.bzl b/integration/size-test/index.bzl index 3ee5cf49bf59..911de20cd41e 100644 --- a/integration/size-test/index.bzl +++ b/integration/size-test/index.bzl @@ -77,6 +77,7 @@ def size_test(name, file, deps): nodejs_binary( name = "%s.approve" % name, testonly = True, + templated_args = ["--bazel_patch_module_resolver"], data = [ "//goldens:size-test.yaml", "//integration/size-test:check-size", diff --git a/package.json b/package.json index 1707bacc0062..bf8067fb8cc1 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "@types/youtube": "^0.0.40", "@webcomponents/custom-elements": "^1.1.0", "core-js-bundle": "^3.8.2", - "material-components-web": "^11.0.0-canary.3201cae47.0", + "material-components-web": "11.0.0-canary.3201cae47.0", "rxjs": "^6.5.3", "rxjs-tslint-rules": "^4.33.1", "systemjs": "0.19.43", @@ -71,13 +71,62 @@ "zone.js": "~0.11.3" }, "devDependencies": { + "diff": "^3.5.0", + "reflect-metadata": "^0.1.3", + "@material/animation": "11.0.0-canary.3201cae47.0", + "@material/auto-init": "11.0.0-canary.3201cae47.0", + "@material/banner": "11.0.0-canary.3201cae47.0", + "@material/base": "11.0.0-canary.3201cae47.0", + "@material/button": "11.0.0-canary.3201cae47.0", + "@material/card": "11.0.0-canary.3201cae47.0", + "@material/checkbox": "11.0.0-canary.3201cae47.0", + "@material/chips": "11.0.0-canary.3201cae47.0", + "@material/circular-progress": "11.0.0-canary.3201cae47.0", + "@material/data-table": "11.0.0-canary.3201cae47.0", + "@material/density": "11.0.0-canary.3201cae47.0", + "@material/dialog": "11.0.0-canary.3201cae47.0", + "@material/dom": "11.0.0-canary.3201cae47.0", + "@material/drawer": "11.0.0-canary.3201cae47.0", + "@material/elevation": "11.0.0-canary.3201cae47.0", + "@material/fab": "11.0.0-canary.3201cae47.0", + "@material/feature-targeting": "11.0.0-canary.3201cae47.0", + "@material/floating-label": "11.0.0-canary.3201cae47.0", + "@material/form-field": "11.0.0-canary.3201cae47.0", + "@material/icon-button": "11.0.0-canary.3201cae47.0", + "@material/image-list": "11.0.0-canary.3201cae47.0", + "@material/layout-grid": "11.0.0-canary.3201cae47.0", + "@material/line-ripple": "11.0.0-canary.3201cae47.0", + "@material/linear-progress": "11.0.0-canary.3201cae47.0", + "@material/list": "11.0.0-canary.3201cae47.0", + "@material/menu": "11.0.0-canary.3201cae47.0", + "@material/menu-surface": "11.0.0-canary.3201cae47.0", + "@material/notched-outline": "11.0.0-canary.3201cae47.0", + "@material/radio": "11.0.0-canary.3201cae47.0", + "@material/ripple": "11.0.0-canary.3201cae47.0", + "@material/rtl": "11.0.0-canary.3201cae47.0", + "@material/segmented-button": "11.0.0-canary.3201cae47.0", + "@material/select": "11.0.0-canary.3201cae47.0", + "@material/shape": "11.0.0-canary.3201cae47.0", + "@material/slider": "11.0.0-canary.3201cae47.0", + "@material/snackbar": "11.0.0-canary.3201cae47.0", + "@material/switch": "11.0.0-canary.3201cae47.0", + "@material/tab": "11.0.0-canary.3201cae47.0", + "@material/tab-bar": "11.0.0-canary.3201cae47.0", + "@material/tab-indicator": "11.0.0-canary.3201cae47.0", + "@material/tab-scroller": "11.0.0-canary.3201cae47.0", + "@material/textfield": "11.0.0-canary.3201cae47.0", + "@material/theme": "11.0.0-canary.3201cae47.0", + "@material/tooltip": "11.0.0-canary.3201cae47.0", + "@material/top-app-bar": "11.0.0-canary.3201cae47.0", + "@material/touch-target": "11.0.0-canary.3201cae47.0", + "@material/typography": "11.0.0-canary.3201cae47.0", "@angular-devkit/build-optimizer": "^0.1200.0-next.0", "@angular-devkit/core": "^12.0.0-next.0", "@angular-devkit/schematics": "^12.0.0-next.0", "@angular/bazel": "^12.0.0-next.0", "@angular/benchpress": "^0.2.1", "@angular/compiler-cli": "^12.0.0-next.0", - "@angular/dev-infra-private": "https://github.com/angular/dev-infra-private-builds.git#71d57c29a10c03d07f889581608e3a2315a1dc7e", + "@angular/dev-infra-private": "https://github.com/angular/dev-infra-private-builds.git#a8dbb0d8cd8de1e86a4ec4ea66b5bd89a47d4876", "@angular/platform-browser-dynamic": "^12.0.0-next.0", "@angular/platform-server": "^12.0.0-next.0", "@angular/router": "^12.0.0-next.0", @@ -85,12 +134,12 @@ "@bazel/bazelisk": "^1.4.0", "@bazel/buildifier": "^4.0.0", "@bazel/ibazel": "^0.14.0", - "@bazel/jasmine": "^2.3.2", - "@bazel/karma": "^2.3.2", - "@bazel/protractor": "^2.3.2", - "@bazel/rollup": "^2.3.2", - "@bazel/terser": "^2.3.2", - "@bazel/typescript": "^2.3.2", + "@bazel/jasmine": "3.1.0", + "@bazel/concatjs": "3.1.0", + "@bazel/protractor": "3.1.0", + "@bazel/rollup": "3.1.0", + "@bazel/terser": "3.1.0", + "@bazel/typescript": "3.1.0", "@firebase/app-types": "^0.6.1", "@octokit/rest": "18.1.0", "@schematics/angular": "^12.0.0-next.0", diff --git a/packages.bzl b/packages.bzl index 6703f9483c83..071977d40a7e 100644 --- a/packages.bzl +++ b/packages.bzl @@ -5,10 +5,18 @@ ANGULAR_PACKAGE_VERSION = "^11.0.0 || ^12.0.0-0" MDC_PACKAGE_VERSION = "^9.0.0-canary.419e03572.0" TSLIB_PACKAGE_VERSION = "^2.0.0" +# Each placer holder is used to stamp versions during the build process, replacing the key with it's +# value pair. These replacements occur during building of `npm_package` and `ng_package` stamping in +# the peer dependencies and versions, primarily in `package.json`s. VERSION_PLACEHOLDER_REPLACEMENTS = { + # Version of `material-components-web` "0.0.0-MDC": MDC_PACKAGE_VERSION, + # Version of `@angular/core` "0.0.0-NG": ANGULAR_PACKAGE_VERSION, + # Version of `tslib` "0.0.0-TSLIB": TSLIB_PACKAGE_VERSION, + # Version of the local package being built, generated via the `--workspace_status_command` flag. + "0.0.0-PLACEHOLDER": "{BUILD_SCM_VERSION}", } # List of default Angular library UMD bundles which are not processed by ngcc. diff --git a/src/cdk/schematics/ng-add/index.spec.ts b/src/cdk/schematics/ng-add/index.spec.ts index 6be3e3fc62ef..d4a97ea72882 100644 --- a/src/cdk/schematics/ng-add/index.spec.ts +++ b/src/cdk/schematics/ng-add/index.spec.ts @@ -4,6 +4,10 @@ import {COLLECTION_PATH} from '../index.spec'; import {createTestApp, getFileContent} from '../testing'; import {addPackageToPackageJson} from './package-config'; +interface PackageJson { + dependencies: Record; +} + describe('CDK ng-add', () => { let runner: SchematicTestRunner; let appTree: Tree; @@ -15,7 +19,7 @@ describe('CDK ng-add', () => { it('should update the package.json', async () => { const tree = await runner.runSchematicAsync('ng-add', {}, appTree).toPromise(); - const packageJson = JSON.parse(getFileContent(tree, '/package.json')); + const packageJson = JSON.parse(getFileContent(tree, '/package.json')) as PackageJson; const dependencies = packageJson.dependencies; expect(dependencies['@angular/cdk']).toBe('~0.0.0-PLACEHOLDER'); @@ -33,7 +37,7 @@ describe('CDK ng-add', () => { addPackageToPackageJson(appTree, '@angular/cdk', '^9.0.0'); const tree = await runner.runSchematicAsync('ng-add', {}, appTree).toPromise(); - const packageJson = JSON.parse(getFileContent(tree, '/package.json')); + const packageJson = JSON.parse(getFileContent(tree, '/package.json')) as PackageJson; const dependencies = packageJson.dependencies; expect(dependencies['@angular/cdk']).toBe('^9.0.0'); diff --git a/src/cdk/schematics/ng-add/package-config.ts b/src/cdk/schematics/ng-add/package-config.ts index 1ba727bf7e5a..31de32b86a7f 100644 --- a/src/cdk/schematics/ng-add/package-config.ts +++ b/src/cdk/schematics/ng-add/package-config.ts @@ -8,6 +8,10 @@ import {Tree} from '@angular-devkit/schematics'; +interface PackageJson { + dependencies: Record; +} + /** * Sorts the keys of the given object. * @returns A new object instance with sorted keys @@ -21,7 +25,7 @@ export function addPackageToPackageJson(host: Tree, pkg: string, version: string if (host.exists('package.json')) { const sourceText = host.read('package.json')!.toString('utf-8'); - const json = JSON.parse(sourceText); + const json = JSON.parse(sourceText) as PackageJson; if (!json.dependencies) { json.dependencies = {}; @@ -44,7 +48,7 @@ export function getPackageVersionFromPackageJson(tree: Tree, name: string): stri return null; } - const packageJson = JSON.parse(tree.read('package.json')!.toString('utf8')); + const packageJson = JSON.parse(tree.read('package.json')!.toString('utf8')) as PackageJson; if (packageJson.dependencies && packageJson.dependencies[name]) { return packageJson.dependencies[name]; diff --git a/src/e2e-app/BUILD.bazel b/src/e2e-app/BUILD.bazel index 44c47f37b611..1b6b292e75b0 100644 --- a/src/e2e-app/BUILD.bazel +++ b/src/e2e-app/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm//@bazel/typescript:index.bzl", "ts_devserver") +load("@npm//@bazel/concatjs:index.bzl", "concatjs_devserver") load("//:packages.bzl", "getAngularUmdTargets") load("//tools:defaults.bzl", "ng_module", "sass_binary") @@ -85,7 +85,7 @@ sass_binary( ], ) -ts_devserver( +concatjs_devserver( name = "devserver", testonly = True, additional_root_paths = [ diff --git a/src/material-experimental/mdc-helpers/BUILD.bazel b/src/material-experimental/mdc-helpers/BUILD.bazel index 1c8ec59f78b4..b62d5232f6d9 100644 --- a/src/material-experimental/mdc-helpers/BUILD.bazel +++ b/src/material-experimental/mdc-helpers/BUILD.bazel @@ -10,7 +10,28 @@ filegroup( npm_sass_library( name = "mdc_scss_deps_lib", - deps = ["@npm//material-components-web"], + deps = [ + "@npm//@material/card", + "@npm//@material/checkbox", + "@npm//@material/chips", + "@npm//@material/circular-progress", + "@npm//@material/data-table", + "@npm//@material/dialog", + "@npm//@material/fab", + "@npm//@material/form-field", + "@npm//@material/linear-progress", + "@npm//@material/list", + "@npm//@material/menu-surface", + "@npm//@material/radio", + "@npm//@material/snackbar", + "@npm//@material/switch", + "@npm//@material/tab", + "@npm//@material/tab-bar", + "@npm//@material/tab-indicator", + "@npm//@material/textfield", + "@npm//@material/tooltip", + "@npm//material-components-web", + ], ) sass_library( diff --git a/src/material/schematics/ng-add/index.spec.ts b/src/material/schematics/ng-add/index.spec.ts index bdaef824a8fa..bcc2384047f0 100644 --- a/src/material/schematics/ng-add/index.spec.ts +++ b/src/material/schematics/ng-add/index.spec.ts @@ -13,6 +13,10 @@ import {getWorkspace} from '@schematics/angular/utility/workspace'; import {COLLECTION_PATH} from '../index.spec'; import {addPackageToPackageJson} from './package-config'; +interface PackageJson { + dependencies: Record; +} + describe('ng-add schematic', () => { let runner: SchematicTestRunner; let appTree: Tree; @@ -43,7 +47,7 @@ describe('ng-add schematic', () => { /** Removes the specified dependency from the /package.json in the given tree. */ function removePackageJsonDependency(tree: Tree, dependencyName: string) { - const packageContent = JSON.parse(getFileContent(tree, '/package.json')); + const packageContent = JSON.parse(getFileContent(tree, '/package.json')) as PackageJson; delete packageContent.dependencies[dependencyName]; tree.overwrite('/package.json', JSON.stringify(packageContent, null, 2)); } @@ -55,7 +59,7 @@ describe('ng-add schematic', () => { removePackageJsonDependency(appTree, '@angular/animations'); const tree = await runner.runSchematicAsync('ng-add', {}, appTree).toPromise(); - const packageJson = JSON.parse(getFileContent(tree, '/package.json')); + const packageJson = JSON.parse(getFileContent(tree, '/package.json')) as PackageJson; const dependencies = packageJson.dependencies; const angularCoreVersion = dependencies['@angular/core']; @@ -87,7 +91,7 @@ describe('ng-add schematic', () => { addPackageToPackageJson(appTree, '@angular/material', '^9.0.0'); const tree = await runner.runSchematicAsync('ng-add', {}, appTree).toPromise(); - const packageJson = JSON.parse(getFileContent(tree, '/package.json')); + const packageJson = JSON.parse(getFileContent(tree, '/package.json')) as PackageJson; const dependencies = packageJson.dependencies; expect(dependencies['@angular/material']).toBe('^9.0.0'); diff --git a/src/material/schematics/ng-add/package-config.ts b/src/material/schematics/ng-add/package-config.ts index 1ba727bf7e5a..31de32b86a7f 100644 --- a/src/material/schematics/ng-add/package-config.ts +++ b/src/material/schematics/ng-add/package-config.ts @@ -8,6 +8,10 @@ import {Tree} from '@angular-devkit/schematics'; +interface PackageJson { + dependencies: Record; +} + /** * Sorts the keys of the given object. * @returns A new object instance with sorted keys @@ -21,7 +25,7 @@ export function addPackageToPackageJson(host: Tree, pkg: string, version: string if (host.exists('package.json')) { const sourceText = host.read('package.json')!.toString('utf-8'); - const json = JSON.parse(sourceText); + const json = JSON.parse(sourceText) as PackageJson; if (!json.dependencies) { json.dependencies = {}; @@ -44,7 +48,7 @@ export function getPackageVersionFromPackageJson(tree: Tree, name: string): stri return null; } - const packageJson = JSON.parse(tree.read('package.json')!.toString('utf8')); + const packageJson = JSON.parse(tree.read('package.json')!.toString('utf8')) as PackageJson; if (packageJson.dependencies && packageJson.dependencies[name]) { return packageJson.dependencies[name]; diff --git a/src/material/schematics/ng-update/migrations/hammer-gestures-v9/hammer-gestures-migration.ts b/src/material/schematics/ng-update/migrations/hammer-gestures-v9/hammer-gestures-migration.ts index 4cbf2bcb5649..ad56525db36c 100644 --- a/src/material/schematics/ng-update/migrations/hammer-gestures-v9/hammer-gestures-migration.ts +++ b/src/material/schematics/ng-update/migrations/hammer-gestures-v9/hammer-gestures-migration.ts @@ -59,6 +59,10 @@ interface IdentifierReference { isImport: boolean; } +interface PackageJson { + dependencies: Record; +} + export class HammerGesturesMigration extends DevkitMigration { // Only enable this rule if the migration targets v9 or v10 and is running for a non-test // target. We cannot migrate test targets since they have a limited scope @@ -853,7 +857,7 @@ export class HammerGesturesMigration extends DevkitMigration { return false; } - const packageJson = JSON.parse(tree.read('/package.json')!.toString('utf8')); + const packageJson = JSON.parse(tree.read('/package.json')!.toString('utf8')) as PackageJson; // We do not handle the case where someone manually added "hammerjs" to the dev dependencies. if (packageJson.dependencies && packageJson.dependencies[HAMMER_MODULE_SPECIFIER]) { diff --git a/src/material/schematics/ng-update/test-cases/v9/misc/hammer-migration-v9.spec.ts b/src/material/schematics/ng-update/test-cases/v9/misc/hammer-migration-v9.spec.ts index 436e221530c2..a143a8b29f21 100644 --- a/src/material/schematics/ng-update/test-cases/v9/misc/hammer-migration-v9.spec.ts +++ b/src/material/schematics/ng-update/test-cases/v9/misc/hammer-migration-v9.spec.ts @@ -5,6 +5,11 @@ import {createTestCaseSetup, resolveBazelPath} from '@angular/cdk/schematics/tes import {readFileSync} from 'fs'; import {MIGRATION_PATH} from '../../../../index.spec'; + +interface PackageJson { + dependencies: Record; +} + describe('v9 HammerJS removal', () => { const GESTURE_CONFIG_TEMPLATE_PATH = resolveBazelPath(__dirname, '../../../migrations/hammer-gestures-v9/gesture-config.template'); @@ -55,11 +60,11 @@ describe('v9 HammerJS removal', () => { it('should remove hammerjs from "package.json" file', async () => { addPackageToPackageJson(tree, 'hammerjs', '0.0.0'); - expect(JSON.parse(tree.readContent('/package.json')).dependencies['hammerjs']).toBe('0.0.0'); + expect((JSON.parse(tree.readContent('/package.json')) as PackageJson).dependencies['hammerjs']).toBe('0.0.0'); await runMigration(); - expect(JSON.parse(tree.readContent('/package.json')).dependencies['hammerjs']) + expect((JSON.parse(tree.readContent('/package.json')) as PackageJson).dependencies['hammerjs']) .toBe(undefined); // expect that there is a "node-package" install task. The task is @@ -803,7 +808,7 @@ describe('v9 HammerJS removal', () => { it('should not remove hammerjs if test target compilation scope does not contain hammerjs usage', async () => { addPackageToPackageJson(tree, 'hammerjs', '0.0.0'); - expect(JSON.parse(tree.readContent('/package.json')).dependencies['hammerjs']).toBe('0.0.0'); + expect((JSON.parse(tree.readContent('/package.json')) as PackageJson).dependencies['hammerjs']).toBe('0.0.0'); // we simulate a case where a component does not have any tests for. In that case, // the test target compilation scope does not include "test.component.ts" and the @@ -820,14 +825,14 @@ describe('v9 HammerJS removal', () => { await runMigration(); - expect(JSON.parse(tree.readContent('/package.json')).dependencies['hammerjs']).toBe('0.0.0'); + expect((JSON.parse(tree.readContent('/package.json')) as PackageJson).dependencies['hammerjs']).toBe('0.0.0'); }); it('should not remove hammerjs from "package.json" file if used in one project while ' + 'unused in other project', async () => { addPackageToPackageJson(tree, 'hammerjs', '0.0.0'); - expect(JSON.parse(tree.readContent('/package.json')).dependencies['hammerjs']).toBe('0.0.0'); + expect((JSON.parse(tree.readContent('/package.json')) as PackageJson).dependencies['hammerjs']).toBe('0.0.0'); await runner.runExternalSchematicAsync('@schematics/angular', 'application', {name: 'second-project'}, tree).toPromise(); @@ -840,7 +845,7 @@ describe('v9 HammerJS removal', () => { await runMigration(); expect(runner.tasks.some(t => t.name === 'node-package')).toBe(false); - expect(JSON.parse(tree.readContent('/package.json')).dependencies['hammerjs']) + expect((JSON.parse(tree.readContent('/package.json')) as PackageJson).dependencies['hammerjs']) .toBe('0.0.0'); }); diff --git a/src/universal-app/BUILD.bazel b/src/universal-app/BUILD.bazel index 603ba3fedcf7..e6f4e4b7266f 100644 --- a/src/universal-app/BUILD.bazel +++ b/src/universal-app/BUILD.bazel @@ -60,4 +60,9 @@ nodejs_test( ":theme_scss", ], entry_point = ":prerender.ts", + templated_args = [ + # TODO(josephperrott): update dependency usages to no longer need bazel patch module resolver + # See: https://github.com/bazelbuild/rules_nodejs/wiki#--bazel_patch_module_resolver-now-defaults-to-false-2324 + "--bazel_patch_module_resolver", + ], ) diff --git a/test/bazel-karma-local-config.js b/test/bazel-karma-local-config.js index 2f434de70ec6..4d3548e0cb01 100644 --- a/test/bazel-karma-local-config.js +++ b/test/bazel-karma-local-config.js @@ -3,12 +3,12 @@ * want to launch any browser and just enable manual browser debugging. */ -const bazelKarma = require('@bazel/karma'); +const bazelKarma = require('@bazel/concatjs'); module.exports = config => { const overwrites = {}; - // By default "@bazel/karma" configures Chrome as browser. Since we don't want + // By default "@bazel/concatjs" configures Chrome as browser. Since we don't want // to launch any browser at all, we overwrite the "browsers" option. Since the // default config tries to extend the browsers array with "Chrome", we need to // always return a new empty array. @@ -19,16 +19,16 @@ module.exports = config => { }); // Ensures that tests start executing once browsers have been manually connected. We need - // to use "defineProperty" because the default "@bazel/karma" config overwrites the option. + // to use "defineProperty" because the default "@bazel/concatjs" config overwrites the option. Object.defineProperty(overwrites, 'autoWatch', { get: () => true, set: () => {}, enumerable: true, }); - // When not running with ibazel, do not set up the `@bazel/karma` watcher. This one + // When not running with ibazel, do not set up the `@bazel/concatjs` watcher. This one // relies on ibazel to write to the `stdin` interface. When running without ibazel, the - // watcher will kill Karma since there is no data written to the `stdin` interface. + // watcher will kill concatjs since there is no data written to the `stdin` interface. if (process.env['IBAZEL_NOTIFY_CHANGES'] !== 'y') { delete bazelKarma['watcher']; } diff --git a/test/benchmarks/cdk/testing/component-harness/BUILD.bazel b/test/benchmarks/cdk/testing/component-harness/BUILD.bazel index 61239d3440f7..e923e67306c5 100644 --- a/test/benchmarks/cdk/testing/component-harness/BUILD.bazel +++ b/test/benchmarks/cdk/testing/component-harness/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_angular_dev_infra_private//benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") +load("@npm//@angular/dev-infra-private/benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") load("//tools:defaults.bzl", "ng_test_library", "ng_web_test_suite", "ts_library") package(default_visibility = ["//visibility:public"]) diff --git a/test/benchmarks/material/button/BUILD.bazel b/test/benchmarks/material/button/BUILD.bazel index 5aab92e7a130..ed57c9fa3949 100644 --- a/test/benchmarks/material/button/BUILD.bazel +++ b/test/benchmarks/material/button/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_angular_dev_infra_private//benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") +load("@npm//@angular/dev-infra-private/benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") # TODO(wagnermaciel): Update this target to provide indigo-pink in a way that doesn't require having to import it with # stylesUrls inside the components once `component_benchmark` supports asset injection. diff --git a/test/benchmarks/material/card/BUILD.bazel b/test/benchmarks/material/card/BUILD.bazel index 99ce933cc378..32d033201f59 100644 --- a/test/benchmarks/material/card/BUILD.bazel +++ b/test/benchmarks/material/card/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_angular_dev_infra_private//benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") +load("@npm//@angular/dev-infra-private/benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") # TODO(wagnermaciel): Update this target to provide indigo-pink in a way that doesn't require having to import it with # stylesUrls inside the components once `component_benchmark` supports asset injection. diff --git a/test/benchmarks/material/checkbox/BUILD.bazel b/test/benchmarks/material/checkbox/BUILD.bazel index 6643f140fbc5..7fbafa7bc4a6 100644 --- a/test/benchmarks/material/checkbox/BUILD.bazel +++ b/test/benchmarks/material/checkbox/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_angular_dev_infra_private//benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") +load("@npm//@angular/dev-infra-private/benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") # TODO(wagnermaciel): Update this target to provide indigo-pink in a way that doesn't require having to import it with # stylesUrls inside the components once `component_benchmark` supports asset injection. diff --git a/test/benchmarks/material/chips/BUILD.bazel b/test/benchmarks/material/chips/BUILD.bazel index 88aa8d49f4b1..ef1e0f469315 100644 --- a/test/benchmarks/material/chips/BUILD.bazel +++ b/test/benchmarks/material/chips/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_angular_dev_infra_private//benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") +load("@npm//@angular/dev-infra-private/benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") # TODO(wagnermaciel): Update this target to provide indigo-pink in a way that doesn't require having to import it with # stylesUrls inside the components once `component_benchmark` supports asset injection. diff --git a/test/benchmarks/material/form-field/BUILD.bazel b/test/benchmarks/material/form-field/BUILD.bazel index 64ce1558240a..d0803a9e2e42 100644 --- a/test/benchmarks/material/form-field/BUILD.bazel +++ b/test/benchmarks/material/form-field/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_angular_dev_infra_private//benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") +load("@npm//@angular/dev-infra-private/benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") # TODO(wagnermaciel): Update this target to provide indigo-pink in a way that doesn't require having to import it with # stylesUrls inside the components once `component_benchmark` supports asset injection. diff --git a/test/benchmarks/material/menu/BUILD.bazel b/test/benchmarks/material/menu/BUILD.bazel index 57d50dc86b3b..c105ec52aeec 100644 --- a/test/benchmarks/material/menu/BUILD.bazel +++ b/test/benchmarks/material/menu/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_angular_dev_infra_private//benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") +load("@npm//@angular/dev-infra-private/benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") # TODO(wagnermaciel): Update this target to provide indigo-pink in a way that doesn't require having to import it with # stylesUrls inside the components once `component_benchmark` supports asset injection. diff --git a/test/benchmarks/material/radio/BUILD.bazel b/test/benchmarks/material/radio/BUILD.bazel index 83fe177767e1..003ec5506790 100644 --- a/test/benchmarks/material/radio/BUILD.bazel +++ b/test/benchmarks/material/radio/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_angular_dev_infra_private//benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") +load("@npm//@angular/dev-infra-private/benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") # TODO(wagnermaciel): Update this target to provide indigo-pink in a way that doesn't require having to import it with # stylesUrls inside the components once `component_benchmark` supports asset injection. diff --git a/test/benchmarks/material/slide-toggle/BUILD.bazel b/test/benchmarks/material/slide-toggle/BUILD.bazel index ac7e8e0721bd..e60099b98fda 100644 --- a/test/benchmarks/material/slide-toggle/BUILD.bazel +++ b/test/benchmarks/material/slide-toggle/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_angular_dev_infra_private//benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") +load("@npm//@angular/dev-infra-private/benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") # TODO(wagnermaciel): Update this target to provide indigo-pink in a way that doesn't require having to import it with # stylesUrls inside the components once `component_benchmark` supports asset injection. diff --git a/test/benchmarks/material/table/BUILD.bazel b/test/benchmarks/material/table/BUILD.bazel index 7071bac8863c..dc5fd78f660e 100644 --- a/test/benchmarks/material/table/BUILD.bazel +++ b/test/benchmarks/material/table/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_angular_dev_infra_private//benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") +load("@npm//@angular/dev-infra-private/benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") component_benchmark( name = "benchmark", diff --git a/test/benchmarks/material/tabs/BUILD.bazel b/test/benchmarks/material/tabs/BUILD.bazel index edc1e2cd33a2..40f650dc47ef 100644 --- a/test/benchmarks/material/tabs/BUILD.bazel +++ b/test/benchmarks/material/tabs/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_angular_dev_infra_private//benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") +load("@npm//@angular/dev-infra-private/benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") # TODO(wagnermaciel): Update this target to provide indigo-pink in a way that doesn't require having to import it with # stylesUrls inside the components once `component_benchmark` supports asset injection. diff --git a/test/benchmarks/mdc/button/BUILD.bazel b/test/benchmarks/mdc/button/BUILD.bazel index f277e483fe10..997fbfd16802 100644 --- a/test/benchmarks/mdc/button/BUILD.bazel +++ b/test/benchmarks/mdc/button/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_angular_dev_infra_private//benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") +load("@npm//@angular/dev-infra-private/benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") # TODO(wagnermaciel): Update this target to provide indigo-pink in a way that doesn't require having to import it with # stylesUrls inside the components once `component_benchmark` supports asset injection. diff --git a/test/benchmarks/mdc/card/BUILD.bazel b/test/benchmarks/mdc/card/BUILD.bazel index e9ab5a69e80f..c949d4d393c3 100644 --- a/test/benchmarks/mdc/card/BUILD.bazel +++ b/test/benchmarks/mdc/card/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_angular_dev_infra_private//benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") +load("@npm//@angular/dev-infra-private/benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") # TODO(wagnermaciel): Update this target to provide indigo-pink in a way that doesn't require having to import it with # stylesUrls inside the components once `component_benchmark` supports asset injection. diff --git a/test/benchmarks/mdc/checkbox/BUILD.bazel b/test/benchmarks/mdc/checkbox/BUILD.bazel index 66162cd2cb3d..a1052d9a8239 100644 --- a/test/benchmarks/mdc/checkbox/BUILD.bazel +++ b/test/benchmarks/mdc/checkbox/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_angular_dev_infra_private//benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") +load("@npm//@angular/dev-infra-private/benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") # TODO(wagnermaciel): Update this target to provide indigo-pink in a way that doesn't require having to import it with # stylesUrls inside the components once `component_benchmark` supports asset injection. diff --git a/test/benchmarks/mdc/chips/BUILD.bazel b/test/benchmarks/mdc/chips/BUILD.bazel index 8b4fc3f2be05..05b9335cd959 100644 --- a/test/benchmarks/mdc/chips/BUILD.bazel +++ b/test/benchmarks/mdc/chips/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_angular_dev_infra_private//benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") +load("@npm//@angular/dev-infra-private/benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") # TODO(wagnermaciel): Update this target to provide indigo-pink in a way that doesn't require having to import it with # stylesUrls inside the components once `component_benchmark` supports asset injection. diff --git a/test/benchmarks/mdc/form-field/BUILD.bazel b/test/benchmarks/mdc/form-field/BUILD.bazel index dbb36ee40a15..1bb82479b3de 100644 --- a/test/benchmarks/mdc/form-field/BUILD.bazel +++ b/test/benchmarks/mdc/form-field/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_angular_dev_infra_private//benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") +load("@npm//@angular/dev-infra-private/benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") # TODO(wagnermaciel): Update this target to provide indigo-pink in a way that doesn't require having to import it with # stylesUrls inside the components once `component_benchmark` supports asset injection. diff --git a/test/benchmarks/mdc/menu/BUILD.bazel b/test/benchmarks/mdc/menu/BUILD.bazel index c04c5836b330..1348dc772c9c 100644 --- a/test/benchmarks/mdc/menu/BUILD.bazel +++ b/test/benchmarks/mdc/menu/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_angular_dev_infra_private//benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") +load("@npm//@angular/dev-infra-private/benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") # TODO(wagnermaciel): Update this target to provide indigo-pink in a way that doesn't require having to import it with # stylesUrls inside the components once `component_benchmark` supports asset injection. diff --git a/test/benchmarks/mdc/radio/BUILD.bazel b/test/benchmarks/mdc/radio/BUILD.bazel index 18f52f7b81ef..4cca6db964c9 100644 --- a/test/benchmarks/mdc/radio/BUILD.bazel +++ b/test/benchmarks/mdc/radio/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_angular_dev_infra_private//benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") +load("@npm//@angular/dev-infra-private/benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") # TODO(wagnermaciel): Update this target to provide indigo-pink in a way that doesn't require having to import it with # stylesUrls inside the components once `component_benchmark` supports asset injection. diff --git a/test/benchmarks/mdc/slide-toggle/BUILD.bazel b/test/benchmarks/mdc/slide-toggle/BUILD.bazel index ec1638e4f276..18f295b6fd41 100644 --- a/test/benchmarks/mdc/slide-toggle/BUILD.bazel +++ b/test/benchmarks/mdc/slide-toggle/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_angular_dev_infra_private//benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") +load("@npm//@angular/dev-infra-private/benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") # TODO(wagnermaciel): Update this target to provide indigo-pink in a way that doesn't require having to import it with # stylesUrls inside the components once `component_benchmark` supports asset injection. diff --git a/test/benchmarks/mdc/table/BUILD.bazel b/test/benchmarks/mdc/table/BUILD.bazel index 7187033cb094..20eb5a63720f 100644 --- a/test/benchmarks/mdc/table/BUILD.bazel +++ b/test/benchmarks/mdc/table/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_angular_dev_infra_private//benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") +load("@npm//@angular/dev-infra-private/benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") component_benchmark( name = "benchmark", diff --git a/test/benchmarks/mdc/tabs/BUILD.bazel b/test/benchmarks/mdc/tabs/BUILD.bazel index d3c6844cc8a3..ba84d40d176f 100644 --- a/test/benchmarks/mdc/tabs/BUILD.bazel +++ b/test/benchmarks/mdc/tabs/BUILD.bazel @@ -1,4 +1,4 @@ -load("@npm_angular_dev_infra_private//benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") +load("@npm//@angular/dev-infra-private/benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark") # TODO(wagnermaciel): Update this target to provide indigo-pink in a way that doesn't require having to import it with # stylesUrls inside the components once `component_benchmark` supports asset injection. diff --git a/tools/defaults.bzl b/tools/defaults.bzl index 02ac1a5b95ff..e0c7207bef21 100644 --- a/tools/defaults.bzl +++ b/tools/defaults.bzl @@ -3,7 +3,7 @@ load("@io_bazel_rules_sass//:defs.bzl", _sass_binary = "sass_binary", _sass_library = "sass_library") load("@npm//@angular/bazel:index.bzl", _ng_module = "ng_module", _ng_package = "ng_package") load("@npm//@bazel/jasmine:index.bzl", _jasmine_node_test = "jasmine_node_test") -load("@npm//@bazel/karma:index.bzl", _karma_web_test = "karma_web_test", _karma_web_test_suite = "karma_web_test_suite") +load("@npm//@bazel/concatjs:index.bzl", _karma_web_test = "karma_web_test", _karma_web_test_suite = "karma_web_test_suite") load("@npm//@bazel/protractor:index.bzl", _protractor_web_test_suite = "protractor_web_test_suite") load("@npm//@bazel/typescript:index.bzl", _ts_library = "ts_library") load("//:packages.bzl", "VERSION_PLACEHOLDER_REPLACEMENTS", "getAngularUmdTargets") @@ -165,8 +165,8 @@ def karma_web_test_suite(name, **kwargs): kwargs["browsers"] = [ # Note: when changing the browser names here, also update the "yarn test" # script to reflect the new browser names. - "@npm_angular_dev_infra_private//browsers/chromium:chromium", - "@npm_angular_dev_infra_private//browsers/firefox:firefox", + "@npm//@angular/dev-infra-private/browsers/chromium:chromium", + "@npm//@angular/dev-infra-private/browsers/firefox:firefox", ] for opt_name in kwargs.keys(): @@ -200,7 +200,7 @@ def karma_web_test_suite(name, **kwargs): def protractor_web_test_suite(**kwargs): _protractor_web_test_suite( - browsers = ["@npm_angular_dev_infra_private//browsers/chromium:chromium"], + browsers = ["@npm//@angular/dev-infra-private/browsers/chromium:chromium"], **kwargs ) diff --git a/tools/dev-server/BUILD.bazel b/tools/dev-server/BUILD.bazel index 8628795e40e2..d8d8fcd27603 100644 --- a/tools/dev-server/BUILD.bazel +++ b/tools/dev-server/BUILD.bazel @@ -29,4 +29,7 @@ nodejs_binary( ":dev-server_lib", ], entry_point = ":main.ts", + # TODO(josephperrott): update dependency usages to no longer need bazel patch module resolver + # See: https://github.com/bazelbuild/rules_nodejs/wiki#--bazel_patch_module_resolver-now-defaults-to-false-2324 + templated_args = ["--bazel_patch_module_resolver"], ) diff --git a/tools/dgeni/BUILD.bazel b/tools/dgeni/BUILD.bazel index f9663293e083..466845caa4e3 100644 --- a/tools/dgeni/BUILD.bazel +++ b/tools/dgeni/BUILD.bazel @@ -11,6 +11,9 @@ nodejs_binary( "@npm//dgeni-packages", ], entry_point = ":bazel-bin.ts", + # TODO(josephperrott): update dependency usages to no longer need bazel patch module resolver + # See: https://github.com/bazelbuild/rules_nodejs/wiki#--bazel_patch_module_resolver-now-defaults-to-false-2324 + templated_args = ["--bazel_patch_module_resolver"], ) ts_library( diff --git a/tools/example-module/BUILD.bazel b/tools/example-module/BUILD.bazel index 5f11c75ceffb..dce810cf3344 100644 --- a/tools/example-module/BUILD.bazel +++ b/tools/example-module/BUILD.bazel @@ -21,4 +21,7 @@ nodejs_binary( "@npm//typescript", ], entry_point = ":bazel-bin.ts", + # TODO(josephperrott): update dependency usages to no longer need bazel patch module resolver + # See: https://github.com/bazelbuild/rules_nodejs/wiki#--bazel_patch_module_resolver-now-defaults-to-false-2324 + templated_args = ["--bazel_patch_module_resolver"], ) diff --git a/tools/highlight-files/BUILD.bazel b/tools/highlight-files/BUILD.bazel index 661ee5553d6a..bb8ef8094849 100644 --- a/tools/highlight-files/BUILD.bazel +++ b/tools/highlight-files/BUILD.bazel @@ -11,6 +11,7 @@ ts_library( "//tools/region-parser", "@npm//@types/fs-extra", "@npm//@types/node", + "@npm//fs-extra", ], ) @@ -22,4 +23,9 @@ nodejs_binary( "@npm//highlight.js", ], entry_point = ":highlight-files.ts", + templated_args = [ + # TODO(josephperrott): update dependency usages to no longer need bazel patch module resolver + # See: https://github.com/bazelbuild/rules_nodejs/wiki#--bazel_patch_module_resolver-now-defaults-to-false-2324 + "--bazel_patch_module_resolver", + ], ) diff --git a/tools/markdown-to-html/BUILD.bazel b/tools/markdown-to-html/BUILD.bazel index e8e0be2ae210..dccf642078ba 100644 --- a/tools/markdown-to-html/BUILD.bazel +++ b/tools/markdown-to-html/BUILD.bazel @@ -16,6 +16,7 @@ ts_library( "//tools/highlight-files:sources", "@npm//@types/marked", "@npm//@types/node", + "@npm//marked", ], ) @@ -27,6 +28,7 @@ nodejs_binary( "@npm//marked", ], entry_point = ":transform-markdown.ts", + templated_args = ["--bazel_patch_module_resolver"], ) ts_library( diff --git a/tools/markdown-to-html/docs-marked-renderer.ts b/tools/markdown-to-html/docs-marked-renderer.ts index 38a29152e724..d81f0f84faea 100644 --- a/tools/markdown-to-html/docs-marked-renderer.ts +++ b/tools/markdown-to-html/docs-marked-renderer.ts @@ -81,7 +81,8 @@ export class DocsMarkdownRenderer extends Renderer { html = html.replace(exampleCommentRegex, (_match: string, content: string) => { // using [\s\S]* because .* does not match line breaks if (content.match(/\{[\s\S]*\}/g)) { - const {example, file, region} = JSON.parse(content); + const {example, file, region} = JSON.parse(content) as { + example: string, file: string, region: string}; return `
`; diff --git a/tools/package-docs-content/BUILD.bazel b/tools/package-docs-content/BUILD.bazel index 5b507c4ae061..22b2b548c738 100644 --- a/tools/package-docs-content/BUILD.bazel +++ b/tools/package-docs-content/BUILD.bazel @@ -10,6 +10,9 @@ nodejs_binary( "@npm//fs-extra", ], entry_point = ":package-docs-content.ts", + # TODO(josephperrott): update dependency usages to no longer need bazel patch module resolver + # See: https://github.com/bazelbuild/rules_nodejs/wiki#--bazel_patch_module_resolver-now-defaults-to-false-2324 + templated_args = ["--bazel_patch_module_resolver"], ) ts_library( diff --git a/tools/postinstall/@bazel_typescript_tsc_wrapped_worker_cache_fix.patch b/tools/postinstall/@bazel_typescript_tsc_wrapped_worker_cache_fix.patch deleted file mode 100644 index 740453f4f85e..000000000000 --- a/tools/postinstall/@bazel_typescript_tsc_wrapped_worker_cache_fix.patch +++ /dev/null @@ -1,34 +0,0 @@ -diff --git node_modules/@bazel/typescript/internal/tsc_wrapped/compiler_host.js node_modules/@bazel/typescript/internal/tsc_wrapped/compiler_host.js -index 031d9dad1..a7fe9b79b 100644 ---- node_modules/@bazel/typescript/internal/tsc_wrapped/compiler_host.js -+++ node_modules/@bazel/typescript/internal/tsc_wrapped/compiler_host.js -@@ -377,10 +377,27 @@ class CompilerHost { - `which would be overwritten with ${moduleName} ` + - `by Bazel's TypeScript compiler.`); - } -- // Setting the moduleName is equivalent to the original source having a -- // /// directive -+ -+ // Setting the moduleName is equivalent to the original source having the triple -+ // slash `///` directive. Also note that we tag -+ // source files for which we assigned a generated module name. This is necessary -+ // so that we can reset the module name when the same source file is loaded from -+ // a cache, but with a different module format where the auto-generated module -+ // names are not desirable. The module name should not leak from previous -+ // compilations through a potential source file cache. -+ sf._hasGeneratedAmdModuleName = true; - sf.moduleName = moduleName; -+ return sf; - } -+ -+ // If the loaded source file has a generated amd module name applied from -+ // previous compilations (in worker mode), reset the file module name -+ // as neither the UMD or AMD module format is used (for which we generate -+ // the AMD module names automatically). -+ if (sf._hasGeneratedAmdModuleName) { -+ sf.moduleName = undefined; -+ } -+ - return sf; - }); - } diff --git a/tools/postinstall/apply-patches.js b/tools/postinstall/apply-patches.js index 930d1df52504..69ef0a19098c 100644 --- a/tools/postinstall/apply-patches.js +++ b/tools/postinstall/apply-patches.js @@ -110,9 +110,6 @@ function applyPatches() { // Workaround for: https://github.com/bazelbuild/rules_nodejs/issues/1208. applyPatch(path.join(__dirname, './manifest_externs_hermeticity.patch')); - // Patches the changes from: https://github.com/bazelbuild/rules_typescript/pull/504. - applyPatch(path.join(__dirname, './@bazel_typescript_tsc_wrapped_worker_cache_fix.patch')); - // Workaround for https://github.com/angular/angular/issues/33452: searchAndReplace( /angular_compiler_options = {/, `$& diff --git a/yarn.lock b/yarn.lock index 08e023826314..e119f68af36d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -116,9 +116,9 @@ dependencies: tslib "^2.0.0" -"@angular/dev-infra-private@https://github.com/angular/dev-infra-private-builds.git#71d57c29a10c03d07f889581608e3a2315a1dc7e": +"@angular/dev-infra-private@https://github.com/angular/dev-infra-private-builds.git#a8dbb0d8cd8de1e86a4ec4ea66b5bd89a47d4876": version "0.0.0" - resolved "https://github.com/angular/dev-infra-private-builds.git#71d57c29a10c03d07f889581608e3a2315a1dc7e" + resolved "https://github.com/angular/dev-infra-private-builds.git#a8dbb0d8cd8de1e86a4ec4ea66b5bd89a47d4876" dependencies: "@angular/benchpress" "0.2.1" "@bazel/buildifier" "^0.29.0" @@ -134,13 +134,13 @@ inquirer-autocomplete-prompt "^1.0.2" minimatch "^3.0.4" multimatch "^4.0.0" - node-fetch "^2.6.0" + node-fetch "^2.6.1" node-uuid "1.4.8" ora "^5.0.0" protractor "^5.4.2" selenium-webdriver "3.5.0" semver "^6.3.0" - shelljs "^0.8.3" + shelljs "^0.8.4" ts-node "^8.6.2" tslib "^2.0.0" typed-graphqlify "^2.3.0" @@ -677,43 +677,47 @@ resolved "https://registry.yarnpkg.com/@bazel/buildifier/-/buildifier-4.0.0.tgz#c99fb21295c7e2858fa176c2b950c589217ae8ac" integrity sha512-e242AK+shp+5bpAc9l93pmG5YRYRfM0INV3gfbdxNeBxccx1MJUagaiwxqAV+Mw55zk92gsb99f2TAc9tt6C7w== +"@bazel/concatjs@3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@bazel/concatjs/-/concatjs-3.1.0.tgz#401099b03d47678af2fe4a4fb3f8ca94800ce235" + integrity sha512-Jsve0lgOk9fD+KlsqYwrYc8MFsy+olNw+uv2l0Oxo2QMheUDMbcuUWg+AHmc3EOjZGSOJGJ0xw1SAvY7b5YNDQ== + dependencies: + protobufjs "6.8.8" + source-map-support "0.5.9" + tsutils "2.27.2" + "@bazel/ibazel@^0.14.0": version "0.14.0" resolved "https://registry.yarnpkg.com/@bazel/ibazel/-/ibazel-0.14.0.tgz#86fa0002bed2ce1123b7ad98d4dd4623a0d93244" integrity sha512-s0gyec6lArcRDwVfIP6xpY8iEaFpzrSpyErSppd3r2O49pOEg7n6HGS/qJ8ncvme56vrDk6crl/kQ6VAdEO+rg== -"@bazel/jasmine@^2.3.2": - version "2.3.2" - resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-2.3.2.tgz#ff120008a69a93ea2138c29cc266d7dec58333a9" - integrity sha512-GG2xAvYXgoW9SHco8RETuxkBTeLF7RI4rtuvAJdVhwwzsUeGovKROTbHvQEyo1qxmeQjQu0hzKr11VfwZPcCMA== +"@bazel/jasmine@3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-3.1.0.tgz#f71b60194f083cd171bf18089e90df1c16cb0ade" + integrity sha512-EPKbBtkqpolVhF9l9QCm8+wbdsRqtFvHgOruk/mkLXpvTmSV+cO//okunEMyeA03BIj1+Ek8Hqk4b4l4lAT4bw== dependencies: c8 "~7.1.0" jasmine-reporters "~2.3.2" -"@bazel/karma@^2.3.2": - version "2.3.2" - resolved "https://registry.yarnpkg.com/@bazel/karma/-/karma-2.3.2.tgz#4120618f7edd141b155f6f830fd0f04dc748a37c" - integrity sha512-+FFpem1Ul/BtqNrom8y1xPIa1cPEZeBvpao8BRLfQt46r7Nk9u11KI8ylNFk+yIQVhFqAD3JBaL3sbLAU7BJ5Q== - -"@bazel/protractor@^2.3.2": - version "2.3.3" - resolved "https://registry.yarnpkg.com/@bazel/protractor/-/protractor-2.3.3.tgz#44eca70d159d3e5a67654683f81266cc3594ce5a" - integrity sha512-06EFGstTshvofjiUd1ZJJepGeTgkLZNZB9Bfb7IhMC/ca1ZaeKB8SRWHhiPw7wN1QojHf4JJ+uhbqDt60m+Xrg== +"@bazel/protractor@3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@bazel/protractor/-/protractor-3.1.0.tgz#9d4e2514fa6949c58996b38824409811408924a8" + integrity sha512-39ilFP+grfdetXJOfeImNgNksB42vvlMmM/PU4cO5hUpGvDWSVpx9jIJUdr+NySf3M4A+Kizk3NtcO3xMNmwyQ== -"@bazel/rollup@^2.3.2": - version "2.3.2" - resolved "https://registry.yarnpkg.com/@bazel/rollup/-/rollup-2.3.2.tgz#637c9219d75fd40469efe881057b27032aa5896c" - integrity sha512-Eyz99eI/rsWDJws3eO2UGAmIoWmZWEzmchIBU30EoVzvQ5wqZciZ2lLOXkUIAosZsijjE1THiqCCf5gJtOmExw== +"@bazel/rollup@3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@bazel/rollup/-/rollup-3.1.0.tgz#36346f052b2ce3c1e31e5ebb05ed80464548eb00" + integrity sha512-lmgPhlR1VsJRsSE83Jlv+WT26Lso0/0FqXknlVuOmvCWFwSUKlriws729fqJZsvV5O2muAgJKuQl/zk+gqGCug== -"@bazel/terser@^2.3.2": - version "2.3.2" - resolved "https://registry.yarnpkg.com/@bazel/terser/-/terser-2.3.2.tgz#30f0b551f43eeafb64cb834d1f2f3e7f2ddef262" - integrity sha512-UasdVrMdaOEBwzNTTyWtUTH+ITQtXhV64XG6SdyWY1wWLgcgoUOiFYPN2lgXRZyKNpFezmq+CHJ5pqfYwzN3Rg== +"@bazel/terser@3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@bazel/terser/-/terser-3.1.0.tgz#5801e83d4ac648fb1a8824a77a1a1f32c3af0c1e" + integrity sha512-8oXZwy5G5dbr4zltBzLjfPw4ZARDEysB2E25dCqAo64XJ26ptS+D3/UnE3uZU9KuM/3ka1U+YIpit+f9SqCgTA== -"@bazel/typescript@^2.3.2": - version "2.3.2" - resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-2.3.2.tgz#6d49cc064a9323905dcf791fe0e959f75ddf2ade" - integrity sha512-O2lZfVGx1Uyc7GzLMyD4uiu1qWxy7xviVTEDPzFGcqZsHMCXMV/fEgMoiD0cI4diHwSWrc7Gm/CG9j/z+SRDzA== +"@bazel/typescript@3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-3.1.0.tgz#a07999ad7956b8c624604a521e653570bba32025" + integrity sha512-sEWuvkUGIDeRhjLENHtJyop7wu4UqKN8h/nSgUwc5gkpWXQiT2wGH5jKVxBqODOBHB+IInEMtAjyRmCT+HbSHA== dependencies: protobufjs "6.8.8" semver "5.6.0" @@ -8751,7 +8755,7 @@ matchdep@^2.0.0: resolve "^1.4.0" stack-trace "0.0.10" -material-components-web@^11.0.0-canary.3201cae47.0: +material-components-web@11.0.0-canary.3201cae47.0: version "11.0.0-canary.3201cae47.0" resolved "https://registry.yarnpkg.com/material-components-web/-/material-components-web-11.0.0-canary.3201cae47.0.tgz#d24ef1ef4368c6d1fe7bcfb0f9b9e48a9813d934" integrity sha512-jkv8MqeQg8YbOwLDvZQAtl2xFhvPAXE3zlzY1g5GYLTfXHRlOz47VVXz+7b1BzJteLP4KQP8ziEhwB9UdekLAg== @@ -10915,7 +10919,7 @@ redeyed@~2.1.0: dependencies: esprima "~4.0.0" -reflect-metadata@^0.1.13, reflect-metadata@^0.1.2: +reflect-metadata@^0.1.13, reflect-metadata@^0.1.2, reflect-metadata@^0.1.3: version "0.1.13" resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.13.tgz#67ae3ca57c972a2aa1642b10fe363fe32d49dc08" integrity sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg== @@ -11714,7 +11718,7 @@ shelljs@0.8.2: interpret "^1.0.0" rechoir "^0.6.2" -shelljs@^0.8.3: +shelljs@^0.8.3, shelljs@^0.8.4: version "0.8.4" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.4.tgz#de7684feeb767f8716b326078a8a00875890e3c2" integrity sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==