Skip to content

Commit 74f8eb3

Browse files
committed
chore(deps): update dependency gts to v1
1 parent 843e9e5 commit 74f8eb3

16 files changed

Lines changed: 1106 additions & 726 deletions

package-lock.json

Lines changed: 65 additions & 110 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"@types/tmp": "0.1.0",
5252
"codecov": "^3.0.0",
5353
"deep-copy": "^1.4.2",
54-
"gts": "^0.9.0",
54+
"gts": "^1.0.0",
5555
"js-green-licenses": "^0.5.0",
5656
"linkinator": "^1.1.2",
5757
"mocha": "^6.1.4",

ts/src/heap-profiler-bindings.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,24 @@
1616

1717
import * as path from 'path';
1818

19-
import {AllocationProfileNode} from './v8-types';
19+
import { AllocationProfileNode } from './v8-types';
2020

2121
const binary = require('node-pre-gyp');
22-
const bindingPath =
23-
binary.find(path.resolve(path.join(__dirname, '../../package.json')));
22+
const bindingPath = binary.find(
23+
path.resolve(path.join(__dirname, '../../package.json'))
24+
);
2425
const profiler = require(bindingPath);
2526

2627
// Wrappers around native heap profiler functions.
2728

2829
export function startSamplingHeapProfiler(
29-
heapIntervalBytes: number, heapStackDepth: number) {
30+
heapIntervalBytes: number,
31+
heapStackDepth: number
32+
) {
3033
profiler.heapProfiler.startSamplingHeapProfiler(
31-
heapIntervalBytes, heapStackDepth);
34+
heapIntervalBytes,
35+
heapStackDepth
36+
);
3237
}
3338

3439
export function stopSamplingHeapProfiler() {

ts/src/heap-profiler.ts

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@
1414
* limitations under the License.
1515
*/
1616

17-
import {perftools} from '../../proto/profile';
17+
import { perftools } from '../../proto/profile';
1818

19-
import {getAllocationProfile, startSamplingHeapProfiler, stopSamplingHeapProfiler} from './heap-profiler-bindings';
20-
import {serializeHeapProfile} from './profile-serializer';
21-
import {SourceMapper} from './sourcemapper/sourcemapper';
22-
import {AllocationProfileNode} from './v8-types';
19+
import {
20+
getAllocationProfile,
21+
startSamplingHeapProfiler,
22+
stopSamplingHeapProfiler,
23+
} from './heap-profiler-bindings';
24+
import { serializeHeapProfile } from './profile-serializer';
25+
import { SourceMapper } from './sourcemapper/sourcemapper';
26+
import { AllocationProfileNode } from './v8-types';
2327

2428
let enabled = false;
2529
let heapIntervalBytes = 0;
@@ -45,27 +49,33 @@ export function v8Profile(): AllocationProfileNode {
4549
* @param ignoreSamplePath
4650
* @param sourceMapper
4751
*/
48-
export function profile(ignoreSamplePath?: string, sourceMapper?: SourceMapper):
49-
perftools.profiles.IProfile {
52+
export function profile(
53+
ignoreSamplePath?: string,
54+
sourceMapper?: SourceMapper
55+
): perftools.profiles.IProfile {
5056
const startTimeNanos = Date.now() * 1000 * 1000;
5157
const result = v8Profile();
5258
// Add node for external memory usage.
5359
// Current type definitions do not have external.
5460
// TODO: remove any once type definition is updated to include external.
5561
// tslint:disable-next-line: no-any
56-
const {external}: {external: number} = process.memoryUsage() as any;
62+
const { external }: { external: number } = process.memoryUsage() as any;
5763
if (external > 0) {
5864
const externalNode: AllocationProfileNode = {
5965
name: '(external)',
6066
scriptName: '',
6167
children: [],
62-
allocations: [{sizeBytes: external, count: 1}],
68+
allocations: [{ sizeBytes: external, count: 1 }],
6369
};
6470
result.children.push(externalNode);
6571
}
6672
return serializeHeapProfile(
67-
result, startTimeNanos, heapIntervalBytes, ignoreSamplePath,
68-
sourceMapper);
73+
result,
74+
startTimeNanos,
75+
heapIntervalBytes,
76+
ignoreSamplePath,
77+
sourceMapper
78+
);
6979
}
7080

7181
/**
@@ -78,8 +88,9 @@ export function profile(ignoreSamplePath?: string, sourceMapper?: SourceMapper):
7888
*/
7989
export function start(intervalBytes: number, stackDepth: number) {
8090
if (enabled) {
81-
throw new Error(`Heap profiler is already started with intervalBytes ${
82-
heapIntervalBytes} and stackDepth ${stackDepth}`);
91+
throw new Error(
92+
`Heap profiler is already started with intervalBytes ${heapIntervalBytes} and stackDepth ${stackDepth}`
93+
);
8394
}
8495
heapIntervalBytes = intervalBytes;
8596
heapStackDepth = stackDepth;

ts/src/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
import {writeFileSync} from 'fs';
17-
import {gzipSync} from 'zlib';
16+
import { writeFileSync } from 'fs';
17+
import { gzipSync } from 'zlib';
1818

19-
import {perftools} from '../../proto/profile';
19+
import { perftools } from '../../proto/profile';
2020

2121
import * as heapProfiler from './heap-profiler';
22-
import {encodeSync} from './profile-encoder';
22+
import { encodeSync } from './profile-encoder';
2323
import * as timeProfiler from './time-profiler';
2424

25-
export {encode, encodeSync} from './profile-encoder';
26-
export {SourceMapper} from './sourcemapper/sourcemapper';
25+
export { encode, encodeSync } from './profile-encoder';
26+
export { SourceMapper } from './sourcemapper/sourcemapper';
2727

2828
export const time = {
2929
profile: timeProfiler.profile,

ts/src/profile-encoder.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@
1515
*/
1616

1717
import * as pify from 'pify';
18-
import {gzip, gzipSync} from 'zlib';
18+
import { gzip, gzipSync } from 'zlib';
1919

20-
import {perftools} from '../../proto/profile';
20+
import { perftools } from '../../proto/profile';
2121

2222
const gzipPromise = pify(gzip);
2323

24-
export async function encode(profile: perftools.profiles.IProfile):
25-
Promise<Buffer> {
24+
export async function encode(
25+
profile: perftools.profiles.IProfile
26+
): Promise<Buffer> {
2627
const buffer = perftools.profiles.Profile.encode(profile).finish();
2728
return gzipPromise(buffer);
2829
}

0 commit comments

Comments
 (0)