mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-16 10:33:43 +08:00
With this change we "vendor" TypeScript 3.6 in build optimizer instead of using directly the npm package. Reasons: - We cannot update to a more recent version of TypeScript due to https://github.com/microsoft/TypeScript/issues/38412 - Yarn workspace are not supported under Bazel. This means currently we are running unit testswhich uses a different TypeScript version at runtime. - In TypeScript 3.9, the shape of ES2015 classes changed https://github.com/microsoft/TypeScript/pull/32011, this requires some changes in the UT expects, but this again will not be correct to change now.
89 lines
2.2 KiB
Python
89 lines
2.2 KiB
Python
# Copyright Google Inc. All Rights Reserved.
|
|
#
|
|
# Use of this source code is governed by an MIT-style license that can be
|
|
# found in the LICENSE file at https://angular.io/license
|
|
|
|
load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
|
|
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
|
|
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm")
|
|
load("//tools:defaults.bzl", "ts_library")
|
|
|
|
licenses(["notice"]) # MIT
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
ts_library(
|
|
name = "build_optimizer",
|
|
srcs = glob(
|
|
include = ["src/**/*.ts"],
|
|
exclude = [
|
|
# TODO(@filipesilva): shouldn't need to exclude the cli files but can't exclude them
|
|
# from jasmine_node_test.
|
|
"src/**/cli.ts",
|
|
"src/**/*_spec.ts",
|
|
"src/**/*_benchmark.ts",
|
|
],
|
|
),
|
|
data = [
|
|
"package.json",
|
|
"webpack-loader/package.json",
|
|
],
|
|
module_name = "@angular-devkit/build-optimizer",
|
|
module_root = "src/index.d.ts",
|
|
deps = [
|
|
"//packages/angular_devkit/build_optimizer/third_party/github.com/Microsoft/TypeScript",
|
|
"@npm//@types/node",
|
|
"@npm//@types/webpack",
|
|
"@npm//@types/webpack-sources",
|
|
"@npm//source-map",
|
|
"@npm//tslib",
|
|
],
|
|
)
|
|
|
|
ts_library(
|
|
name = "build_optimizer_test_lib",
|
|
testonly = True,
|
|
srcs = glob(["src/**/*_spec.ts"]),
|
|
# @external_begin
|
|
deps = [
|
|
":build_optimizer",
|
|
"//packages/angular_devkit/build_optimizer/third_party/github.com/Microsoft/TypeScript",
|
|
"//packages/angular_devkit/core",
|
|
"@npm//source-map",
|
|
],
|
|
# @external_end
|
|
)
|
|
|
|
jasmine_node_test(
|
|
name = "build_optimizer_test",
|
|
srcs = [":build_optimizer_test_lib"],
|
|
deps = [
|
|
"@npm//jasmine",
|
|
"@npm//source-map",
|
|
],
|
|
)
|
|
|
|
jasmine_node_test(
|
|
name = "no_typescript_runtime_dep_test",
|
|
srcs = ["no_typescript_runtime_dep_spec.js"],
|
|
deps = [
|
|
":build_optimizer",
|
|
"@npm//jasmine",
|
|
],
|
|
)
|
|
|
|
pkg_npm(
|
|
name = "npm_package",
|
|
deps = [
|
|
":build_optimizer",
|
|
],
|
|
)
|
|
|
|
pkg_tar(
|
|
name = "npm_package_archive",
|
|
srcs = [":npm_package"],
|
|
extension = "tar.gz",
|
|
strip_prefix = "./npm_package",
|
|
tags = ["manual"],
|
|
)
|