Skip to content

Commit 22e5cf5

Browse files
update babel types & parser
1 parent 515be82 commit 22e5cf5

File tree

6 files changed

+47
-24
lines changed

6 files changed

+47
-24
lines changed

lib/cpa.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use strict";
22

3-
const { parse } = require("babylon");
4-
const t = require("babel-types");
3+
const { parse } = require("@babel/parser");
4+
const t = require("@babel/types");
55
const dfs = require("./dfs");
66
const hashcons = require("./hash");
77

@@ -10,9 +10,11 @@ const hashcons = require("./hash");
1010
const DUPLICATE = Symbol("DUPLICATE");
1111

1212
module.exports = class CPA {
13-
constructor(
14-
{ sourceType = "script", language = "js", threshold = 100 } = {}
15-
) {
13+
constructor({
14+
sourceType = "script",
15+
language = "js",
16+
threshold = 100
17+
} = {}) {
1618
// hash consing
1719
this.hashes = new Map();
1820
// to find optimal duplicates

lib/dfs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use strict";
22

3-
const t = require("babel-types");
3+
const t = require("@babel/types");
44

55
module.exports = function dfs(
66
root,

lib/hash.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use strict";
22

3-
const t = require("babel-types");
3+
const t = require("@babel/types");
44

55
module.exports = hashcons;
66

package.json

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,27 @@
1313
"dev": "bash -c 'cat <(find ./public/*) <(find ./lib/*) | entr -s \"./bin/js-cpa.js -m -t 1 -R html test/fixtures/*.js\"'",
1414
"prepublish": "yarn build"
1515
},
16-
"keywords": ["code", "repetition", "pattern", "duplication", "javascript"],
16+
"keywords": [
17+
"code",
18+
"repetition",
19+
"pattern",
20+
"duplication",
21+
"javascript"
22+
],
1723
"author": "Vignesh Shanmugam <vignesh.shanmugam22@gmail.com> (https://vigneshh.in)",
18-
"contributors": ["Boopathi Rajaa", "Vignesh Shanmugam"],
24+
"contributors": [
25+
"Boopathi Rajaa",
26+
"Vignesh Shanmugam"
27+
],
1928
"homepage": "https://github.com/vigneshshanmugam/js-cpa",
2029
"license": "MIT",
2130
"repository": {
2231
"type": "git",
2332
"url": "git+https://github.com/vigneshshanmugam/js-cpa.git"
2433
},
2534
"dependencies": {
26-
"babel-types": "^7.0.0-alpha.15",
27-
"babylon": "^7.0.0-beta.18",
35+
"@babel/parser": "^7.5.5",
36+
"@babel/types": "^7.5.5",
2837
"chalk": "^2.0.1",
2938
"commander": "^2.11.0",
3039
"ejs": "^2.5.7",

test/fixtures/match.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function a() {
1313
return `213`;
1414
}
1515

16-
function a() {
16+
function c() {
1717
function foo() {
1818
const b = 20;
1919
}

yarn.lock

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22
# yarn lockfile v1
33

44

5+
"@babel/parser@^7.5.5":
6+
version "7.5.5"
7+
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.5.5.tgz#02f077ac8817d3df4a832ef59de67565e71cca4b"
8+
integrity sha512-E5BN68cqR7dhKan1SfqgPGhQ178bkVKpXTPEXnFJBrEt8/DKRZlybmy+IgYLTeN7tp1R5Ccmbm2rBk17sHYU3g==
9+
10+
"@babel/types@^7.5.5":
11+
version "7.5.5"
12+
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.5.5.tgz#97b9f728e182785909aa4ab56264f090a028d18a"
13+
integrity sha512-s63F9nJioLqOlW3UkyMd+BYhXt44YuaFm/VV0VwuteqjYwRrObkU7ra9pY4wAJR3oXi8hJrMcrcJdO/HH33vtw==
14+
dependencies:
15+
esutils "^2.0.2"
16+
lodash "^4.17.13"
17+
to-fast-properties "^2.0.0"
18+
519
abab@^1.0.3:
620
version "1.0.3"
721
resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.3.tgz#b81de5f7274ec4e756d797cd834f303642724e5d"
@@ -938,14 +952,6 @@ babel-types@^6.19.0, babel-types@^6.24.1, babel-types@^6.26.0:
938952
lodash "^4.17.4"
939953
to-fast-properties "^1.0.3"
940954

941-
babel-types@^7.0.0-alpha.15:
942-
version "7.0.0-alpha.15"
943-
resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-7.0.0-alpha.15.tgz#e4021e6a432e906678dfc6cc89805ba3234f9f48"
944-
dependencies:
945-
esutils "^2.0.2"
946-
lodash "^4.2.0"
947-
to-fast-properties "^1.0.1"
948-
949955
babylon@^6.17.2, babylon@^6.17.4:
950956
version "6.17.4"
951957
resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.17.4.tgz#3e8b7402b88d22c3423e137a1577883b15ff869a"
@@ -954,10 +960,6 @@ babylon@^6.18.0:
954960
version "6.18.0"
955961
resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3"
956962

957-
babylon@^7.0.0-beta.18:
958-
version "7.0.0-beta.26"
959-
resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.26.tgz#afc2c6b86113d000cc9476fd6f73e2a9223de8f7"
960-
961963
balanced-match@^0.4.2:
962964
version "0.4.2"
963965
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838"
@@ -2793,6 +2795,11 @@ lodash@^4.14.0, lodash@^4.17.4, lodash@^4.2.0:
27932795
version "4.17.13"
27942796
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.13.tgz#0bdc3a6adc873d2f4e0c4bac285df91b64fc7b93"
27952797

2798+
lodash@^4.17.13:
2799+
version "4.17.15"
2800+
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
2801+
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
2802+
27962803
longest@^1.0.1:
27972804
version "1.0.1"
27982805
resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"
@@ -4175,6 +4182,11 @@ to-fast-properties@^1.0.1, to-fast-properties@^1.0.3:
41754182
version "1.0.3"
41764183
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47"
41774184

4185+
to-fast-properties@^2.0.0:
4186+
version "2.0.0"
4187+
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e"
4188+
integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=
4189+
41784190
tough-cookie@^2.3.2, tough-cookie@~2.3.0:
41794191
version "2.3.4"
41804192
resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.4.tgz#ec60cee38ac675063ffc97a5c18970578ee83655"

0 commit comments

Comments
 (0)