-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathtypescript-benchmark.js
41 lines (38 loc) · 1.01 KB
/
typescript-benchmark.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
const fs = require("fs");
const ts = require("typescript");
const payloads = [
{
// Compile typescript-angular.ts to ES3 (default)
name: "todomvc/typescript-angular.ts",
transpileOptions: {
compilerOptions: {
module: ts.ModuleKind.CommonJS,
target: ts.ScriptTarget.ES3
}
}
},
{
// Compile typescript-angular.ts to ESNext (latest)
name: "todomvc/typescript-angular.ts",
transpileOptions: {
compilerOptions: {
module: ts.ModuleKind.CommonJS,
target: ts.ScriptTarget.ESNext
}
}
}
].map(({ name, transpileOptions }) => ({
input: fs.readFileSync(`third_party/${name}`, "utf8"),
transpileOptions
}));
module.exports = {
name: "typescript",
fn() {
return payloads.map(({ input, transpileOptions }) =>
ts.transpileModule(input, transpileOptions)
);
}
};