build: update to latest @bazel/typescript (#19277)

Switches devmode output of an ng_module to UMD
This commit is contained in:
Alex Eagle
2017-09-25 12:40:22 -07:00
committed by Victor Berchet
parent e224e3d62d
commit 9ad4b3bd31
12 changed files with 40 additions and 18 deletions

1
packages/BUILD.bazel Normal file
View File

@ -0,0 +1 @@
exports_files(["tsconfig-build.json"])

View File

@ -9,7 +9,7 @@
"typescript": "^2.4.2"
},
"dependencies": {
"@bazel/typescript": "0.1.x",
"@bazel/typescript": "0.2.x",
"@types/node": "6.0.84"
},
"repository": {

View File

@ -6,6 +6,7 @@
load(":rules_typescript.bzl",
"tsc_wrapped_tsconfig",
"COMMON_ATTRIBUTES",
"COMMON_OUTPUTS",
"compile_ts",
"DEPS_ASPECTS",
"ts_providers_dict_to_struct",
@ -189,4 +190,5 @@ ng_module = rule(
default = Label("@//:node_modules")
),
},
)
outputs = COMMON_OUTPUTS,
)

View File

@ -8,7 +8,7 @@
// TODO(tbosch): figure out why we need this as it breaks node code within ngc-wrapped
/// <reference types="node" />
import * as ng from '@angular/compiler-cli';
import {BazelOptions, CachedFileLoader, CompilerHost, FileCache, FileLoader, UncachedFileLoader, constructManifest, debug, parseTsconfig, runAsWorker, runWorkerLoop} from '@bazel/typescript';
import {BazelOptions, CachedFileLoader, CompilerHost, FileCache, FileLoader, UncachedFileLoader, constructManifest, debug, fixUmdModuleDeclarations, parseTsconfig, runAsWorker, runWorkerLoop} from '@bazel/typescript';
import * as fs from 'fs';
import * as path from 'path';
import * as tsickle from 'tsickle';
@ -163,7 +163,10 @@ export function compile(
program, bazelHost, bazelHost, compilerOpts, targetSourceFile, writeFile,
cancellationToken, emitOnlyDtsFiles, {
beforeTs: customTransformers.before,
afterTs: customTransformers.after,
afterTs: [
...(customTransformers.after || []),
fixUmdModuleDeclarations((sf: ts.SourceFile) => bazelHost.amdModuleName(sf)),
],
});
const {diagnostics, emitResult, program} = ng.performCompilation(

View File

@ -1,9 +1,12 @@
# Allows different paths for these imports in google3
load("@build_bazel_rules_typescript//internal:build_defs.bzl", "tsc_wrapped_tsconfig")
load(
"@build_bazel_rules_typescript//internal:common/compilation.bzl",
"COMMON_ATTRIBUTES", "compile_ts", "DEPS_ASPECTS", "ts_providers_dict_to_struct"
load("@build_bazel_rules_typescript//internal:common/compilation.bzl",
"COMMON_ATTRIBUTES",
"COMMON_OUTPUTS",
"compile_ts",
"DEPS_ASPECTS",
"ts_providers_dict_to_struct",
)
load("@build_bazel_rules_typescript//internal:common/json_marshal.bzl", "json_marshal")

View File

@ -1,5 +1,11 @@
package(default_visibility=["//visibility:public"])
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_config")
ts_config(
name = "tsconfig",
src = "tsconfig-build.json",
deps = ["//packages:tsconfig-build.json"]
)
ts_library(
name = "compiler-cli",
@ -11,5 +17,5 @@ ts_library(
deps = [
"//packages/compiler"
],
tsconfig = ":tsconfig-build.json",
tsconfig = ":tsconfig",
)

View File

@ -8,6 +8,5 @@ ts_library(
"testing/**",
]),
module_name = "@angular/compiler",
deps = [],
tsconfig = ":tsconfig-build.json",
)