Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

build: support building with TS 2.6 #300

Merged
merged 1 commit into from
Dec 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
git_repository(
name = "build_bazel_rules_nodejs",
remote = "https://github.com/bazelbuild/rules_nodejs.git",
tag = "0.1.0",
tag = "0.3.1",
)

load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories")
node_repositories(package_json = ["//:package.json"])

local_repository(
git_repository(
name = "build_bazel_rules_typescript",
path = "node_modules/@bazel/typescript",
remote = "https://github.com/bazelbuild/rules_typescript.git",
tag = "0.6.0",
)

load("@build_bazel_rules_typescript//:defs.bzl", "ts_repositories")

ts_repositories()
124 changes: 15 additions & 109 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,8 @@
"temp": "^0.8.3",
"ts-node": "^2.0.0",
"tslint": "^5.5.0",
"typescript": "~2.4.0",
"typescript": "~2.6.1",
"v8-profiler": "^5.7.0",
"webpack-sources": "^1.0.1"
},
"devDependencies": {
"@bazel/typescript": "0.0.10"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function transformJavascript(
}

// Print error diagnostics.
const checkDiagnostics = (diagnostics: ts.Diagnostic[]) => {
const checkDiagnostics = (diagnostics: ReadonlyArray<ts.Diagnostic>) => {
if (diagnostics && diagnostics.length > 0) {
let errors = '';
errors = errors + '\n' + ts.formatDiagnostics(diagnostics, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,10 @@ export function getFoldFileTransformer(program: ts.Program): ts.TransformerFacto
const classes = findClassDeclarations(sf);
const statements = findClassStaticPropertyAssignments(sf, checker, classes);

const visitor: ts.Visitor = (node: ts.Node): ts.Node => {
const visitor: ts.Visitor = (node: ts.Node): ts.VisitResult<ts.Node> => {
// Check if node is a statement to be dropped.
if (statements.find((st) => st.expressionStatement === node)) {
// According to @mhegazy returning undefined is supported.
// https://github.com/Microsoft/TypeScript/pull/17044
// tslint:disable-next-line:no-any
return undefined as any;
return undefined;
}

// Check if node is a class to add statements to.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,10 @@ export function getScrubFileTransformer(program: ts.Program): ts.TransformerFact
}
}

const visitor: ts.Visitor = (node: ts.Node): ts.Node => {
const visitor: ts.Visitor = (node: ts.Node): ts.VisitResult<ts.Node> => {
// Check if node is a statement to be dropped.
if (nodes.find((n) => n === node)) {
// According to @mhegazy returning undefined is supported.
// https://github.com/Microsoft/TypeScript/pull/17044
// tslint:disable-next-line:no-any
return undefined as any;
return undefined;
}

// Otherwise return node as is.
Expand Down
2 changes: 2 additions & 0 deletions packages/angular_devkit/schematics/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ ts_library(
),
deps = [
":schematics",
"//packages/angular_devkit/core",
# @deps: rxjs
# @typings: jasmine
],
Expand All @@ -75,6 +76,7 @@ ts_library(
include = ["tools/**/*_spec.ts"],
),
deps = [
":schematics",
":tools",
# @deps: rxjs
# @typings: jasmine
Expand Down
2 changes: 1 addition & 1 deletion packages/angular_devkit/schematics/src/rules/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const kPathTemplateComponentRE = /__(.+?)__/g;
export const kPathTemplatePipeRE = /@([^@]+)/;


export type TemplateValue = boolean | string | number;
export type TemplateValue = boolean | string | number | undefined;
export type TemplatePipeFunction = (x: string) => TemplateValue;
export type TemplateOptions = {
[key: string]: TemplateValue | TemplateOptions | TemplatePipeFunction,
Expand Down
5 changes: 2 additions & 3 deletions packages/angular_devkit/schematics/src/sink/dryrun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ export class DryRunSink extends FileSystemSink {
}
}

const content = null;
this._subject.next({ kind: 'delete', path, content });
this._subject.next({ kind: 'delete', path });
});
this._filesToCreate.forEach((content, path) => {
// Check if this is a renaming.
Expand All @@ -106,7 +105,7 @@ export class DryRunSink extends FileSystemSink {
this._subject.next({ kind: 'update', path, content: content.generate() });
});
this._filesToRename.forEach(([path, to]) => {
this._subject.next({ kind: 'rename', path, to, content: null });
this._subject.next({ kind: 'rename', path, to });
});

this._subject.complete();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export abstract class FileSystemEngineHostBase implements
createCollectionDescription(name: string): FileSystemCollectionDesc {
const path = this._resolveCollectionPath(name);
const jsonValue = readJsonFile(path);
if (!jsonValue || typeof jsonValue != 'object') {
if (!jsonValue || typeof jsonValue != 'object' || Array.isArray(jsonValue)) {
throw new InvalidCollectionJsonException(name, path);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/angular/application/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default function (options: ApplicationOptions): Rule {
options.serviceWorker ? noop() : filter(path => !path.endsWith('/ngsw-config.json')),
template({
utils: stringUtils,
...options as object,
...options,
'dot': '.',
sourcedir: sourceDir,
}),
Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/angular/class/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function (options: ClassOptions): Rule {
options.spec ? noop() : filter(path => !path.endsWith('.spec.ts')),
template({
...stringUtils,
...options as object,
...options,
}),
move(sourceDir),
]);
Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/angular/component/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default function(options: ComponentOptions): Rule {
template({
...stringUtils,
'if-flat': (s: string) => options.flat ? '' : s,
...options as object,
...options,
}),
move(sourceDir),
]);
Expand Down
Loading