build: update to rules_typescript 0.25.1 (#28625)
Updated a spot in the compiler which assumed es5 downlevelling get ready for es2015 devmode in the future. PR Close #28625
This commit is contained in:
@ -5,7 +5,7 @@ exports_files([
|
||||
"tsconfig.json",
|
||||
])
|
||||
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_config")
|
||||
load("@npm_bazel_typescript//:defs.bzl", "ts_config")
|
||||
load("//tools:defaults.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
|
@ -1,12 +1,5 @@
|
||||
load("//tools:defaults.bzl", "npm_package")
|
||||
|
||||
genrule(
|
||||
name = "copy_browser_repositories",
|
||||
srcs = ["//:browser_repositories.bzl"],
|
||||
outs = ["browser_repositories.bzl"],
|
||||
cmd = "cp $< $@",
|
||||
)
|
||||
|
||||
npm_package(
|
||||
name = "npm_package",
|
||||
srcs = glob(
|
||||
@ -37,7 +30,6 @@ npm_package(
|
||||
# Dependencies on the full npm_package cause long re-builds.
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
":copy_browser_repositories",
|
||||
"//packages/bazel/src/api-extractor:lib",
|
||||
"//packages/bazel/src/builders",
|
||||
"//packages/bazel/src/ng_package:lib",
|
||||
|
@ -21,7 +21,7 @@
|
||||
"@angular-devkit/architect": "^0.10.6",
|
||||
"@angular-devkit/core": "^7.0.4",
|
||||
"@angular-devkit/schematics": "^7.3.0-rc.0",
|
||||
"@bazel/typescript": "^0.23.2",
|
||||
"@bazel/typescript": "^0.25.1",
|
||||
"@microsoft/api-extractor": "^7.0.17",
|
||||
"@schematics/angular": "^7.0.4",
|
||||
"@types/node": "6.0.84",
|
||||
|
@ -157,7 +157,7 @@ esm5_outputs_aspect = aspect(
|
||||
cfg = "host",
|
||||
),
|
||||
"_tsc_wrapped": attr.label(
|
||||
default = Label("@build_bazel_rules_typescript//:@bazel/typescript/tsc_wrapped"),
|
||||
default = Label("@npm//@bazel/typescript/bin:tsc_wrapped"),
|
||||
executable = True,
|
||||
cfg = "host",
|
||||
),
|
||||
|
@ -2,11 +2,11 @@
|
||||
"""
|
||||
|
||||
load(
|
||||
"@build_bazel_rules_typescript//internal:build_defs.bzl",
|
||||
"@npm_bazel_typescript//internal:build_defs.bzl",
|
||||
_tsc_wrapped_tsconfig = "tsc_wrapped_tsconfig",
|
||||
)
|
||||
load(
|
||||
"@build_bazel_rules_typescript//internal:common/compilation.bzl",
|
||||
"@npm_bazel_typescript//internal:common/compilation.bzl",
|
||||
_COMMON_ATTRIBUTES = "COMMON_ATTRIBUTES",
|
||||
_COMMON_OUTPUTS = "COMMON_OUTPUTS",
|
||||
_DEPS_ASPECTS = "DEPS_ASPECTS",
|
||||
|
@ -3,7 +3,7 @@ package(default_visibility = ["//visibility:public"])
|
||||
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary")
|
||||
|
||||
# BEGIN-DEV-ONLY
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
|
||||
load("@npm_bazel_typescript//:defs.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "lib",
|
||||
|
@ -1,5 +1,5 @@
|
||||
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
|
||||
load("@npm_bazel_typescript//:defs.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "ngc_lib",
|
||||
|
@ -1,6 +1,6 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
|
||||
load("@npm_bazel_typescript//:defs.bzl", "ts_library")
|
||||
|
||||
ts_library(
|
||||
name = "utils",
|
||||
|
@ -46,7 +46,7 @@ yarn_install(
|
||||
load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
|
||||
install_bazel_dependencies()
|
||||
|
||||
load("@build_bazel_rules_karma//:package.bzl", "rules_karma_dependencies")
|
||||
load("@npm_bazel_karma//:package.bzl", "rules_karma_dependencies")
|
||||
rules_karma_dependencies()
|
||||
|
||||
load("@io_bazel_rules_webtesting//web:repositories.bzl", "browser_repositories", "web_test_repositories")
|
||||
@ -56,7 +56,7 @@ browser_repositories(
|
||||
firefox = True,
|
||||
)
|
||||
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace")
|
||||
load("@npm_bazel_typescript//:defs.bzl", "ts_setup_workspace")
|
||||
ts_setup_workspace()
|
||||
<% if (sass) { %>
|
||||
load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")
|
||||
|
@ -1,4 +1,4 @@
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
|
||||
load("@npm_bazel_typescript//:defs.bzl", "ts_library")
|
||||
load("@npm_angular_bazel//:index.bzl", "protractor_web_test_suite")
|
||||
|
||||
ts_library(
|
||||
|
@ -1,10 +1,10 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("@npm_angular_bazel//:index.bzl", "ng_module")
|
||||
load("@build_bazel_rules_karma//:defs.bzl", "ts_web_test_suite")
|
||||
load("@npm_bazel_karma//:defs.bzl", "ts_web_test_suite")
|
||||
load("@build_bazel_rules_nodejs//:defs.bzl", "rollup_bundle", "history_server")
|
||||
load("@build_bazel_rules_nodejs//internal/web_package:web_package.bzl", "web_package")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver", "ts_library")
|
||||
load("@npm_bazel_typescript//:defs.bzl", "ts_devserver", "ts_library")
|
||||
<% if (sass) { %>load("@io_bazel_rules_sass//:defs.bzl", "multi_sass_binary")
|
||||
|
||||
multi_sass_binary(
|
||||
|
@ -46,8 +46,8 @@ function addDevDependenciesToPackageJson(options: Schema) {
|
||||
'@angular/upgrade': angularCoreVersion,
|
||||
'@bazel/bazel': '^0.22.1',
|
||||
'@bazel/ibazel': '^0.9.0',
|
||||
'@bazel/karma': '^0.23.2',
|
||||
'@bazel/typescript': '^0.23.2',
|
||||
'@bazel/karma': '^0.25.1',
|
||||
'@bazel/typescript': '^0.25.1',
|
||||
};
|
||||
|
||||
const recorder = host.beginUpdate(packageJson);
|
||||
|
@ -32,7 +32,7 @@ jasmine_node_test(
|
||||
"//packages/bazel/test/ngc-wrapped/empty:empty_tsconfig.json",
|
||||
"//packages/bazel/test/ngc-wrapped/empty:tsconfig.json",
|
||||
"//packages/private/testing",
|
||||
"@build_bazel_rules_typescript//third_party/github.com/bazelbuild/bazel/src/main/protobuf:worker_protocol.proto",
|
||||
"@npm_bazel_typescript//third_party/github.com/bazelbuild/bazel/src/main/protobuf:worker_protocol.proto",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
load("//packages/bazel:index.bzl", "protractor_web_test_suite")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
|
||||
load("@npm_bazel_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")
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "npm_package", "ts_library")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_config")
|
||||
load("@npm_bazel_typescript//:defs.bzl", "ts_config")
|
||||
|
||||
ts_config(
|
||||
name = "tsconfig",
|
||||
|
@ -283,16 +283,20 @@ export interface MetadataFactory<T> {
|
||||
}
|
||||
|
||||
function makeMetadataFactory<T>(name: string, props?: (...args: any[]) => T): MetadataFactory<T> {
|
||||
const factory: any = (...args: any[]) => {
|
||||
// This must be declared as a function, not a fat arrow, so that ES2015 devmode produces code
|
||||
// that works with the static_reflector.ts in the ViewEngine compiler.
|
||||
// In particular, `_registerDecoratorOrConstructor` assumes that the value returned here can be
|
||||
// new'ed.
|
||||
function factory(...args: any[]) {
|
||||
const values = props ? props(...args) : {};
|
||||
return {
|
||||
ngMetadataName: name,
|
||||
...values,
|
||||
};
|
||||
};
|
||||
factory.isTypeOf = (obj: any) => obj && obj.ngMetadataName === name;
|
||||
factory.ngMetadataName = name;
|
||||
return factory;
|
||||
}
|
||||
(factory as any).isTypeOf = (obj: any) => obj && obj.ngMetadataName === name;
|
||||
(factory as any).ngMetadataName = name;
|
||||
return factory as any;
|
||||
}
|
||||
|
||||
export interface Route {
|
||||
|
@ -811,6 +811,9 @@ function readUpdateOpCodes(
|
||||
value += renderStringify(viewData[bindingsStartIndex - opCode]);
|
||||
} else {
|
||||
const nodeIndex = opCode >>> I18nUpdateOpCode.SHIFT_REF;
|
||||
let tIcuIndex: number;
|
||||
let tIcu: TIcu;
|
||||
let icuTNode: TIcuContainerNode;
|
||||
switch (opCode & I18nUpdateOpCode.MASK_OPCODE) {
|
||||
case I18nUpdateOpCode.Attr:
|
||||
const attrName = updateOpCodes[++j] as string;
|
||||
@ -821,9 +824,9 @@ function readUpdateOpCodes(
|
||||
textBinding(nodeIndex, value);
|
||||
break;
|
||||
case I18nUpdateOpCode.IcuSwitch:
|
||||
let tIcuIndex = updateOpCodes[++j] as number;
|
||||
let tIcu = icus ![tIcuIndex];
|
||||
let icuTNode = getTNode(nodeIndex, viewData) as TIcuContainerNode;
|
||||
tIcuIndex = updateOpCodes[++j] as number;
|
||||
tIcu = icus ![tIcuIndex];
|
||||
icuTNode = getTNode(nodeIndex, viewData) as TIcuContainerNode;
|
||||
// If there is an active case, delete the old nodes
|
||||
if (icuTNode.activeCaseIndex !== null) {
|
||||
const removeCodes = tIcu.remove[icuTNode.activeCaseIndex];
|
||||
|
@ -3,7 +3,7 @@ package(default_visibility = ["//visibility:public"])
|
||||
load("//tools:defaults.bzl", "jasmine_node_test", "ng_module", "ng_rollup_bundle", "ts_library")
|
||||
load("//tools/http-server:http_server.bzl", "http_server")
|
||||
load("//tools/symbol-extractor:index.bzl", "js_expected_symbol_test")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
|
||||
load("@npm_bazel_typescript//:defs.bzl", "ts_devserver")
|
||||
|
||||
ng_module(
|
||||
name = "todo",
|
||||
|
@ -2,7 +2,7 @@ package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "jasmine_node_test", "ng_module", "ng_rollup_bundle", "ts_library")
|
||||
load("//tools/http-server:http_server.bzl", "http_server")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
|
||||
load("@npm_bazel_typescript//:defs.bzl", "ts_devserver")
|
||||
|
||||
ng_module(
|
||||
name = "todo_i18n",
|
||||
|
@ -2,7 +2,7 @@ package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//tools:defaults.bzl", "jasmine_node_test", "ng_module", "ng_rollup_bundle", "ts_library")
|
||||
load("//tools/http-server:http_server.bzl", "http_server")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
|
||||
load("@npm_bazel_typescript//:defs.bzl", "ts_devserver")
|
||||
|
||||
ng_module(
|
||||
name = "todo",
|
||||
|
@ -11,6 +11,14 @@ import {Component, ContentChildren, Directive, Inject, NO_ERRORS_SCHEMA, NgModul
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
|
||||
class Frame {
|
||||
name: string = 'frame';
|
||||
}
|
||||
|
||||
class ModuleFrame {
|
||||
name: string = 'moduleFram';
|
||||
}
|
||||
|
||||
describe('forwardRef integration', function() {
|
||||
beforeEach(() => { TestBed.configureTestingModule({imports: [Module], declarations: [App]}); });
|
||||
|
||||
@ -51,14 +59,6 @@ class Door {
|
||||
constructor(@Inject(forwardRef(() => Frame)) frame: Frame) { this.frame = frame; }
|
||||
}
|
||||
|
||||
class Frame {
|
||||
name: string = 'frame';
|
||||
}
|
||||
|
||||
class ModuleFrame {
|
||||
name: string = 'moduleFram';
|
||||
}
|
||||
|
||||
@Directive({selector: 'lock'})
|
||||
class Lock {
|
||||
name: string = 'lock';
|
||||
|
@ -15,10 +15,6 @@ class TestObj {
|
||||
someComplexFunc(a: any) { return a; }
|
||||
}
|
||||
|
||||
class SpyTestObj extends SpyObject {
|
||||
constructor() { super(TestObj); }
|
||||
}
|
||||
|
||||
{
|
||||
describe('testing', () => {
|
||||
describe('should respect custom equality tester', () => {
|
||||
@ -87,7 +83,7 @@ class SpyTestObj extends SpyObject {
|
||||
describe('spy objects', () => {
|
||||
let spyObj: any;
|
||||
|
||||
beforeEach(() => { spyObj = new SpyTestObj(); });
|
||||
beforeEach(() => { spyObj = new SpyObject(TestObj); });
|
||||
|
||||
it('should return a new spy func with no calls',
|
||||
() => { expect(spyObj.spy('someFunc')).not.toHaveBeenCalled(); });
|
||||
@ -100,6 +96,7 @@ class SpyTestObj extends SpyObject {
|
||||
});
|
||||
|
||||
it('should match multiple function calls', () => {
|
||||
spyObj.spy('someFunc');
|
||||
spyObj.someFunc(1, 2);
|
||||
spyObj.someFunc(3, 4);
|
||||
expect(spyObj.spy('someFunc')).toHaveBeenCalledWith(1, 2);
|
||||
@ -107,11 +104,13 @@ class SpyTestObj extends SpyObject {
|
||||
});
|
||||
|
||||
it('should match null arguments', () => {
|
||||
spyObj.spy('someFunc');
|
||||
spyObj.someFunc(null, 'hello');
|
||||
expect(spyObj.spy('someFunc')).toHaveBeenCalledWith(null, 'hello');
|
||||
});
|
||||
|
||||
it('should match using deep equality', () => {
|
||||
spyObj.spy('someComplexFunc');
|
||||
spyObj.someComplexFunc([1]);
|
||||
expect(spyObj.spy('someComplexFunc')).toHaveBeenCalledWith([1]);
|
||||
});
|
||||
@ -122,8 +121,10 @@ class SpyTestObj extends SpyObject {
|
||||
expect(s.b()).toEqual(2);
|
||||
});
|
||||
|
||||
it('should create spys for all methods',
|
||||
() => { expect(() => spyObj.someFunc()).not.toThrow(); });
|
||||
it('should create spys for all methods', () => {
|
||||
spyObj.spy('someFunc');
|
||||
expect(() => spyObj.someFunc()).not.toThrow();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//packages/bazel:index.bzl", "protractor_web_test_suite")
|
||||
load("//tools:defaults.bzl", "ng_module", "ts_library")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
|
||||
load("@npm_bazel_typescript//:defs.bzl", "ts_devserver")
|
||||
|
||||
ng_module(
|
||||
name = "common_examples",
|
||||
|
@ -2,7 +2,7 @@ package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//packages/bazel:index.bzl", "protractor_web_test_suite")
|
||||
load("//tools:defaults.bzl", "jasmine_node_test", "ng_module", "ts_library")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
|
||||
load("@npm_bazel_typescript//:defs.bzl", "ts_devserver")
|
||||
|
||||
ng_module(
|
||||
name = "core_examples",
|
||||
|
@ -2,7 +2,7 @@ package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//packages/bazel:index.bzl", "protractor_web_test_suite")
|
||||
load("//tools:defaults.bzl", "ng_module", "ts_library")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
|
||||
load("@npm_bazel_typescript//:defs.bzl", "ts_devserver")
|
||||
|
||||
ng_module(
|
||||
name = "forms_examples",
|
||||
|
@ -1,6 +1,6 @@
|
||||
load("//packages/bazel:index.bzl", "protractor_web_test_suite")
|
||||
load("//tools:defaults.bzl", "ng_module", "ts_library")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
|
||||
load("@npm_bazel_typescript//:defs.bzl", "ts_devserver")
|
||||
|
||||
"""
|
||||
Macro that can be used to create the Bazel targets for an "upgrade" example. Since the
|
||||
|
@ -22,13 +22,16 @@ interface OtherMetadataType extends SomeMetadataType {
|
||||
class SomeMetadata implements SomeMetadataType {
|
||||
plainProp: string;
|
||||
private _getterProp: string;
|
||||
get getterProp(): string { return this._getterProp; }
|
||||
arrayProp: any[];
|
||||
|
||||
constructor(options: SomeMetadataType) {
|
||||
this.plainProp = options.plainProp !;
|
||||
this._getterProp = options.getterProp !;
|
||||
this.arrayProp = options.arrayProp !;
|
||||
Object.defineProperty(this, 'getterProp', {
|
||||
enumerable: true, // getters are non-enumerable by default in es2015
|
||||
get: () => this._getterProp,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
"importHelpers": true
|
||||
},
|
||||
"bazelOptions": {
|
||||
"suppressTsconfigOverrideWarnings": true
|
||||
"suppressTsconfigOverrideWarnings": true,
|
||||
"devmodeTargetOverride": "es5"
|
||||
}
|
||||
}
|
||||
|
@ -6,4 +6,8 @@
|
||||
"compilerOptions": {
|
||||
"types": ["node", "jasmine"],
|
||||
},
|
||||
"bazelOptions": {
|
||||
"suppressTsconfigOverrideWarnings": true,
|
||||
"devmodeTargetOverride": "es5"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user