Skip to content

Commit aedfcc1

Browse files
alan-agius4clydin
authored andcommitted
build: update to @types/node version 12
1 parent fe90b76 commit aedfcc1

File tree

13 files changed

+27
-41
lines changed

13 files changed

+27
-41
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
"@types/loader-utils": "^2.0.0",
110110
"@types/minimatch": "3.0.3",
111111
"@types/minimist": "^1.2.0",
112-
"@types/node": "10.12.30",
112+
"@types/node": "~12.12.6",
113113
"@types/node-fetch": "^2.1.6",
114114
"@types/npm-package-arg": "^6.1.0",
115115
"@types/parse5-html-rewriting-stream": "^5.1.2",

packages/angular/cli/lib/init.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,18 +135,9 @@ if (process.env['NG_CLI_PROFILING']) {
135135

136136
return cli;
137137
})().then(cli => {
138-
// This is required to support 1.x local versions with a 6+ global
139-
let standardInput;
140-
try {
141-
standardInput = process.stdin;
142-
} catch (e) {
143-
process.stdin = new Duplex();
144-
standardInput = process.stdin;
145-
}
146-
147138
return cli({
148139
cliArgs: process.argv.slice(2),
149-
inputStream: standardInput,
140+
inputStream: process.stdin,
150141
outputStream: process.stdout,
151142
});
152143
}).then((exitCode: number) => {

packages/angular/cli/utilities/color.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ import * as ansiColors from 'ansi-colors';
99
import { WriteStream } from 'tty';
1010

1111
type AnsiColors = typeof ansiColors;
12-
13-
// Typings do not contain the function call (added in Node.js v9.9.0)
14-
const supportsColor =
15-
process.stdout instanceof WriteStream &&
16-
((process.stdout as unknown) as { getColorDepth(): number }).getColorDepth() > 1;
12+
const supportsColor = process.stdout instanceof WriteStream && process.stdout.getColorDepth() > 1;
1713

1814
export function removeColor(text: string): string {
1915
// This has been created because when colors.enabled is false unstyle doesn't work

packages/angular/pwa/pwa/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function updateIndexFile(path: string): Rule {
6363

6464
const chunks: Array<Buffer> = [];
6565
const output = new Writable({
66-
write(chunk: string | Buffer, encoding: string, callback: Function): void {
66+
write(chunk: string | Buffer, encoding: BufferEncoding, callback: Function): void {
6767
chunks.push(typeof chunk === 'string' ? Buffer.from(chunk, encoding) : chunk);
6868
callback();
6969
},

packages/angular_devkit/architect/node/node-modules-architect-host.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88
import { json, workspaces } from '@angular-devkit/core';
99
import * as path from 'path';
10-
import * as v8 from 'v8';
10+
import { deserialize, serialize } from 'v8';
1111
import { BuilderInfo } from '../src';
1212
import { Schema as BuilderSchema } from '../src/builders-schema';
1313
import { Target } from '../src/input-schema';
@@ -18,9 +18,6 @@ export type NodeModulesBuilderInfo = BuilderInfo & {
1818
};
1919

2020
function clone(obj: unknown): unknown {
21-
const serialize = ((v8 as unknown) as { serialize(value: unknown): Buffer }).serialize;
22-
const deserialize = ((v8 as unknown) as { deserialize(buffer: Buffer): unknown }).deserialize;
23-
2421
try {
2522
return deserialize(serialize(obj));
2623
} catch {

packages/angular_devkit/benchmark/src/monitored-process.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ export class LocalMonitoredProcess implements MonitoredProcess {
5151
const childProcess = spawn(cmd, args, spawnOptions);
5252

5353
// Emit output and stats.
54-
childProcess.stdout.on('data', (data: Buffer) => this.stdout.next(data));
55-
childProcess.stderr.on('data', (data: Buffer) => this.stderr.next(data));
54+
childProcess.stdout?.on('data', (data: Buffer) => this.stdout.next(data));
55+
childProcess.stderr?.on('data', (data: Buffer) => this.stderr.next(data));
5656

5757
const statsSubs = timer(0, this.pollingRate).pipe(
5858
concatMap(() => from(pidtree(childProcess.pid, { root: true }) as Promise<number[]>)),

packages/angular_devkit/build_angular/src/utils/color.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ import * as ansiColors from 'ansi-colors';
99
import { WriteStream } from 'tty';
1010

1111
type AnsiColors = typeof ansiColors;
12-
13-
// Typings do not contain the function call (added in Node.js v9.9.0)
14-
const supportsColor =
15-
process.stdout instanceof WriteStream &&
16-
((process.stdout as unknown) as { getColorDepth(): number }).getColorDepth() > 1;
12+
const supportsColor = process.stdout instanceof WriteStream && process.stdout.getColorDepth() > 1;
1713

1814
export function removeColor(text: string): string {
1915
// This has been created because when colors.enabled is false unstyle doesn't work

packages/angular_devkit/build_angular/src/utils/index-file/html-rewriting-stream.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export async function htmlRewritingStream(content: string): Promise<{
2828
.pipe(rewriter)
2929
.pipe(new Writable({
3030
write(chunk: string | Buffer, encoding: string | undefined, callback: Function): void {
31-
chunks.push(typeof chunk === 'string' ? Buffer.from(chunk, encoding) : chunk);
31+
chunks.push(typeof chunk === 'string' ? Buffer.from(chunk, encoding as BufferEncoding) : chunk);
3232
callback();
3333
},
3434
final(callback: (error?: Error) => void): void {

packages/angular_devkit/build_angular/src/webpack/configs/dev-server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export function getDevServerConfig(
5555
}
5656

5757
const parsedHost = url.parse(publicHost);
58-
publicHost = parsedHost.host;
58+
publicHost = parsedHost.host ?? undefined;
5959
} else {
6060
publicHost = '0.0.0.0:0';
6161
}

packages/angular_devkit/build_webpack/src/webpack-dev-server/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ export function runWebpackDevServer(
9393
obs.error(err);
9494
} else {
9595
const address = this.address();
96+
if (!address) {
97+
obs.error(new Error(`Dev-server address info is not defined.`));
98+
99+
return;
100+
}
101+
96102
result = {
97103
success: true,
98104
port: typeof address === 'string' ? 0 : address.port,

packages/angular_devkit/core/node/host.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ function loadFSWatcher() {
5858
}
5959
}
6060

61-
type FsFunction0<R> = (cb: (err?: Error, result?: R) => void) => void;
62-
type FsFunction1<R, T1> = (p1: T1, cb: (err?: Error, result?: R) => void) => void;
61+
type FsFunction0<R> = (cb: (err?: Error|null, result?: R) => void) => void;
62+
type FsFunction1<R, T1> = (p1: T1, cb: (err?: Error|null, result?: R) => void) => void;
6363
type FsFunction2<R, T1, T2>
64-
= (p1: T1, p2: T2, cb: (err?: Error, result?: R) => void) => void;
64+
= (p1: T1, p2: T2, cb: (err?: Error|null, result?: R) => void) => void;
6565

6666

6767
function _callFs<R>(fn: FsFunction0<R>): Observable<R>;
@@ -70,7 +70,7 @@ function _callFs<R, T1, T2>(fn: FsFunction2<R, T1, T2>, p1: T1, p2: T2): Observa
7070

7171
function _callFs<ResultT>(fn: Function, ...args: {}[]): Observable<ResultT> {
7272
return new Observable(obs => {
73-
fn(...args, (err?: Error, result?: ResultT) => {
73+
fn(...args, (err?: Error|null, result?: ResultT) => {
7474
if (err) {
7575
obs.error(err);
7676
} else {

packages/angular_devkit/schematics/tasks/package-manager/executor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ export default function(
125125
}
126126
});
127127
if (options.hideOutput) {
128-
childProcess.stdout.on('data', (data: Buffer) =>
128+
childProcess.stdout?.on('data', (data: Buffer) =>
129129
bufferedOutput.push({ stream: process.stdout, data: data }));
130-
childProcess.stderr.on('data', (data: Buffer) =>
130+
childProcess.stderr?.on('data', (data: Buffer) =>
131131
bufferedOutput.push({ stream: process.stderr, data: data }));
132132
}
133133
});

yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,16 +1663,16 @@
16631663
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.25.tgz#15967a7b577ff81383f9b888aa6705d43fbbae93"
16641664
integrity sha512-EPpXLOVqDvisVxtlbvzfyqSsFeQxltFbluZNRndIb8tr9KiBnYNLzrc1N3pyKUCww2RNrfHDViqDWWE1LCJQtQ==
16651665

1666-
"@types/node@10.12.30":
1667-
version "10.12.30"
1668-
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.30.tgz#4c2b4f0015f214f8158a347350481322b3b29b2f"
1669-
integrity sha512-nsqTN6zUcm9xtdJiM9OvOJ5EF0kOI8f1Zuug27O/rgtxCRJHGqncSWfCMZUP852dCKPsDsYXGvBhxfRjDBkF5Q==
1670-
16711666
"@types/node@^10.1.0":
16721667
version "10.17.51"
16731668
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.51.tgz#639538575befbcf3d3861f95c41de8e47124d674"
16741669
integrity sha512-KANw+MkL626tq90l++hGelbl67irOJzGhUJk6a1Bt8QHOeh9tztJx+L0AqttraWKinmZn7Qi5lJZJzx45Gq0dg==
16751670

1671+
"@types/node@~12.12.6":
1672+
version "12.12.70"
1673+
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.70.tgz#adf70b179c3ee17620215ee4cb5c68c95f7c37ec"
1674+
integrity sha512-i5y7HTbvhonZQE+GnUM2rz1Bi8QkzxdQmEv1LKOv4nWyaQk/gdeiTApuQR3PDJHX7WomAbpx2wlWSEpxXGZ/UQ==
1675+
16761676
"@types/normalize-package-data@^2.4.0":
16771677
version "2.4.0"
16781678
resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e"

0 commit comments

Comments
 (0)