-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathbabylon-benchmark.js
61 lines (58 loc) · 1.36 KB
/
babylon-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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// 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 babylon = require("babylon");
const fs = require("fs");
const payloads = [
{
name: "jquery-3.2.1.js",
options: { sourceType: "script" }
},
{
name: "lodash.core-4.17.4.js",
options: { sourceType: "script" }
},
{
name: "preact-8.2.5.js",
options: { sourceType: "script" }
},
{
name: "redux.min-3.7.2.js",
options: { sourceType: "script" }
},
{
name: "speedometer-es2015-test-2.0.js",
options: { sourceType: "script" }
},
{
name: "todomvc/react/app.jsx",
options: { sourceType: "script", plugins: ["jsx"] }
},
{
name: "todomvc/react/footer.jsx",
options: { sourceType: "script", plugins: ["jsx"] }
},
{
name: "todomvc/react/todoItem.jsx",
options: { sourceType: "script", plugins: ["jsx"] }
},
{
name: "underscore-1.8.3.js",
options: { sourceType: "script" }
},
{
name: "vue.runtime.esm-nobuble-2.4.4.js",
options: { sourceType: "module" }
}
].map(({ name, options }) => ({
payload: fs.readFileSync(`third_party/${name}`, "utf8"),
options
}));
module.exports = {
name: "babylon",
fn() {
return payloads.map(({ payload, options }) =>
babylon.parse(payload, options)
);
}
};