build(bazel): use fine-grained npm deps (#26111) (#26488)

PR Close #26488
This commit is contained in:
Greg Magolan 2018-10-04 13:14:14 -07:00 committed by Igor Minar
parent b6c9678f21
commit 1f3331f5e6
104 changed files with 6687 additions and 1820 deletions

View File

@ -15,19 +15,14 @@ alias(
actual = "@nodejs//:yarn",
)
alias(
name = "node_modules",
actual = "@angular_deps//:node_modules",
)
filegroup(
name = "web_test_bootstrap_scripts",
# do not sort
srcs = [
"@angular_deps//:node_modules/reflect-metadata/Reflect.js",
"@angular_deps//:node_modules/zone.js/dist/zone.js",
"@angular_deps//:node_modules/zone.js/dist/zone-testing.js",
"@angular_deps//:node_modules/zone.js/dist/task-tracking.js",
"@ngdeps//node_modules/reflect-metadata:Reflect.js",
"@ngdeps//node_modules/zone.js:dist/zone.js",
"@ngdeps//node_modules/zone.js:dist/zone-testing.js",
"@ngdeps//node_modules/zone.js:dist/task-tracking.js",
"//:test-events.js",
],
)
@ -35,11 +30,32 @@ filegroup(
filegroup(
name = "angularjs_scripts",
srcs = [
"@angular_deps//:node_modules/angular-1.5/angular.js",
"@angular_deps//:node_modules/angular-1.6/angular.js",
"@angular_deps//:node_modules/angular-mocks-1.5/angular-mocks.js",
"@angular_deps//:node_modules/angular-mocks-1.6/angular-mocks.js",
"@angular_deps//:node_modules/angular-mocks/angular-mocks.js",
"@angular_deps//:node_modules/angular/angular.js",
"@ngdeps//node_modules/angular:angular.js",
"@ngdeps//node_modules/angular-1.5:angular.js",
"@ngdeps//node_modules/angular-1.6:angular.js",
"@ngdeps//node_modules/angular-mocks:angular-mocks.js",
"@ngdeps//node_modules/angular-mocks-1.5:angular-mocks.js",
"@ngdeps//node_modules/angular-mocks-1.6:angular-mocks.js",
],
)
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary")
# Override for ts_web_test_suite to use @ngdeps instead of @npm
nodejs_binary(
name = "@bazel/karma/karma",
data = ["@ngdeps//@bazel/karma"],
entry_point = "@bazel/karma/karma.js",
install_source_map_support = False,
visibility = ["//visibility:public"],
)
# Override for ts_library to use @ngdeps instead of @npm
nodejs_binary(
name = "@bazel/typescript/tsc_wrapped",
data = ["@ngdeps//@bazel/typescript"],
entry_point = "@bazel/typescript/tsc_wrapped/tsc_wrapped.js",
install_source_map_support = False,
templated_args = ["--node_options=--expose-gc"],
visibility = ["//visibility:public"],
)

View File

@ -40,8 +40,7 @@ local_repository(
#
# Load and install our dependencies downloaded above.
#
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories")
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories", "yarn_install")
check_bazel_version("0.17.0", """
If you are on a Mac and using Homebrew, there is a breaking change to the installation in Bazel 0.16
@ -56,6 +55,12 @@ node_repositories(
yarn_version = "1.9.2",
)
yarn_install(
name = "npm",
package_json = "//tools:npm/package.json",
yarn_lock = "//tools:npm/yarn.lock",
)
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
go_rules_dependencies()

View File

@ -11,26 +11,3 @@ alias(
name = "tsconfig.json",
actual = "//src:tsconfig.json",
)
filegroup(
name = "node_modules",
srcs = glob(
[
# Include only .js, .json & .d.ts files to reduce the number of
# files in the //:node_modules filegroup
"node_modules/**/*.js",
"node_modules/**/*.json",
"node_modules/**/*.d.ts",
# All the files in the http-server package are necesssary
"node_modules/http-server/**",
# All the files in the protractor package are necesssary
"node_modules/protractor/**",
# Also include all files in node_modules/.bin
"node_modules/.bin/*",
],
exclude = [
# Exclude files with spaces which are illegal bazel labels
"node_modules/**/* *",
],
),
)

View File

@ -3,23 +3,6 @@ workspace(name = "bazel_integration_test")
#
# Download Bazel toolchain dependencies as needed by build actions
#
local_repository(
name = "build_bazel_rules_typescript",
path = "node_modules/@bazel/typescript",
)
load("@build_bazel_rules_typescript//:package.bzl", "rules_typescript_dependencies")
rules_typescript_dependencies()
http_archive(
name = "io_bazel_rules_sass",
url = "https://github.com/bazelbuild/rules_sass/archive/1.11.0.zip",
strip_prefix = "rules_sass-1.11.0",
sha256 = "dbe9fb97d5a7833b2a733eebc78c9c1e3880f676ac8af16e58ccf2139cbcad03",
)
#
# Point Bazel to WORKSPACEs that live in subdirectories
#
local_repository(
name = "angular",
@ -31,11 +14,15 @@ local_repository(
path = "node_modules/rxjs/src",
)
load("@angular//packages/bazel:package.bzl", "rules_angular_dependencies")
rules_angular_dependencies()
#
# Load and install our dependencies downloaded above.
# Setup dependencies loaded above
#
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories")
load("@build_bazel_rules_nodejs//:defs.bzl", "check_bazel_version", "node_repositories", "yarn_install")
check_bazel_version("0.17.0")
node_repositories(
@ -44,6 +31,12 @@ node_repositories(
yarn_version = "1.9.2",
)
yarn_install(
name = "npm",
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
)
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
go_rules_dependencies()

View File

@ -4,20 +4,23 @@
"version": "0.0.0",
"license": "MIT",
"dependencies": {
"reflect-metadata": "file:../../node_modules/reflect-metadata",
"rxjs": "file:../../node_modules/rxjs",
"tslib": "file:../../node_modules/tslib",
"zone.js": "file:../../node_modules/zone.js"
"reflect-metadata": "0.1.12",
"rxjs": "6.0.0",
"tslib": "1.9.3",
"zone.js": "0.8.26"
},
"devDependencies": {
"@bazel/typescript": "0.17.0",
"@types/jasmine": "file:../../node_modules/@types/jasmine",
"@bazel/karma": "0.19.1",
"@bazel/typescript": "0.19.1",
"@types/jasmine": "2.8.8",
"@types/source-map": "0.5.1",
"protractor": "file:../../node_modules/protractor",
"tsickle": "file:../../node_modules/tsickle",
"typescript": "file:../../node_modules/typescript"
"protractor": "5.1.2",
"shelljs": "^0.8.2",
"tsickle": "0.32.0",
"typescript": "3.0.1"
},
"scripts": {
"//": "TODO(gmagolan): figure out how to keep dependencies here up to date with the root package.json",
"test": "bazel build ... --noshow_progress && bazel test ..."
}
}

View File

@ -13,6 +13,7 @@ ng_module(
"@angular//packages/common/http",
"@angular//packages/core",
"@angular//packages/platform-browser",
"@npm//@types",
],
)
@ -21,14 +22,14 @@ load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
ts_devserver(
name = "devserver",
additional_root_paths = [
"bazel_integration_test/node_modules/tslib",
"bazel_integration_test/node_modules/zone.js/dist",
"npm/node_modules/tslib",
"npm/node_modules/zone.js/dist",
],
entry_module = "bazel_integration_test/src/main",
serving_path = "/bundle.min.js",
static_files = [
"//:node_modules/tslib/tslib.js",
"//:node_modules/zone.js/dist/zone.min.js",
"@npm//node_modules/tslib:tslib.js",
"@npm//node_modules/zone.js:dist/zone.min.js",
"index.html",
],
deps = ["//src"],
@ -39,7 +40,6 @@ load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary", "rollup_bundle")
rollup_bundle(
name = "bundle",
entry_point = "src/main",
node_modules = "//:node_modules",
deps = ["//src"],
)
@ -47,7 +47,7 @@ rollup_bundle(
# package.
genrule(
name = "zone.js",
srcs = ["//:node_modules/zone.js/dist/zone.min.js"],
srcs = ["@npm//node_modules/zone.js:dist/zone.min.js"],
outs = ["zone.min.js"],
cmd = "cp $< $@",
)

View File

@ -18,13 +18,13 @@ ng_module(
assets = [":hello-world-styles"],
deps = [
"@angular//packages/core",
"@npm//@types",
],
)
ng_package(
name = "npm_package",
entry_point = "src/hello-world/index.js",
node_modules = "//:node_modules",
deps = [":hello-world"],
)
@ -38,19 +38,23 @@ ts_library(
"@angular//packages/core/testing",
"@angular//packages/platform-browser",
"@angular//packages/platform-browser-dynamic/testing",
"@npm//@types",
"@npm//jasmine",
],
)
ts_web_test_suite(
name = "test",
srcs = ["//:node_modules/tslib/tslib.js"],
srcs = ["@npm//node_modules/tslib:tslib.js"],
bootstrap = [
"//:node_modules/zone.js/dist/zone-testing-bundle.js",
"//:node_modules/reflect-metadata/Reflect.js",
"@npm//node_modules/zone.js:dist/zone-testing-bundle.js",
"@npm//node_modules/reflect-metadata:Reflect.js",
],
browsers = [
"@io_bazel_rules_webtesting//browsers:chromium-local",
"@io_bazel_rules_webtesting//browsers:firefox-local",
# TODO(gregmagolan): re-enable firefox testing once fixed
# See https://github.com/bazelbuild/rules_typescript/issues/296
# "@io_bazel_rules_webtesting//browsers:firefox-local",
],
deps = [
":test_lib",

View File

@ -6,6 +6,10 @@ ts_library(
testonly = 1,
srcs = ["app.spec.ts"],
tsconfig = ":tsconfig.json",
deps = [
"@npm//@types",
"@npm//protractor",
],
)
ts_library(
@ -13,13 +17,20 @@ ts_library(
testonly = 1,
srcs = ["on-prepare.ts"],
tsconfig = ":tsconfig.json",
deps = ["@angular//packages/bazel/src/protractor/utils"],
deps = [
"@angular//packages/bazel/src/protractor/utils",
"@npm//@types",
"@npm//protractor",
],
)
protractor_web_test_suite(
name = "devserver_test",
configuration = "//:protractor.conf.js",
data = ["@angular//packages/bazel/src/protractor/utils"],
data = [
"@angular//packages/bazel/src/protractor/utils",
"@npm//protractor",
],
on_prepare = ":ts_on_prepare",
server = "//src:devserver",
deps = [":e2e"],
@ -28,7 +39,10 @@ protractor_web_test_suite(
protractor_web_test_suite(
name = "prodserver_test",
configuration = "//:protractor.conf.js",
data = ["@angular//packages/bazel/src/protractor/utils"],
data = [
"@angular//packages/bazel/src/protractor/utils",
"@npm//protractor",
],
on_prepare = ":ts_on_prepare",
server = "//src:prodserver",
deps = [":e2e"],

File diff suppressed because it is too large Load Diff

View File

@ -112,7 +112,7 @@ module.exports = function(config) {
// don't need this entire config file.
proxies: {
'/base/angular/': '/base/',
'/base/angular_deps/': '/base/',
'/base/ngdeps/': '/base/',
},
reporters: ['dots'],

View File

@ -23,5 +23,6 @@ ts_library(
deps = [
"//modules/e2e_util:lib",
"//packages:types",
"@ngdeps//protractor",
],
)

View File

@ -9,5 +9,10 @@ ts_library(
deps = [
"//packages:types",
"//packages/benchpress",
"@ngdeps//@types/fs-extra",
"@ngdeps//@types/selenium-webdriver",
"@ngdeps//fs-extra",
"@ngdeps//protractor",
"@ngdeps//selenium-webdriver",
],
)

View File

@ -41,6 +41,8 @@
},
"devDependencies": {
"@bazel/ibazel": "^0.1.1",
"@bazel/karma": "0.19.1",
"@bazel/typescript": "0.19.1",
"@types/angular": "^1.6.47",
"@types/base64-js": "1.2.5",
"@types/chai": "^4.1.2",
@ -70,6 +72,7 @@
"bower": "1.8.2",
"browserstacktunnel-wrapper": "2.0.1",
"canonical-path": "0.0.2",
"chai": "4.2.0",
"chokidar": "1.7.0",
"clang-format": "1.0.41",
"cldr": "4.10.0",
@ -126,7 +129,7 @@
"tsickle": "0.32",
"tslint": "5.7.0",
"tslint-eslint-rules": "4.1.1",
"tsutils": "2.20.0",
"tsutils": "2.27.2",
"typescript": "~3.1.1",
"uglify-es": "^3.3.9",
"universal-analytics": "0.4.15",

View File

@ -11,6 +11,10 @@ load("//tools:defaults.bzl", "ts_library")
ts_library(
name = "types",
srcs = glob(["*.ts"]),
deps = [
"@ngdeps//@types/hammerjs",
"@ngdeps//zone.js",
],
)
exports_files([

View File

@ -24,8 +24,8 @@ def rules_angular_dependencies():
_maybe(
http_archive,
name = "build_bazel_rules_typescript",
strip_prefix = "rules_typescript-0.17.0",
url = "https://github.com/bazelbuild/rules_typescript/archive/0.17.0.zip",
url = "https://github.com/bazelbuild/rules_typescript/archive/6561f95aa621a6e3d421ab86451167ec84e580fa.zip",
strip_prefix = "rules_typescript-6561f95aa621a6e3d421ab86451167ec84e580fa",
)
# Needed for Remote Execution

View File

@ -19,8 +19,8 @@ Fulfills similar role as the package.json file.
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# This file mirrored from https://raw.githubusercontent.com/bazelbuild/rules_nodejs/0.13.4/package.bzl
VERSION = "0.13.4"
# This file mirrored from https://raw.githubusercontent.com/bazelbuild/rules_nodejs/0.14.2/package.bzl
VERSION = "0.14.2"
def rules_nodejs_dependencies():
"""

View File

@ -20,8 +20,8 @@ against a minimum dependent build_bazel_rules_typescript version.
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# This file mirrored from https://raw.githubusercontent.com/bazelbuild/rules_typescript/0.17.0/package.bzl
VERSION = "0.17.0"
# This file mirrored from https://raw.githubusercontent.com/bazelbuild/rules_typescript/0.19.1/package.bzl
VERSION = "0.19.1"
def rules_typescript_dependencies():
"""
@ -35,18 +35,17 @@ def rules_typescript_dependencies():
_maybe(
http_archive,
name = "build_bazel_rules_nodejs",
urls = ["https://github.com/bazelbuild/rules_nodejs/archive/0.13.4.zip"],
strip_prefix = "rules_nodejs-0.13.4",
sha256 = "a612bfd80b980bf7aa1ef9b24ef3c86a7e82bcd3f8aa92c5ef492472657cc7c8",
urls = ["https://github.com/bazelbuild/rules_nodejs/archive/3501f9b6a9a78a01fd1ef9b808f022bfcbb478a0.zip"],
strip_prefix = "rules_nodejs-3501f9b6a9a78a01fd1ef9b808f022bfcbb478a0",
)
# ts_web_test depends on the web testing rules to provision browsers.
_maybe(
http_archive,
name = "io_bazel_rules_webtesting",
urls = ["https://github.com/bazelbuild/rules_webtesting/archive/0.2.1.zip"],
strip_prefix = "rules_webtesting-0.2.1",
sha256 = "7d490aadff9b5262e5251fa69427ab2ffd1548422467cb9f9e1d110e2c36f0fa",
urls = ["https://github.com/bazelbuild/rules_webtesting/archive/111d792b9a5b17f87b6e177e274dbbee46094791.zip"],
strip_prefix = "rules_webtesting-111d792b9a5b17f87b6e177e274dbbee46094791",
sha256 = "a13af63e928c34eff428d47d31bafeec4e38ee9b6940e70bf2c9cd47184c5c16",
)
# ts_devserver depends on the Go rules.
@ -54,16 +53,40 @@ def rules_typescript_dependencies():
_maybe(
http_archive,
name = "io_bazel_rules_go",
urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.13.0/rules_go-0.13.0.tar.gz"],
sha256 = "ba79c532ac400cefd1859cbc8a9829346aa69e3b99482cd5a54432092cbc3933",
urls = ["https://github.com/bazelbuild/rules_go/archive/cbc1e32fba771845305f15e341fa26595d4a136d.zip"],
strip_prefix = "rules_go-cbc1e32fba771845305f15e341fa26595d4a136d",
sha256 = "d02b1d8d11fb67fb1e451645256e58a1542170eedd6e2ba160c8540c96f659da",
)
# go_repository is defined in bazel_gazelle
_maybe(
http_archive,
name = "bazel_gazelle",
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.13.0/bazel-gazelle-0.13.0.tar.gz"],
sha256 = "bc653d3e058964a5a26dcad02b6c72d7d63e6bb88d94704990b908a1445b8758",
urls = ["https://github.com/bazelbuild/bazel-gazelle/archive/109bcfd6880aac2517a1a2d48987226da6337e11.zip"],
strip_prefix = "bazel-gazelle-109bcfd6880aac2517a1a2d48987226da6337e11",
sha256 = "8f80ce0f7a6f8a3fee1fb863c9a23e1de99d678c1cf3c6f0a128f3b883168208",
)
# ts_auto_deps depends on com_github_bazelbuild_buildtools
_maybe(
http_archive,
name = "com_github_bazelbuild_buildtools",
url = "https://github.com/bazelbuild/buildtools/archive/0.12.0.zip",
strip_prefix = "buildtools-0.12.0",
sha256 = "ec495cbd19238c9dc488fd65ca1fee56dcb1a8d6d56ee69a49f2ebe69826c261",
)
###############################################
# Repeat the dependencies of rules_nodejs here!
# We can't load() from rules_nodejs yet, because we've only just fetched it.
# But we also don't want to make users load and call the rules_nodejs_dependencies
# function because we can do that for them, mostly hiding the transitive dependency.
_maybe(
http_archive,
name = "bazel_skylib",
url = "https://github.com/bazelbuild/bazel-skylib/archive/0.5.0.zip",
strip_prefix = "bazel-skylib-0.5.0",
sha256 = "ca4e3b8e4da9266c3a9101c8f4704fe2e20eb5625b2a6a7d2d7d45e3dd4efffd",
)
def _maybe(repo_rule, name, **kwargs):

View File

@ -80,12 +80,20 @@ def _esm5_outputs_aspect(target, ctx):
],
)
replay_compiler = target.typescript.replay_params.compiler.path.split("/")[-1]
if replay_compiler == "tsc_wrapped":
compiler = ctx.executable._tsc_wrapped
elif replay_compiler == "ngc-wrapped":
compiler = ctx.executable._ngc_wrapped
else:
fail("Unknown replay compiler", target.typescript.replay_params.compiler.path)
ctx.actions.run(
progress_message = "Compiling TypeScript (ES5 with ES Modules) %s" % target.label,
inputs = target.typescript.replay_params.inputs + [tsconfig],
outputs = outputs,
arguments = [tsconfig.path],
executable = target.typescript.replay_params.compiler,
executable = compiler,
execution_requirements = {
# TODO(alexeagle): enable worker mode for these compilations
"supports-workers": "0",
@ -122,15 +130,11 @@ esm5_outputs_aspect = aspect(
executable = True,
cfg = "host",
),
# We must list tsc_wrapped here to ensure it's built before the action runs
# For some reason, having the compiler output as an input to the action above
# is not sufficient.
"_tsc_wrapped": attr.label(
default = Label("@build_bazel_rules_typescript//internal:tsc_wrapped_bin"),
default = Label("@build_bazel_rules_typescript//:@bazel/typescript/tsc_wrapped"),
executable = True,
cfg = "host",
),
# Same comment as for tsc_wrapped above.
"_ngc_wrapped": attr.label(
default = Label("//packages/bazel/src/ngc-wrapped"),
executable = True,

View File

@ -14,6 +14,7 @@ load(
"ts_providers_dict_to_struct",
"tsc_wrapped_tsconfig",
)
load("@build_bazel_rules_nodejs//internal/common:node_module_info.bzl", "NodeModuleInfo", "collect_node_modules_aspect")
def compile_strategy(ctx):
"""Detect which strategy should be used to implement ng_module.
@ -379,23 +380,31 @@ def ngc_compile_action(
return None
def _filter_ts_inputs(all_inputs):
# The compiler only needs to see TypeScript sources from the npm dependencies,
# but may need to look at package.json and ngsummary.json files as well.
return [
f
for f in all_inputs
if f.path.endswith(".js") or f.path.endswith(".ts") or f.path.endswith(".json")
]
def _compile_action(ctx, inputs, outputs, messages_out, tsconfig_file, node_opts):
# Give the Angular compiler all the user-listed assets
file_inputs = list(ctx.files.assets)
# The compiler only needs to see TypeScript sources from the npm dependencies,
# but may need to look at package.json and ngsummary.json files as well.
if hasattr(ctx.attr, "node_modules"):
file_inputs += [
f
for f in ctx.files.node_modules
if f.path.endswith(".ts") or f.path.endswith(".json")
]
file_inputs.extend(_filter_ts_inputs(ctx.files.node_modules))
# If the user supplies a tsconfig.json file, the Angular compiler needs to read it
if hasattr(ctx.attr, "tsconfig") and ctx.file.tsconfig:
file_inputs.append(ctx.file.tsconfig)
# Also include files from npm fine grained deps as action_inputs.
# These deps are identified by the NodeModuleInfo provider.
for d in ctx.attr.deps:
if NodeModuleInfo in d:
file_inputs.extend(_filter_ts_inputs(d.files))
# Collect the inputs and summary files from our deps
action_inputs = depset(
file_inputs,
@ -443,6 +452,13 @@ def ng_module_impl(ctx, ts_compile_actions):
providers = ts_compile_actions(
ctx,
is_library = True,
# Filter out the node_modules from deps passed to TypeScript compiler
# since they don't have the required providers.
# They were added to the action inputs for tsc_wrapped already.
# strict_deps checking currently skips node_modules.
# TODO(alexeagle): turn on strict deps checking when we have a real
# provider for JS/DTS inputs to ts_library.
deps = [d for d in ctx.attr.deps if not NodeModuleInfo in d],
compile_action = _prodmode_compile_action,
devmode_compile_action = _devmode_compile_action,
tsc_wrapped_tsconfig = _ngc_tsconfig,
@ -474,6 +490,11 @@ def ng_module_impl(ctx, ts_compile_actions):
def _ng_module_impl(ctx):
return ts_providers_dict_to_struct(ng_module_impl(ctx, compile_ts))
local_deps_aspects = [collect_node_modules_aspect, _collect_summaries_aspect]
# Workaround skydoc bug which assumes DEPS_ASPECTS is a str type
[local_deps_aspects.append(a) for a in DEPS_ASPECTS]
NG_MODULE_ATTRIBUTES = {
"srcs": attr.label_list(allow_files = [".ts"]),
@ -481,7 +502,7 @@ NG_MODULE_ATTRIBUTES = {
# https://github.com/bazelbuild/skydoc/issues/21
"deps": attr.label_list(
doc = "Targets that are imported by this target",
aspects = list(DEPS_ASPECTS) + [_collect_summaries_aspect],
aspects = local_deps_aspects,
),
"assets": attr.label_list(
doc = ".html and .css files needed by the Angular compiler",
@ -514,12 +535,68 @@ NG_MODULE_ATTRIBUTES = {
NG_MODULE_RULE_ATTRS = dict(dict(COMMON_ATTRIBUTES, **NG_MODULE_ATTRIBUTES), **{
"tsconfig": attr.label(allow_files = True, single_file = True),
# @// is special syntax for the "main" repository
# The default assumes the user specified a target "node_modules" in their
# root BUILD file.
"node_modules": attr.label(
default = Label("@//:node_modules"),
doc = """The npm packages which should be available during the compile.
The default value is `@npm//typescript:typescript__typings` is setup
for projects that use bazel managed npm deps that. It is recommended
that you use the workspace name `@npm` for bazel managed deps so the
default node_modules works out of the box. Otherwise, you'll have to
override the node_modules attribute manually. This default is in place
since ng_module will always depend on at least the typescript
default libs which are provided by `@npm//typescript:typescript__typings`.
This attribute is DEPRECATED. As of version 0.18.0 the recommended
approach to npm dependencies is to use fine grained npm dependencies
which are setup with the `yarn_install` or `npm_install` rules.
For example, in targets that used a `//:node_modules` filegroup,
```
ng_module(
name = "my_lib",
...
node_modules = "@npm//node_modules",
)
```
which specifies all files within the `//:node_modules` filegroup
to be inputs to the `my_lib`. Using fine grained npm dependencies,
`my_lib` is defined with only the npm dependencies that are
needed:
```
ng_module(
name = "my_lib",
...
deps = [
"@npm//@types/foo",
"@npm//@types/bar",
"@npm//foo",
"@npm//bar",
...
],
)
```
In this case, only the listed npm packages and their
transitive deps are includes as inputs to the `my_lib` target
which reduces the time required to setup the runfiles for this
target (see https://github.com/bazelbuild/bazel/issues/5153).
The default typescript libs are also available via the node_modules
default in this case.
The @npm external repository and the fine grained npm package
targets are setup using the `yarn_install` or `npm_install` rule
in your WORKSPACE file:
yarn_install(
name = "npm",
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
)
""",
default = Label("@npm//typescript:typescript__typings"),
),
"entry_point": attr.string(),

View File

@ -14,6 +14,7 @@ exports_files(["rollup.config.js"])
ts_library(
name = "lib",
srcs = glob(["*.ts"]),
compiler = "//:@bazel/typescript/tsc_wrapped",
node_modules = "@angular_packager_deps//:node_modules",
tsconfig = ":tsconfig.json",
)

View File

@ -17,7 +17,7 @@ load("@build_bazel_rules_nodejs//:internal/collect_es6_sources.bzl", "collect_es
load(
"@build_bazel_rules_nodejs//:internal/rollup/rollup_bundle.bzl",
"ROLLUP_ATTRS",
"rollup_module_mappings_aspect",
"ROLLUP_DEPS_ASPECTS",
"run_uglify",
"write_rollup_config",
)
@ -28,6 +28,7 @@ load(
"create_package",
)
load("@build_bazel_rules_nodejs//:internal/node.bzl", "sources_aspect")
load("@build_bazel_rules_nodejs//internal/common:node_module_info.bzl", "NodeModuleInfo")
load("//packages/bazel/src:esm5.bzl", "esm5_outputs_aspect", "esm5_root_dir", "flatten_esm5")
# Convert from some-dash-case to someCamelCase
@ -160,6 +161,13 @@ def _filter_out_generated_files(files):
def _esm2015_root_dir(ctx):
return ctx.label.name + ".es6"
def _filter_js_inputs(all_inputs):
return [
f
for f in all_inputs
if f.path.endswith(".js") or f.path.endswith(".json")
]
# ng_package produces package that is npm-ready.
def _ng_package_impl(ctx):
npm_package_directory = ctx.actions.declare_directory("%s.ng_pkg" % ctx.label.name)
@ -235,11 +243,19 @@ def _ng_package_impl(ctx):
umd_output = ctx.outputs.umd
min_output = ctx.outputs.umd_min
node_modules_files = _filter_js_inputs(ctx.files.node_modules)
# Also include files from npm fine grained deps as inputs.
# These deps are identified by the NodeModuleInfo provider.
for d in ctx.attr.deps:
if NodeModuleInfo in d:
node_modules_files += _filter_js_inputs(d.files)
esm2015_config = write_rollup_config(ctx, [], "/".join([ctx.bin_dir.path, ctx.label.package, _esm2015_root_dir(ctx)]), filename = "_%s.rollup_esm2015.conf.js")
esm5_config = write_rollup_config(ctx, [], "/".join([ctx.bin_dir.path, ctx.label.package, esm5_root_dir(ctx)]), filename = "_%s.rollup_esm5.conf.js")
fesm2015.append(_rollup(ctx, "fesm2015", esm2015_config, es2015_entry_point, esm_2015_files + ctx.files.node_modules, fesm2015_output))
fesm5.append(_rollup(ctx, "fesm5", esm5_config, es5_entry_point, esm5_sources + ctx.files.node_modules, fesm5_output))
fesm2015.append(_rollup(ctx, "fesm2015", esm2015_config, es2015_entry_point, esm_2015_files + node_modules_files, fesm2015_output))
fesm5.append(_rollup(ctx, "fesm5", esm5_config, es5_entry_point, esm5_sources + node_modules_files, fesm5_output))
bundles.append(
_rollup(
@ -247,7 +263,7 @@ def _ng_package_impl(ctx):
"umd",
esm5_config,
es5_entry_point,
esm5_sources + ctx.files.node_modules,
esm5_sources + node_modules_files,
umd_output,
format = "umd",
package_name = package_name,
@ -332,7 +348,8 @@ def _ng_package_impl(ctx):
devfiles = depset()
if ctx.attr.include_devmode_srcs:
for d in ctx.attr.deps:
devfiles = depset(transitive = [devfiles, d.files, d.node_sources])
if not NodeModuleInfo in d:
devfiles = depset(transitive = [devfiles, d.files, d.node_sources])
# Re-use the create_package function from the nodejs npm_package rule.
package_dir = create_package(
@ -344,13 +361,14 @@ def _ng_package_impl(ctx):
files = depset([package_dir]),
)]
DEPS_ASPECTS = [esm5_outputs_aspect, sources_aspect]
# Workaround skydoc bug which assumes ROLLUP_DEPS_ASPECTS is a str type
[DEPS_ASPECTS.append(a) for a in ROLLUP_DEPS_ASPECTS]
NG_PACKAGE_ATTRS = dict(NPM_PACKAGE_ATTRS, **dict(ROLLUP_ATTRS, **{
"srcs": attr.label_list(allow_files = True),
"deps": attr.label_list(aspects = [
rollup_module_mappings_aspect,
esm5_outputs_aspect,
sources_aspect,
]),
"deps": attr.label_list(aspects = DEPS_ASPECTS),
"data": attr.label_list(
doc = "Additional, non-Angular files to be added to the package, e.g. global CSS assets.",
allow_files = True,

View File

@ -17,8 +17,8 @@
load(
"@build_bazel_rules_nodejs//internal/rollup:rollup_bundle.bzl",
"ROLLUP_ATTRS",
"ROLLUP_DEPS_ASPECTS",
"ROLLUP_OUTPUTS",
"rollup_module_mappings_aspect",
"run_rollup",
"run_sourcemapexplorer",
"run_uglify",
@ -141,16 +141,18 @@ def _ng_rollup_bundle(ctx):
return DefaultInfo(files = depset([ctx.outputs.build_es5_min, sourcemap]))
DEPS_ASPECTS = [esm5_outputs_aspect]
# Workaround skydoc bug which assumes ROLLUP_DEPS_ASPECTS is a str type
[DEPS_ASPECTS.append(a) for a in ROLLUP_DEPS_ASPECTS]
ng_rollup_bundle = rule(
implementation = _ng_rollup_bundle,
attrs = dict(ROLLUP_ATTRS, **{
"deps": attr.label_list(
doc = """Other targets that provide JavaScript files.
Typically this will be `ts_library` or `ng_module` targets.""",
aspects = [
rollup_module_mappings_aspect,
esm5_outputs_aspect,
],
aspects = DEPS_ASPECTS,
),
"_rollup": attr.label(
executable = True,

View File

@ -13,7 +13,9 @@ ts_library(
"extract_i18n.ts",
"index.ts",
],
compiler = "//:@bazel/typescript/tsc_wrapped",
module_name = "@angular/bazel",
node_modules = "@ngdeps//typescript:typescript__typings",
tsconfig = ":tsconfig.json",
visibility = ["//packages/bazel/test/ngc-wrapped:__subpackages__"],
deps = [
@ -22,7 +24,10 @@ ts_library(
# Users will get this dependency from node_modules.
"//packages/compiler-cli",
# END-INTERNAL
"@build_bazel_rules_typescript//internal:tsc_wrapped",
"@ngdeps//@bazel/typescript",
"@ngdeps//@types/node",
"@ngdeps//tsickle",
"@ngdeps//typescript",
],
)
@ -31,9 +36,9 @@ nodejs_binary(
data = [
":ngc_lib",
"@build_bazel_rules_typescript//third_party/github.com/bazelbuild/bazel/src/main/protobuf:worker_protocol.proto",
"@ngdeps//tslib",
],
entry_point = "angular/packages/bazel/src/ngc-wrapped/index.js",
node_modules = "@//:node_modules",
visibility = ["//visibility:public"],
)
@ -43,6 +48,5 @@ nodejs_binary(
":ngc_lib",
],
entry_point = "angular/packages/bazel/src/ngc-wrapped/index.js/extract_i18n.js",
node_modules = "@//:node_modules",
visibility = ["//visibility:public"],
)

View File

@ -1,5 +1,6 @@
{
"compilerOptions": {
"lib": ["es5", "es2015.collection", "es2015.core"]
"lib": ["es5", "es2015.collection", "es2015.core"],
"types": ["node"]
}
}

View File

@ -202,7 +202,6 @@ def protractor_web_test(
name = protractor_bin_name,
entry_point = "protractor/bin/protractor",
data = srcs + deps + data,
node_modules = "@//:node_modules",
testonly = 1,
visibility = ["//visibility:private"],
)
@ -303,7 +302,6 @@ def protractor_web_test_suite(
name = protractor_bin_name,
entry_point = "protractor/bin/protractor",
data = srcs + deps + data,
node_modules = "@//:node_modules",
testonly = 1,
visibility = ["//visibility:private"],
)

View File

@ -11,6 +11,9 @@ load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
ts_library(
name = "utils",
srcs = ["index.ts"],
compiler = "//:@bazel/typescript/tsc_wrapped",
module_name = "@angular/bazel/protractor-utils",
node_modules = "@ngdeps//typescript:typescript__typings",
tsconfig = ":tsconfig.json",
deps = ["@ngdeps//@types/node"],
)

View File

@ -1,6 +1,7 @@
{
"compilerOptions": {
"noImplicitAny": true,
"lib": ["es2015"]
"lib": ["es2015"],
"types": ["node"]
}
}

View File

@ -10,7 +10,10 @@ ts_library(
name = "core_spec_lib",
testonly = True,
srcs = ["core_package.spec.ts"],
deps = ["//packages:types"],
deps = [
"//packages:types",
"@ngdeps//@types/shelljs",
],
)
jasmine_node_test(
@ -18,6 +21,8 @@ jasmine_node_test(
srcs = [":core_spec_lib"],
data = [
"//packages/core:npm_package",
"@ngdeps//@types/shelljs",
"@ngdeps//shelljs",
],
)
@ -25,20 +30,29 @@ ts_library(
name = "common_spec_lib",
testonly = True,
srcs = ["common_package.spec.ts"],
deps = ["//packages:types"],
deps = [
"//packages:types",
"@ngdeps//@types/shelljs",
],
)
jasmine_node_test(
name = "common_package",
srcs = [":common_spec_lib"],
data = ["//packages/common:npm_package"],
data = [
"//packages/common:npm_package",
"@ngdeps//shelljs",
],
)
ts_library(
name = "example_spec_lib",
testonly = True,
srcs = ["example_package.spec.ts"],
deps = ["//packages:types"],
deps = [
"//packages:types",
"@ngdeps//@types/diff",
],
)
jasmine_node_test(

View File

@ -1,13 +1,15 @@
package(default_visibility = ["//packages/bazel/test:__subpackages__"])
load("//packages/bazel:index.bzl", "ng_module", "ng_package")
load("//tools:defaults.bzl", "npm_package")
load("//tools:defaults.bzl", "ng_module", "ng_package", "npm_package")
ng_module(
name = "example",
srcs = glob(["*.ts"]),
module_name = "example",
deps = ["//packages/bazel/test/ng_package/example/secondary"],
deps = [
"//packages/bazel/test/ng_package/example/secondary",
"@ngdeps//@types",
],
)
ng_package(

View File

@ -1,10 +1,13 @@
package(default_visibility = ["//packages/bazel/test:__subpackages__"])
load("//packages/bazel:index.bzl", "ng_module")
load("//tools:defaults.bzl", "ng_module")
ng_module(
name = "secondary",
srcs = glob(["*.ts"]),
module_name = "example/secondary",
deps = ["//packages/core"],
deps = [
"//packages/core",
"@ngdeps//@types",
],
)

View File

@ -2,6 +2,7 @@ load("//tools:defaults.bzl", "jasmine_node_test", "ts_library")
ts_library(
name = "ngc_test_lib",
testonly = True,
srcs = [
"index_test.ts",
"test_support.ts",
@ -11,6 +12,7 @@ ts_library(
deps = [
"//packages/bazel/src/ngc-wrapped:ngc_lib",
"//packages/compiler-cli",
"@ngdeps//typescript",
],
)

View File

@ -6,5 +6,8 @@ ng_module(
name = "empty",
srcs = ["empty.ts"],
tsconfig = ":tsconfig.json",
deps = ["//packages/core"],
deps = [
"//packages/core",
"@ngdeps//@types",
],
)

View File

@ -70,7 +70,7 @@ export function createTsConfig(options: TsConfigOptions) {
'tsickleExternsPath': '',
// we don't copy the node_modules into our tmp dir, so we should look in
// the original workspace directory for it
'nodeModulesPrefix': '../angular/external/angular_deps/node_modules',
'nodeModulesPrefix': '../angular/external/ngdeps/node_modules',
},
'files': options.files,
'angularCompilerOptions': {

View File

@ -1,12 +1,15 @@
load("//packages/bazel:index.bzl", "protractor_web_test_suite")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver", "ts_library")
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary", "rollup_bundle")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
load("@build_bazel_rules_nodejs//:defs.bzl", "rollup_bundle")
load("//tools:defaults.bzl", "ts_library")
load("//tools/http-server:http_server.bzl", "http_server")
ts_library(
name = "app",
srcs = ["app.ts"],
tsconfig = ":tsconfig.json",
# FIXME: should not be needed here!
deps = ["@ngdeps//@types/jasmine"],
)
ts_devserver(
@ -19,7 +22,6 @@ ts_devserver(
rollup_bundle(
name = "bundle",
entry_point = "packages/bazel/test/protractor-2/app",
node_modules = "//:node_modules",
deps = [":app"],
)
@ -36,6 +38,10 @@ ts_library(
testonly = True,
srcs = ["test.spec.ts"],
tsconfig = ":tsconfig.json",
deps = [
"@ngdeps//@types/selenium-webdriver",
"@ngdeps//protractor",
],
)
protractor_web_test_suite(
@ -44,7 +50,10 @@ protractor_web_test_suite(
data = ["//packages/bazel/src/protractor/utils"],
on_prepare = ":on-prepare.js",
server = ":prodserver",
deps = [":ts_spec"],
deps = [
":ts_spec",
"@ngdeps//protractor",
],
)
protractor_web_test_suite(
@ -53,5 +62,8 @@ protractor_web_test_suite(
data = ["//packages/bazel/src/protractor/utils"],
on_prepare = ":on-prepare.js",
server = ":devserver",
deps = [":ts_spec"],
deps = [
":ts_spec",
"@ngdeps//protractor",
],
)

View File

@ -1,5 +1,6 @@
{
"compilerOptions": {
"lib": ["dom", "es2015"]
"lib": ["dom", "es2015"],
"types": ["jasmine"]
}
}

View File

@ -1,11 +1,15 @@
load("//packages/bazel:index.bzl", "protractor_web_test_suite")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
load("//tools:defaults.bzl", "ts_library")
ts_library(
name = "ts_spec",
testonly = True,
srcs = ["test.spec.ts"],
tsconfig = ":tsconfig.json",
deps = [
"@ngdeps//@types/selenium-webdriver",
"@ngdeps//protractor",
],
)
ts_library(
@ -13,12 +17,18 @@ ts_library(
testonly = True,
srcs = ["conf.ts"],
tsconfig = ":tsconfig.json",
deps = ["//packages/bazel/src/protractor/utils"],
deps = [
"//packages/bazel/src/protractor/utils",
"@ngdeps//protractor",
],
)
protractor_web_test_suite(
name = "test",
configuration = ":ts_conf",
data = ["//packages/bazel/src/protractor/utils"],
deps = [":ts_spec"],
deps = [
":ts_spec",
"@ngdeps//protractor",
],
)

View File

@ -1,5 +1,6 @@
{
"compilerOptions": {
"lib": ["es2015"]
"lib": ["es2015"],
"types": ["jasmine"]
}
}

View File

@ -14,5 +14,6 @@ ts_library(
deps = [
"//packages:types",
"//packages/core",
"@ngdeps//@types/node",
],
)

View File

@ -1,7 +1,7 @@
package(default_visibility = ["//visibility:public"])
load("//tools:defaults.bzl", "npm_package")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_config", "ts_library")
load("//tools:defaults.bzl", "npm_package", "ts_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_config")
ts_config(
name = "tsconfig",
@ -21,7 +21,6 @@ ts_library(
],
),
module_name = "@angular/compiler-cli",
node_modules = "@angular_deps//:node_modules",
tsconfig = ":tsconfig",
deps = [
"//packages/compiler",
@ -32,6 +31,10 @@ ts_library(
"//packages/compiler-cli/src/ngtsc/switch",
"//packages/compiler-cli/src/ngtsc/transform",
"//packages/compiler-cli/src/ngtsc/typecheck",
"@ngdeps//@bazel/typescript",
"@ngdeps//@types",
"@ngdeps//tsickle",
"@ngdeps//typescript",
],
)

View File

@ -16,6 +16,7 @@ ng_module(
"//packages/platform-browser",
"//packages/platform-server",
"//packages/router",
"@ngdeps//reflect-metadata",
"@rxjs",
],
)

View File

@ -6,7 +6,11 @@ ng_module(
entry_point = "index.ts",
flat_module_out_file = "flat_module_filename",
module_name = "some_npm_module",
deps = ["//packages/core"],
node_modules = "@ngdeps//typescript:typescript__typings",
deps = [
"//packages/core",
"@ngdeps//@types",
],
)
load(":extract_flat_module_index.bzl", "extract_flat_module_index")

View File

@ -17,5 +17,14 @@ ts_library(
"//packages/compiler-cli/src/ngtsc/metadata",
"//packages/compiler-cli/src/ngtsc/transform",
"//packages/compiler-cli/src/ngtsc/translator",
"@ngdeps//@types/convert-source-map",
"@ngdeps//@types/node",
"@ngdeps//@types/shelljs",
"@ngdeps//@types/source-map",
"@ngdeps//@types/yargs",
"@ngdeps//dependency-graph",
"@ngdeps//magic-string",
"@ngdeps//source-map",
"@ngdeps//typescript",
],
)

View File

@ -13,6 +13,10 @@ ts_library(
"//packages/compiler-cli/src/ngtsc/host",
"//packages/compiler-cli/src/ngtsc/testing",
"//packages/compiler-cli/src/ngtsc/transform",
"@ngdeps//@types/convert-source-map",
"@ngdeps//@types/mock-fs",
"@ngdeps//magic-string",
"@ngdeps//typescript",
],
)
@ -22,5 +26,7 @@ jasmine_node_test(
deps = [
":test_lib",
"//tools/testing:node_no_angular",
"@ngdeps//canonical-path",
"@ngdeps//convert-source-map",
],
)

View File

@ -16,5 +16,7 @@ ts_library(
"//packages/compiler-cli/src/ngtsc/metadata",
"//packages/compiler-cli/src/ngtsc/transform",
"//packages/compiler-cli/src/ngtsc/typecheck",
"@ngdeps//@types/node",
"@ngdeps//typescript",
],
)

View File

@ -15,6 +15,7 @@ ts_library(
"//packages/compiler-cli/src/ngtsc/diagnostics",
"//packages/compiler-cli/src/ngtsc/metadata",
"//packages/compiler-cli/src/ngtsc/testing",
"@ngdeps//typescript",
],
)

View File

@ -11,5 +11,6 @@ ts_library(
module_name = "@angular/compiler-cli/src/ngtsc/diagnostics",
deps = [
"//packages/compiler",
"@ngdeps//typescript",
],
)

View File

@ -9,4 +9,5 @@ ts_library(
"src/**/*.ts",
]),
module_name = "@angular/compiler-cli/src/ngtsc/host",
deps = ["@ngdeps//typescript"],
)

View File

@ -14,5 +14,7 @@ ts_library(
"//packages/compiler",
"//packages/compiler-cli/src/ngtsc/host",
"//packages/compiler-cli/src/ngtsc/util",
"@ngdeps//@types/node",
"@ngdeps//typescript",
],
)

View File

@ -14,6 +14,7 @@ ts_library(
"//packages/compiler-cli/src/ngtsc/host",
"//packages/compiler-cli/src/ngtsc/metadata",
"//packages/compiler-cli/src/ngtsc/testing",
"@ngdeps//typescript",
],
)

View File

@ -14,5 +14,7 @@ ts_library(
"//packages/compiler-cli/src/ngtsc/host",
"//packages/compiler-cli/src/ngtsc/metadata",
"//packages/compiler-cli/src/ngtsc/util",
"@ngdeps//@types/node",
"@ngdeps//typescript",
],
)

View File

@ -10,5 +10,6 @@ ts_library(
]),
deps = [
"//packages:types",
"@ngdeps//typescript",
],
)

View File

@ -6,6 +6,8 @@
* found in the LICENSE file at https://angular.io/license
*/
///<reference types="jasmine"/>
import * as path from 'path';
import * as ts from 'typescript';

View File

@ -17,5 +17,6 @@ ts_library(
"//packages/compiler-cli/src/ngtsc/translator",
"//packages/compiler-cli/src/ngtsc/typecheck",
"//packages/compiler-cli/src/ngtsc/util",
"@ngdeps//typescript",
],
)

View File

@ -11,5 +11,7 @@ ts_library(
module_name = "@angular/compiler-cli/src/ngtsc/util",
deps = [
"//packages:types",
"@ngdeps//@types/node",
"@ngdeps//typescript",
],
)

View File

@ -12,6 +12,7 @@ ts_library(
"//packages:types",
"//packages/compiler-cli/src/ngtsc/testing",
"//packages/compiler-cli/src/ngtsc/util",
"@ngdeps//typescript",
],
)

View File

@ -17,6 +17,7 @@ ts_library(
"//packages:types",
"//packages/compiler",
"//packages/compiler-cli",
"@ngdeps//typescript",
],
)
@ -31,6 +32,7 @@ ts_library(
":test_utils",
"//packages/compiler",
"//packages/compiler-cli",
"@ngdeps//typescript",
],
)
@ -45,6 +47,7 @@ jasmine_node_test(
"//packages/common:npm_package",
"//packages/core",
"//tools/testing:node",
"@ngdeps//minimist",
],
)
@ -59,6 +62,7 @@ ts_library(
":test_utils",
"//packages/compiler",
"//packages/compiler-cli",
"@ngdeps//typescript",
],
)
@ -76,6 +80,8 @@ jasmine_node_test(
":ngc_lib",
"//packages/core",
"//tools/testing:node",
"@ngdeps//minimist",
"@ngdeps//tsickle",
],
)
@ -90,6 +96,7 @@ ts_library(
":test_utils",
"//packages/compiler",
"//packages/compiler-cli",
"@ngdeps//typescript",
],
)
@ -118,6 +125,7 @@ ts_library(
":test_utils",
"//packages/compiler",
"//packages/compiler-cli",
"@ngdeps//typescript",
],
)

View File

@ -11,6 +11,7 @@ ts_library(
"//packages/compiler",
"//packages/compiler-cli",
"//packages/compiler/test:test_utils",
"@ngdeps//typescript",
],
)

View File

@ -12,6 +12,7 @@ ts_library(
"//packages/compiler-cli",
"//packages/compiler-cli/test:test_utils",
"//packages/core",
"@ngdeps//typescript",
],
)
@ -24,6 +25,7 @@ ts_library(
":mocks",
"//packages/compiler-cli",
"//packages/compiler-cli/test:test_utils",
"@ngdeps//typescript",
],
)
@ -53,6 +55,7 @@ ts_library(
"//packages/compiler-cli",
"//packages/compiler-cli/test:test_utils",
"//packages/language-service",
"@ngdeps//typescript",
],
)
@ -83,6 +86,7 @@ ts_library(
"//packages/compiler-cli/test:test_utils",
"//packages/compiler/test:test_utils",
"//packages/language-service",
"@ngdeps//typescript",
],
)

View File

@ -10,6 +10,7 @@ ts_library(
"//packages/compiler-cli",
"//packages/compiler-cli/test:test_utils",
"//packages/core",
"@ngdeps//typescript",
],
)

View File

@ -10,6 +10,7 @@ ts_library(
deps = [
"//packages/compiler-cli/src/ngcc",
"//packages/compiler-cli/test:test_utils",
"@ngdeps//@types/mock-fs",
],
)
@ -23,5 +24,10 @@ jasmine_node_test(
deps = [
":ngcc_lib",
"//tools/testing:node_no_angular",
"@ngdeps//@types/mock-fs",
"@ngdeps//canonical-path",
"@ngdeps//convert-source-map",
"@ngdeps//shelljs",
"@ngdeps//yargs",
],
)

View File

@ -8,6 +8,7 @@ ts_library(
"//packages/compiler",
"//packages/compiler-cli",
"//packages/compiler-cli/test:test_utils",
"@ngdeps//typescript",
],
)
@ -20,5 +21,6 @@ jasmine_node_test(
deps = [
":ngtsc_lib",
"//tools/testing:node_no_angular",
"@ngdeps//minimist",
],
)

View File

@ -136,8 +136,7 @@ export function setupBazelTo(basePath: string) {
}
// Link typescript
const typescriptSource =
path.join(sources, 'angular/external/angular_deps/node_modules/typescript');
const typescriptSource = path.join(sources, 'angular/external/ngdeps/node_modules/typescript');
const typescriptDest = path.join(nodeModulesPath, 'typescript');
if (fs.existsSync(typescriptSource)) {
fs.symlinkSync(typescriptSource, typescriptDest);

View File

@ -12,6 +12,7 @@ ts_library(
"//packages/compiler/test:test_utils",
"//packages/core",
"//packages/platform-browser",
"@ngdeps//typescript",
],
)
@ -28,5 +29,6 @@ jasmine_node_test(
":test_lib",
"//packages/core",
"//tools/testing:node",
"@ngdeps//source-map",
],
)

View File

@ -22,6 +22,7 @@ ts_library(
"//packages:types",
"//packages/compiler",
"//packages/compiler-cli",
"@ngdeps//typescript",
],
)
@ -61,6 +62,7 @@ ts_library(
"//packages/compiler/test/expression_parser/utils",
"//packages/compiler/testing",
"//packages/core",
"@ngdeps//typescript",
],
)
@ -77,6 +79,8 @@ jasmine_node_test(
":test_node_only_lib",
"//packages/core",
"//tools/testing:node",
"@ngdeps//base64-js",
"@ngdeps//source-map",
],
)

View File

@ -15,5 +15,6 @@ ng_module(
"//packages:types",
"//packages/compiler",
"//packages/core",
"@ngdeps//@types/node",
],
)

View File

@ -14,6 +14,7 @@ ng_module(
deps = [
"//packages:types",
"//packages/compiler",
"@ngdeps//zone.js",
"@rxjs",
"@rxjs//operators",
],

View File

@ -29,6 +29,7 @@ ts_library(
"//packages/private/testing",
"//packages/router",
"//packages/router/testing",
"@ngdeps//zone.js",
"@rxjs",
"@rxjs//operators",
],
@ -67,6 +68,9 @@ jasmine_node_test(
"//packages/platform-server",
"//packages/platform-server/testing",
"//tools/testing:node",
"@ngdeps//base64-js",
"@ngdeps//source-map",
"@ngdeps//zone.js",
],
)

View File

@ -35,6 +35,9 @@ ng_rollup_bundle(
js_expected_symbol_test(
name = "symbol_test",
src = ":bundle.min_debug.js",
data = [
"@ngdeps//typescript",
],
golden = ":bundle.golden_symbols.json",
tags = [
"ivy-local",

View File

@ -59,6 +59,9 @@ jasmine_node_test(
js_expected_symbol_test(
name = "symbol_test",
src = ":bundle.min_debug.js",
data = [
"@ngdeps//typescript",
],
golden = ":bundle.golden_symbols.json",
tags = [
"ivy-local",

View File

@ -54,6 +54,9 @@ jasmine_node_test(
js_expected_symbol_test(
name = "symbol_test",
src = ":bundle.min_debug.js",
data = [
"@ngdeps//typescript",
],
golden = ":bundle.golden_symbols.json",
)

View File

@ -11,6 +11,7 @@ ts_library(
],
deps = [
"//packages/core",
"@ngdeps//typescript",
],
)
@ -49,5 +50,8 @@ jasmine_node_test(
js_expected_symbol_test(
name = "symbol_test",
src = ":bundle.min_debug.js",
data = [
"@ngdeps//typescript",
],
golden = ":bundle.golden_symbols.json",
)

View File

@ -31,6 +31,7 @@ ng_rollup_bundle(
"//packages/common",
"//packages/core",
"//packages/core/test/bundling/util:reflect_metadata",
"@ngdeps//reflect-metadata",
],
)
@ -65,6 +66,9 @@ jasmine_node_test(
js_expected_symbol_test(
name = "symbol_test",
src = ":bundle.min_debug.js",
data = [
"@ngdeps//typescript",
],
golden = ":bundle.golden_symbols.json",
tags = [
"ivy-local",
@ -75,7 +79,7 @@ js_expected_symbol_test(
genrule(
name = "tslib",
srcs = [
"@angular_deps//:node_modules/tslib/tslib.js",
"@ngdeps//node_modules/tslib:tslib.js",
],
outs = [
"tslib.js",

View File

@ -35,6 +35,7 @@ ng_rollup_bundle(
"//packages/core/test/bundling/util:reflect_metadata",
"//packages/platform-browser",
"//packages/platform-browser-dynamic",
"@ngdeps//reflect-metadata",
],
)
@ -71,6 +72,9 @@ jasmine_node_test(
js_expected_symbol_test(
name = "symbol_test",
src = ":bundle.min_debug.js",
data = [
"@ngdeps//typescript",
],
golden = ":bundle.golden_symbols.json",
tags = [
"ivy-local",
@ -81,7 +85,7 @@ js_expected_symbol_test(
genrule(
name = "tslib",
srcs = [
"@angular_deps//:node_modules/tslib/tslib.js",
"@ngdeps//node_modules/tslib:tslib.js",
],
outs = [
"tslib.js",

View File

@ -40,6 +40,7 @@ ts_library(
deps = [
"//packages/platform-browser",
"//packages/platform-server",
"@ngdeps//zone.js",
],
)
@ -60,6 +61,7 @@ jasmine_node_test(
],
deps = [
":render3_node_lib",
"@ngdeps//zone.js",
],
)

View File

@ -12,16 +12,6 @@ ts_library(
],
)
ts_library(
name = "ivy_node_lib",
testonly = 1,
srcs = [],
deps = [
":ivy_lib",
"//packages/core/test/render3:domino",
],
)
jasmine_node_test(
name = "ivy",
bootstrap = [
@ -31,6 +21,7 @@ jasmine_node_test(
"ivy-jit",
],
deps = [
":ivy_node_lib",
":ivy_lib",
"//packages/core/test/render3:domino",
],
)

View File

@ -13,5 +13,7 @@ ng_module(
deps = [
"//packages:types",
"//packages/core",
"@ngdeps//@types/jasmine",
"@ngdeps//zone.js",
],
)

View File

@ -13,6 +13,7 @@ ts_library(
deps = [
"//packages/common",
"//packages/core",
"@ngdeps//@angular-devkit/schematics",
"@rxjs",
],
)
@ -29,6 +30,7 @@ ts_library(
":ng-add",
"//packages/common",
"//packages/core",
"@ngdeps//@angular-devkit/schematics",
"@rxjs",
"@rxjs//operators",
],
@ -39,5 +41,6 @@ jasmine_node_test(
deps = [
":test_lib",
"//packages/elements/schematics:collection",
"@ngdeps//@schematics/angular",
],
)

View File

@ -1,5 +1,4 @@
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_web_test_suite")
load("//tools:defaults.bzl", "jasmine_node_test", "ts_library", "ts_web_test_suite")
ts_library(
name = "test_lib",
@ -23,10 +22,10 @@ filegroup(
name = "elements_test_bootstrap_scripts",
# do not sort
srcs = [
"@angular_deps//:node_modules/@webcomponents/custom-elements/src/native-shim.js",
"@angular_deps//:node_modules/reflect-metadata/Reflect.js",
"@angular_deps//:node_modules/zone.js/dist/zone.js",
"@angular_deps//:node_modules/zone.js/dist/zone-testing.js",
"@ngdeps//node_modules/@webcomponents/custom-elements:src/native-shim.js",
"@ngdeps//node_modules/reflect-metadata:Reflect.js",
"@ngdeps//node_modules/zone.js:dist/zone.js",
"@ngdeps//node_modules/zone.js:dist/zone-testing.js",
],
)
@ -37,8 +36,6 @@ ts_web_test_suite(
],
# do not sort
deps = [
"@angular_deps//:node_modules/tslib/tslib.js",
"//tools/testing:browser",
":test_lib",
],
)

View File

@ -28,5 +28,6 @@ ts_web_test_suite(
name = "test_web",
deps = [
":test_lib",
"@ngdeps//karma",
],
)

View File

@ -16,6 +16,8 @@ ts_library(
"//packages/compiler",
"//packages/compiler-cli",
"//packages/core",
"@ngdeps//@types/node",
"@ngdeps//typescript",
],
)

View File

@ -9,7 +9,9 @@ ls_rollup_bundle(
"fs": "fs",
},
license_banner = "banner.js.txt",
node_modules = "//:node_modules",
visibility = ["//packages/language-service:__pkg__"],
deps = ["//packages/language-service"],
deps = [
"//packages/language-service",
"@ngdeps//tslib",
],
)

View File

@ -12,7 +12,7 @@ without having to provide all of the angular specific peer dependencies.
load(
"@build_bazel_rules_nodejs//internal/rollup:rollup_bundle.bzl",
"ROLLUP_ATTRS",
"rollup_module_mappings_aspect",
"ROLLUP_DEPS_ASPECTS",
"run_rollup",
"run_uglify",
"write_rollup_config",
@ -28,6 +28,11 @@ _ROLLUP_OUTPUTS = {
"build_umd_min": "%{name}.umd.min.js",
}
DEPS_ASPECTS = [esm5_outputs_aspect]
# Workaround skydoc bug which assumes ROLLUP_DEPS_ASPECTS is a str type
[DEPS_ASPECTS.append(a) for a in ROLLUP_DEPS_ASPECTS]
def _ls_rollup_bundle(ctx):
esm5_sources = flatten_esm5(ctx)
rollup_config = write_rollup_config(
@ -42,10 +47,11 @@ def _ls_rollup_bundle(ctx):
ls_rollup_bundle = rule(
implementation = _ls_rollup_bundle,
attrs = dict(ROLLUP_ATTRS, **{
"deps": attr.label_list(aspects = [
rollup_module_mappings_aspect,
esm5_outputs_aspect,
]),
"deps": attr.label_list(
doc = """Other targets that provide JavaScript files.
Typically this will be `ts_library` or `ng_module` targets.""",
aspects = DEPS_ASPECTS,
),
}),
outputs = _ROLLUP_OUTPUTS,
)

View File

@ -9,6 +9,7 @@ ts_library(
"//packages/compiler",
"//packages/compiler-cli/test:test_utils",
"//packages/language-service",
"@ngdeps//typescript",
],
)

View File

@ -15,6 +15,8 @@ ng_module(
"//packages:types",
"//packages/common",
"//packages/core",
"@ngdeps//@types/hammerjs",
"@ngdeps//zone.js",
],
)

View File

@ -12,6 +12,7 @@ ng_module(
"//packages/core",
"//packages/core/testing",
"//packages/platform-browser",
"@ngdeps//@types/jasmine",
"@rxjs",
],
)

View File

@ -21,6 +21,8 @@ ng_module(
"//packages/platform-browser",
"//packages/platform-browser-dynamic",
"//packages/platform-browser/animations",
"@ngdeps//@types/node",
"@ngdeps//zone.js",
"@rxjs",
],
)

View File

@ -12,6 +12,7 @@ ts_library(
tsconfig = ":tsconfig.json",
deps = [
"//packages/service-worker/config",
"@ngdeps//@types/node",
],
)

View File

@ -17,7 +17,10 @@
"inlineSourceMap": true,
"lib": ["es2015"],
"target": "es5",
"typeRoots": []
"typeRoots": [],
"types": [
"node"
]
},
"files": [
"main.ts",

View File

@ -1,7 +1,6 @@
package(default_visibility = ["//visibility:public"])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
load("//tools:defaults.bzl", "ng_rollup_bundle")
load("//tools:defaults.bzl", "ng_rollup_bundle", "ts_library")
ts_library(
name = "worker",
@ -13,6 +12,7 @@ ts_library(
exclude = ["main.ts"],
),
tsconfig = ":tsconfig.json",
deps = ["@ngdeps//@types/node"],
)
ts_library(

View File

@ -14,7 +14,8 @@
"inlineSourceMap": true,
"lib": ["es2015", "dom"],
"target": "es2017",
"typeRoots": []
"typeRoots": [],
"types": []
},
"bazelOptions": {
"suppressTsconfigOverrideWarnings": true

View File

@ -16,6 +16,7 @@ ng_module(
"//packages/core",
"//packages/platform-browser",
"//packages/platform-browser-dynamic",
"@ngdeps//zone.js",
],
)

View File

@ -74,7 +74,7 @@ export function createWithEachNg1VersionFn(setNg1: typeof setAngularJSGlobal) {
document.body.removeChild(script);
resolve();
};
script.src = `base/angular_deps/node_modules/${file}`;
script.src = `base/ngdeps/node_modules/${file}`;
document.body.appendChild(script);
})),
Promise.resolve())

View File

@ -1,5 +1,15 @@
package(default_visibility = ["//visibility:public"])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_config")
exports_files(["tsconfig.json"])
ts_config(
name = "tsconfig-test",
src = "tsconfig-test.json",
deps = ["tsconfig.json"],
)
# The toolchain container used for execution is defined in the target indicated
# by "extra_execution_platforms", "host_platform" and "platforms".
# If you are using your own toolchain container, you need to create a platform
@ -28,5 +38,4 @@ platform(
value: "SYS_ADMIN"
}
""",
visibility = ["//visibility:public"],
)

View File

@ -8,7 +8,9 @@ load("//packages/bazel/src:ng_rollup_bundle.bzl", _ng_rollup_bundle = "ng_rollup
DEFAULT_TSCONFIG_BUILD = "//packages:tsconfig-build.json"
DEFAULT_TSCONFIG_TEST = "//packages:tsconfig-test.json"
DEFAULT_NODE_MODULES = "@angular_deps//:node_modules"
DEFAULT_COMPILER_BIN = "//:@bazel/typescript/tsc_wrapped"
DEFAULT_TS_TYPINGS = "@ngdeps//typescript:typescript__typings"
DEFAULT_KARMA_BIN = "//:@bazel/karma/karma"
# Packages which are versioned together on npm
ANGULAR_SCOPED_PACKAGES = ["@angular/%s" % p for p in [
@ -41,15 +43,34 @@ PKG_GROUP_REPLACEMENTS = {
]""" % ",\n ".join(["\"%s\"" % s for s in ANGULAR_SCOPED_PACKAGES]),
}
def ts_library(tsconfig = None, node_modules = DEFAULT_NODE_MODULES, testonly = False, **kwargs):
def ts_library(tsconfig = None, testonly = False, deps = [], **kwargs):
"""Default values for ts_library"""
deps = deps + ["@ngdeps//tslib"]
if testonly:
# Match the types[] in //packages:tsconfig-test.json
deps.append("@ngdeps//@types/jasmine")
deps.append("@ngdeps//@types/node")
if not tsconfig:
if testonly:
tsconfig = DEFAULT_TSCONFIG_TEST
else:
tsconfig = DEFAULT_TSCONFIG_BUILD
_ts_library(tsconfig = tsconfig, node_modules = node_modules, testonly = testonly, **kwargs)
_ts_library(
tsconfig = tsconfig,
testonly = testonly,
deps = deps,
compiler = DEFAULT_COMPILER_BIN,
node_modules = DEFAULT_TS_TYPINGS,
**kwargs
)
def ng_module(name, tsconfig = None, entry_point = None, node_modules = DEFAULT_NODE_MODULES, testonly = False, **kwargs):
def ng_module(name, tsconfig = None, entry_point = None, testonly = False, deps = [], **kwargs):
"""Default values for ng_module"""
deps = deps + ["@ngdeps//tslib"]
if testonly:
# Match the types[] in //packages:tsconfig-test.json
deps.append("@ngdeps//@types/jasmine")
deps.append("@ngdeps//@types/node")
if not tsconfig:
if testonly:
tsconfig = DEFAULT_TSCONFIG_TEST
@ -57,12 +78,27 @@ def ng_module(name, tsconfig = None, entry_point = None, node_modules = DEFAULT_
tsconfig = DEFAULT_TSCONFIG_BUILD
if not entry_point:
entry_point = "public_api.ts"
_ng_module(name = name, flat_module_out_file = name, tsconfig = tsconfig, entry_point = entry_point, node_modules = node_modules, testonly = testonly, **kwargs)
_ng_module(
name = name,
flat_module_out_file = name,
tsconfig = tsconfig,
entry_point = entry_point,
testonly = testonly,
deps = deps,
node_modules = DEFAULT_TS_TYPINGS,
**kwargs
)
# ivy_ng_module behaves like ng_module, and under --define=compile=legacy it runs ngc with global
# analysis but produces Ivy outputs. Under other compile modes, it behaves as ng_module.
# TODO(alxhub): remove when ngtsc supports the same use cases.
def ivy_ng_module(name, tsconfig = None, entry_point = None, testonly = False, **kwargs):
def ivy_ng_module(name, tsconfig = None, entry_point = None, testonly = False, deps = [], **kwargs):
"""Default values for ivy_ng_module"""
deps = deps + ["@ngdeps//tslib"]
if testonly:
# Match the types[] in //packages:tsconfig-test.json
deps.append("@ngdeps//@types/jasmine")
deps.append("@ngdeps//@types/node")
if not tsconfig:
if testonly:
tsconfig = DEFAULT_TSCONFIG_TEST
@ -70,24 +106,38 @@ def ivy_ng_module(name, tsconfig = None, entry_point = None, testonly = False, *
tsconfig = DEFAULT_TSCONFIG_BUILD
if not entry_point:
entry_point = "public_api.ts"
_internal_global_ng_module(name = name, flat_module_out_file = name, tsconfig = tsconfig, entry_point = entry_point, testonly = testonly, **kwargs)
_internal_global_ng_module(
name = name,
flat_module_out_file = name,
tsconfig = tsconfig,
entry_point = entry_point,
testonly = testonly,
deps = deps,
node_modules = DEFAULT_TS_TYPINGS,
**kwargs
)
def ng_package(name, node_modules = DEFAULT_NODE_MODULES, readme_md = None, license_banner = None, **kwargs):
def ng_package(name, readme_md = None, license_banner = None, deps = [], **kwargs):
"""Default values for ng_package"""
if not readme_md:
readme_md = "//packages:README.md"
if not license_banner:
license_banner = "//packages:license-banner.txt"
deps = deps + [
"@ngdeps//tslib",
]
_ng_package(
name = name,
deps = deps,
readme_md = readme_md,
license_banner = license_banner,
replacements = PKG_GROUP_REPLACEMENTS,
node_modules = node_modules,
**kwargs
)
def npm_package(name, replacements = {}, **kwargs):
"""Default values for npm_package"""
_npm_package(
name = name,
replacements = dict(replacements, **PKG_GROUP_REPLACEMENTS),
@ -95,10 +145,11 @@ def npm_package(name, replacements = {}, **kwargs):
)
def ts_web_test_suite(bootstrap = [], deps = [], **kwargs):
"""Default values for ts_web_test_suite"""
if not bootstrap:
bootstrap = ["//:web_test_bootstrap_scripts"]
local_deps = [
"@angular_deps//:node_modules/tslib/tslib.js",
"@ngdeps//node_modules/tslib:tslib.js",
"//tools/testing:browser",
] + deps
@ -116,14 +167,44 @@ def ts_web_test_suite(bootstrap = [], deps = [], **kwargs):
# "@io_bazel_rules_webtesting//browsers:firefox-local",
# TODO(alexeagle): add remote browsers on SauceLabs
],
karma = DEFAULT_KARMA_BIN,
**kwargs
)
def nodejs_binary(node_modules = DEFAULT_NODE_MODULES, **kwargs):
_nodejs_binary(node_modules = node_modules, **kwargs)
def nodejs_binary(**kwargs):
"""Default values for nodejs_binary"""
_nodejs_binary(
# Pass-thru --define=compile=foo as an environment variable
configuration_env_vars = ["compile"],
**kwargs
)
def jasmine_node_test(node_modules = DEFAULT_NODE_MODULES, **kwargs):
_jasmine_node_test(node_modules = node_modules, **kwargs)
def jasmine_node_test(deps = [], **kwargs):
"""Default values for jasmine_node_test"""
deps = deps + [
# Very common dependencies for tests
"@ngdeps//chokidar",
"@ngdeps//domino",
"@ngdeps//jasmine",
"@ngdeps//jasmine-core",
"@ngdeps//mock-fs",
"@ngdeps//reflect-metadata",
"@ngdeps//tslib",
"@ngdeps//xhr2",
]
_jasmine_node_test(
deps = deps,
# Pass-thru --define=compile=foo as an environment variable
configuration_env_vars = ["compile"],
**kwargs
)
def ng_rollup_bundle(node_modules = DEFAULT_NODE_MODULES, **kwargs):
_ng_rollup_bundle(node_modules = node_modules, **kwargs)
def ng_rollup_bundle(deps = [], **kwargs):
"""Default values for ng_rollup_bundle"""
deps = deps + [
"@ngdeps//tslib",
]
_ng_rollup_bundle(
deps = deps,
**kwargs
)

View File

@ -15,259 +15,10 @@ def ng_setup_workspace():
to build angular
"""
yarn_install(
name = "angular_deps",
name = "ngdeps",
package_json = "@angular//:package.json",
yarn_lock = "@angular//:yarn.lock",
data = ["@angular//:tools/yarn/check-yarn.js", "@angular//:tools/postinstall-patches.js"],
manual_build_file_contents = """package(default_visibility = ["//visibility:public"])
filegroup(
name = "node_modules",
srcs = glob(["/".join([
"node_modules",
pkg,
"**",
ext,
]) for pkg in [
"adm-zip",
"ajv",
"angular",
"angular-1.5",
"angular-1.6",
"angular-mocks",
"angular-mocks-1.5",
"angular-mocks-1.6",
"anymatch",
"arr-diff",
"arr-flatten",
"arr-union",
"array-unique",
"asn1",
"assert-plus",
"assign-symbols",
"async-each",
"asynckit",
"atob",
"aws-sign2",
"aws4",
"balanced-match",
"base",
"base64-js",
"binary-extensions",
"blocking-proxy",
"brace-expansion",
"braces",
"bytebuffer",
"cache-base",
"camelcase",
"canonical-path",
"caseless",
"chokidar",
"class-utils",
"co",
"collection-visit",
"convert-source-map",
"combined-stream",
"component-emitter",
"concat-map",
"copy-descriptor",
"core-util-is",
"debug",
"decamelize",
"decode-uri-component",
"define-property",
"delayed-stream",
"dependency-graph",
"domino",
"error-ex",
"expand-brackets",
"expand-range",
"extend",
"extend-shallow",
"extglob",
"extsprintf",
"fast-deep-equal",
"fast-json-stable-stringify",
"filename-regex",
"fill-range",
"find-up",
"for-in",
"for-own",
"forever-agent",
"form-data",
"fragment-cache",
"fs.realpath",
"fs-extra",
"get-caller-file",
"get-value",
"glob",
"glob-base",
"glob-parent",
"graceful-fs",
"hammerjs",
"har-schema",
"har-validator",
"has-value",
"has-values",
"http-signature",
"https-proxy-agent",
"inflight",
"inherits",
"is-arrayish",
"is-accessor-descriptor",
"is-binary-path",
"is-buffer",
"is-data-descriptor",
"is-descriptor",
"is-dotfile",
"is-equal-shallow",
"is-extendable",
"is-extglob",
"is-glob",
"is-number",
"is-plain-object",
"is-posix-bracket",
"is-primitive",
"is-typedarray",
"is-windows",
"isarray",
"isobject",
"isstream",
"jasmine",
"jasmine-core",
"jasminewd2",
"json-schema",
"json-schema-traverse",
"json-stable-stringify",
"json-stringify-safe",
"jsprim",
"kind-of",
"locate-path",
"long",
"lru-cache",
"magic-string",
"map-cache",
"map-visit",
"math-random",
"micromatch",
"mime-db",
"mime-types",
"minimatch",
"minimist",
"mixin-deep",
"mock-fs",
"node-uuid",
"nanomatch",
"normalize-path",
"oauth-sign",
"object.omit",
"object.pick",
"object-copy",
"object-visit",
"once",
"optimist",
"options",
"os-locale",
"os-tmpdir",
"p-limit",
"p-locate",
"p-try",
"parse-glob",
"parse-json",
"pascalcase",
"path-dirname",
"path-exists",
"path-is-absolute",
"performance-now",
"pify",
"posix-character-classes",
"preserve",
"process-nextick-args",
"protobufjs",
"protractor",
"qs",
"randomatic",
"read-pkg-up",
"readable-stream",
"readdirp",
"reflect-metadata",
"regex-cache",
"regex-not",
"remove-trailing-separator",
"repeat-element",
"repeat-string",
"request",
"require-directory",
"require-main-filename",
"ret",
"rimraf",
"safe-buffer",
"safe-regex",
"safer-buffer",
"sax",
"selenium-webdriver",
"semver",
"set-blocking",
"set-immediate-shim",
"set-value",
"shelljs",
"sigmund",
"snapdragon",
"snapdragon-node",
"snapdragon-util",
"source-map",
"source-map-resolve",
"source-map-support",
"source-map-url",
"sourcemap-codec",
"split-string",
"sshpk",
"static-extend",
"stringstream",
"strip-bom",
"tmp",
"to-object-path",
"to-regex",
"to-regex-range",
"tough-cookie",
"tsickle",
"tslib",
"tsutils",
"tunnel-agent",
"typescript",
"union-value",
"universalify",
"unset-value",
"upath",
"uri-js",
"urix",
"use",
"util-deprecate",
"uuid",
"verror",
"webdriver-js-extender",
"webdriver-manager",
"wordwrap",
"wrappy",
"xhr2",
"xml2js",
"xmlbuilder",
"y18n",
"yargs",
"yargs-parser",
"zone.js",
"@angular-devkit/core",
"@angular-devkit/schematics",
"@types",
"@webcomponents/custom-elements",
] for ext in [
"*.js",
"*.json",
"*.d.ts",
]] + [
"node_modules/protractor/**",
"node_modules/@schematics/angular/**",
]))
""",
)
yarn_install(

11
tools/npm/package.json Normal file
View File

@ -0,0 +1,11 @@
{
"description": "minimal @npm repo",
"dependencies": {
"@bazel/karma": "0.19.1",
"@bazel/typescript": "0.19.1",
"typescript": "~3.1.1"
},
"scripts": {
"//": "TODO(gmagolan): figure out how to keep dependencies here up to date with the root package.json"
}
}

3186
tools/npm/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@ -14,6 +14,7 @@ ts_library(
),
deps = [
"//packages:types",
"@ngdeps//typescript",
],
)
@ -27,6 +28,7 @@ ts_library(
deps = [
":lib",
"//packages:types",
"@ngdeps//typescript",
],
)

View File

@ -10,12 +10,10 @@
# because it introduces an extra target_bin target.
load("@build_bazel_rules_nodejs//internal/node:node.bzl", "nodejs_binary", "nodejs_test")
DEFAULT_NODE_MODULES = "@angular_deps//:node_modules"
def js_expected_symbol_test(name, src, golden, node_modules = DEFAULT_NODE_MODULES, **kwargs):
def js_expected_symbol_test(name, src, golden, data = [], **kwargs):
"""This test verifies that a set of top level symbols from a javascript file match a gold file.
"""
all_data = [src, golden]
all_data = data + [src, golden]
all_data += [Label("//tools/symbol-extractor:lib")]
all_data += [Label("@bazel_tools//tools/bash/runfiles")]
entry_point = "angular/tools/symbol-extractor/cli.js"
@ -25,7 +23,6 @@ def js_expected_symbol_test(name, src, golden, node_modules = DEFAULT_NODE_MODUL
data = all_data,
entry_point = entry_point,
templated_args = ["$(location %s)" % src, "$(location %s)" % golden],
node_modules = node_modules,
**kwargs
)
@ -35,6 +32,5 @@ def js_expected_symbol_test(name, src, golden, node_modules = DEFAULT_NODE_MODUL
data = all_data,
entry_point = entry_point,
templated_args = ["$(location %s)" % src, "$(location %s)" % golden, "--accept"],
node_modules = node_modules,
**kwargs
)

View File

@ -28,5 +28,7 @@ ts_library(
name = "node_no_angular",
testonly = 1,
srcs = ["init_node_no_angular_spec.ts"],
deps = ["//packages:types"],
deps = [
"//packages:types",
],
)

Some files were not shown because too many files have changed in this diff Show More