Skip to content

build: update typescript bazel rules #14465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
8 changes: 4 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ http_archive(
# Add TypeScript rules
http_archive(
name = "build_bazel_rules_typescript",
url = "https://github.com/bazelbuild/rules_typescript/archive/0.21.0.zip",
strip_prefix = "rules_typescript-0.21.0",
url = "https://github.com/bazelbuild/rules_typescript/archive/0.22.0.zip",
strip_prefix = "rules_typescript-0.22.0",
)

# Add Angular source and Bazel rules.
http_archive(
name = "angular",
url = "https://github.com/angular/angular/archive/7.1.2.zip",
strip_prefix = "angular-7.1.2",
url = "https://github.com/angular/angular/archive/7.1.3.zip",
strip_prefix = "angular-7.1.3",
)

# Add RxJS as repository because those are needed in order to build Angular from source.
Expand Down
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
"version": "7.1.1",
"requiredAngularVersion": ">=7.0.0",
"dependencies": {
"@angular/animations": "^7.1.2",
"@angular/common": "^7.1.2",
"@angular/compiler": "^7.1.2",
"@angular/core": "^7.1.2",
"@angular/elements": "^7.1.2",
"@angular/forms": "^7.1.2",
"@angular/platform-browser": "^7.1.2",
"@angular/animations": "^7.1.3",
"@angular/common": "^7.1.3",
"@angular/compiler": "^7.1.3",
"@angular/core": "^7.1.3",
"@angular/elements": "^7.1.3",
"@angular/forms": "^7.1.3",
"@angular/platform-browser": "^7.1.3",
"@webcomponents/custom-elements": "^1.1.0",
"core-js": "^2.6.0",
"rxjs": "^6.3.3",
Expand All @@ -47,15 +47,15 @@
"devDependencies": {
"@angular-devkit/core": "^7.1.2",
"@angular-devkit/schematics": "^7.1.2",
"@angular/bazel": "^7.1.2",
"@angular/compiler-cli": "^7.1.2",
"@angular/http": "^7.1.2",
"@angular/platform-browser-dynamic": "^7.1.2",
"@angular/platform-server": "^7.1.2",
"@angular/router": "^7.1.2",
"@angular/bazel": "^7.1.3",
"@angular/compiler-cli": "^7.1.3",
"@angular/http": "^7.1.3",
"@angular/platform-browser-dynamic": "^7.1.3",
"@angular/platform-server": "^7.1.3",
"@angular/router": "^7.1.3",
"@bazel/ibazel": "^0.9.0",
"@bazel/karma": "0.21.0",
"@bazel/typescript": "0.21.0",
"@bazel/karma": "0.22.0",
"@bazel/typescript": "0.22.0",
"@firebase/app-types": "^0.3.2",
"@octokit/rest": "^15.9.4",
"@schematics/angular": "^7.1.2",
Expand Down
1 change: 1 addition & 0 deletions src/lib/input/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ ng_test_library(
"@angular//packages/forms",
"@angular//packages/platform-browser",
"@angular//packages/platform-browser/animations",
"@rxjs",
"//src/cdk/bidi",
"//src/cdk/platform",
"//src/cdk/testing",
Expand Down
3 changes: 3 additions & 0 deletions tools/dgeni/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ ts_library(
srcs = glob(["**/*.ts"]),
deps = [
"@matdeps//@types/node",
"@matdeps//@types/glob",
"@matdeps//dgeni",
"@matdeps//dgeni-packages",
"//tools/highlight-files:sources",
],
tsconfig = ":tsconfig.json",
Expand Down
7 changes: 4 additions & 3 deletions tools/dgeni/common/decorators.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {ApiDoc} from 'dgeni-packages/typescript/api-doc-types/ApiDoc';
import {ClassExportDoc} from 'dgeni-packages/typescript/api-doc-types/ClassExportDoc';
import {PropertyMemberDoc} from 'dgeni-packages/typescript/api-doc-types/PropertyMemberDoc';
import {MemberDoc} from 'dgeni-packages/typescript/api-doc-types/MemberDoc';
import {CategorizedClassDoc, DeprecationDoc, HasDecoratorsDoc} from './dgeni-definitions';
import {PropertyMemberDoc} from 'dgeni-packages/typescript/api-doc-types/PropertyMemberDoc';
import {CategorizedClassDoc, DeprecationInfo, HasDecoratorsDoc} from './dgeni-definitions';

export function isMethod(doc: MemberDoc) {
return doc.hasOwnProperty('parameters') && !doc.isGetAccessor && !doc.isSetAccessor;
Expand Down Expand Up @@ -80,7 +81,7 @@ export function getBreakingChange(doc: any): string | null {
* Decorates public exposed docs. Creates a property on the doc that indicates whether
* the item is deprecated or not.
*/
export function decorateDeprecatedDoc(doc: DeprecationDoc) {
export function decorateDeprecatedDoc(doc: ApiDoc & DeprecationInfo) {
doc.isDeprecated = isDeprecatedDoc(doc);
doc.breakingChange = getBreakingChange(doc);

Expand Down
17 changes: 8 additions & 9 deletions tools/dgeni/common/dgeni-definitions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {ApiDoc} from 'dgeni-packages/typescript/api-doc-types/ApiDoc';
import {ClassExportDoc} from 'dgeni-packages/typescript/api-doc-types/ClassExportDoc';
import {ClassLikeExportDoc} from 'dgeni-packages/typescript/api-doc-types/ClassLikeExportDoc';
import {ConstExportDoc} from 'dgeni-packages/typescript/api-doc-types/ConstExportDoc';
Expand All @@ -7,10 +6,10 @@ import {TypeAliasExportDoc} from 'dgeni-packages/typescript/api-doc-types/TypeAl
import {ParsedDecorator} from 'dgeni-packages/typescript/services/TsParser/getDecorators';
import {FunctionExportDoc} from 'dgeni-packages/typescript/api-doc-types/FunctionExportDoc';
import {MethodMemberDoc} from 'dgeni-packages/typescript/api-doc-types/MethodMemberDoc';
import {NormalizedFunctionDoc} from './normalize-function-parameters';
import {NormalizedFunctionParameters} from './normalize-function-parameters';

/** Interface that describes categorized docs that can be deprecated. */
export interface DeprecationDoc extends ApiDoc {
export interface DeprecationInfo {
isDeprecated: boolean;
breakingChange: string | null;
}
Expand All @@ -21,7 +20,7 @@ export interface HasDecoratorsDoc {
}

/** Extended Dgeni class-like document that includes separated class members. */
export interface CategorizedClassLikeDoc extends ClassLikeExportDoc, DeprecationDoc {
export interface CategorizedClassLikeDoc extends ClassLikeExportDoc, DeprecationInfo {
methods: CategorizedMethodMemberDoc[];
properties: CategorizedPropertyMemberDoc[];
}
Expand All @@ -38,7 +37,7 @@ export interface CategorizedClassDoc extends ClassExportDoc, CategorizedClassLik
}

/** Extended Dgeni property-member document that includes extracted Angular metadata. */
export interface CategorizedPropertyMemberDoc extends PropertyMemberDoc, DeprecationDoc {
export interface CategorizedPropertyMemberDoc extends PropertyMemberDoc, DeprecationInfo {
description: string;
isDirectiveInput: boolean;
isDirectiveOutput: boolean;
Expand All @@ -48,14 +47,14 @@ export interface CategorizedPropertyMemberDoc extends PropertyMemberDoc, Depreca

/** Extended Dgeni method-member document that simplifies logic for the Dgeni template. */
export interface CategorizedMethodMemberDoc
extends NormalizedFunctionDoc, MethodMemberDoc, DeprecationDoc {}
extends NormalizedFunctionParameters, MethodMemberDoc, DeprecationInfo {}

/** Extended Dgeni function export document that simplifies logic for the Dgeni template. */
export interface CategorizedFunctionExportDoc
extends NormalizedFunctionDoc, FunctionExportDoc, DeprecationDoc {}
extends NormalizedFunctionParameters, FunctionExportDoc, DeprecationInfo {}

/** Extended Dgeni const export document that simplifies logic for the Dgeni template. */
export interface CategorizedConstExportDoc extends ConstExportDoc, DeprecationDoc {}
export interface CategorizedConstExportDoc extends ConstExportDoc, DeprecationInfo {}

/** Extended Dgeni type alias document that includes more information when rendering. */
export interface CategorizedTypeAliasExportDoc extends TypeAliasExportDoc, DeprecationDoc {}
export interface CategorizedTypeAliasExportDoc extends TypeAliasExportDoc, DeprecationInfo {}
10 changes: 8 additions & 2 deletions tools/dgeni/common/normalize-function-parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
} from 'dgeni-packages/typescript/api-doc-types/ParameterContainer';
import {ApiDoc} from 'dgeni-packages/typescript/api-doc-types/ApiDoc';

export interface NormalizedFunctionDoc extends ParameterContainer, ApiDoc {
export interface NormalizedFunctionParameters {
params?: FunctionParameterInfo[];
}

Expand All @@ -13,6 +13,12 @@ export interface FunctionParameterInfo extends ParamTag {
isOptional: boolean;
}

/**
* Generic type that represents Dgeni method members and standalone functions. Also it the type
* combines the normalized function document so that we can update the doc with type checking.
*/
export type DefaultFunctionDoc = NormalizedFunctionParameters & ParameterContainer & ApiDoc;

/**
* The `parameters` property are the parameters extracted from TypeScript and are strings
* of the form "propertyName: propertyType" (literally what's written in the source).
Expand All @@ -23,7 +29,7 @@ export interface FunctionParameterInfo extends ParamTag {
* We will use the `params` property to store the final normalized form since it is already
* an object.
*/
export function normalizeFunctionParameters(doc: NormalizedFunctionDoc) {
export function normalizeFunctionParameters(doc: DefaultFunctionDoc) {
if (doc.parameters) {
doc.parameters.forEach(parameter => {
let [parameterName, parameterType] = parameter.split(':');
Expand Down
Loading