Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(core): update deps and fix a potential vuln #57

Merged
merged 3 commits into from
Nov 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,977 changes: 2,596 additions & 2,381 deletions package-lock.json

Large diffs are not rendered by default.

30 changes: 16 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"pretest": "run-s build:lib:clean pretest:link",
"pretest:link": "node scripts/link-src.js",
"test": "nyc mocha -R spec",
"posttest": "eslint src test"
"posttest": "eslint src test",
"update": "updtr"
},
"keywords": [
"domain",
Expand All @@ -35,23 +36,24 @@
"author": "peerigon <developers@peerigon.com>",
"license": "Unlicense",
"dependencies": {
"chai": "^4.1.2",
"got": "^8.0.1",
"chai": "^4.2.0",
"got": "^8.3.2",
"mkdirp": "^0.5.1",
"mocha": "^4.0.1"
"mocha": "^5.2.0"
},
"devDependencies": {
"@babel/cli": "7.0.0",
"@babel/core": "7.0.0",
"@babel/preset-env": "7.0.0",
"eslint": "^4.12.1",
"eslint-config-peerigon": "^12.0.1",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsdoc": "^3.2.0",
"npm-run-all": "^4.1.3",
"nyc": "^11.3.0",
"@babel/cli": "^7.1.5",
"@babel/core": "^7.1.6",
"@babel/preset-env": "^7.1.6",
"eslint": "^5.9.0",
"eslint-config-peerigon": "^15.0.2",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsdoc": "^3.9.1",
"npm-run-all": "^4.1.5",
"nyc": "^13.1.0",
"rimraf": "^2.6.2",
"standard-version": "^4.2.0"
"standard-version": "^4.4.0",
"updtr": "^3.1.0"
},
"files": [
"lib",
Expand Down
2 changes: 1 addition & 1 deletion src/normalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ function normalizeOptions(options) {
}

exports.url = normalizeUrl;
exports.options = normalizeOptions;
exports.options = normalizeOptions;
6 changes: 4 additions & 2 deletions src/parseDomain.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"use strict";

const normalize = require("./normalize.js");
const lookUp = require("./tries/lookUp");
const icannTrie = require("../lists/icann.complete");
const privateTrie = require("../lists/private.complete");
const normalize = require("./normalize.js");
const lookUp = require("./tries/lookUp");

// eslint-disable-next-line
const urlParts = /^(:?\/\/|https?:\/\/)?([^/]*@)?(.+?)(:\d{2,5})?([/?].*)?$/; // 1 = protocol, 2 = auth, 3 = domain, 4 = port, 5 = path
const dot = /\./g;
const emptyArr = [];
Expand Down Expand Up @@ -33,6 +34,7 @@ function matchTld(domain, options) {
return null;
}

/* eslint-disable jsdoc/no-undefined-types */
/**
* Removes all unnecessary parts of the domain (e.g. protocol, auth, port, path, query)
* and parses the remaining domain. The returned object contains the properties 'subdomain', 'domain' and 'tld'.
Expand Down
4 changes: 2 additions & 2 deletions src/tries/parsePubSuffixList.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ function parsePubSuffixList(listContent) {
const end = listContent.indexOf(list.markers.end);

if (start === -1) {
throw new Error(`Missing start marker of ${ list.name } list`);
throw new Error(`Missing start marker of ${list.name} list`);
}
if (end === -1) {
throw new Error(`Missing end marker of ${ list.name } list`);
throw new Error(`Missing end marker of ${list.name} list`);
}

return listContent.slice(start, end);
Expand Down
2 changes: 1 addition & 1 deletion src/tries/separators.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ module.exports = {
SAME: ",", // same level
DOWN: ">", // one level down
RESET: "|", // reset level index and start new
};
};
4 changes: 2 additions & 2 deletions src/tries/serializeTrie.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ function serializeTrie(parsedList, type) {

if (POSSIBLE_TYPES.indexOf(type) === -1) {
throw new Error(
`Cannot serialize trie: Unknown trie type "${ type }". Expected type to be one of ${ POSSIBLE_TYPES.map(
`Cannot serialize trie: Unknown trie type "${type}". Expected type to be one of ${POSSIBLE_TYPES.map(
JSON.stringify
).join(", ") }`
).join(", ")}`
);
}

Expand Down
6 changes: 3 additions & 3 deletions test/parseDomain.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ describe("parseDomain(url)", () => {
});

it("should include private tlds", () => {
expect(parseDomain("foo.blogspot.com", { privateTlds: true })).to.eql({
expect(parseDomain("foo.blogspot.com", {privateTlds: true})).to.eql({
subdomain: "",
domain: "foo",
tld: "blogspot.com",
Expand Down Expand Up @@ -153,7 +153,7 @@ describe("parseDomain(url)", () => {
});

it("should work with custom top-level domains (eg .local)", () => {
const options = { customTlds: ["local"] };
const options = {customTlds: ["local"]};

expect(parseDomain("mymachine.local", options)).to.eql({
subdomain: "",
Expand All @@ -171,7 +171,7 @@ describe("parseDomain(url)", () => {
});

it("should also work with custom top-level domains passed as regexps", () => {
const options = { customTlds: /(\.local|localhost)$/ };
const options = {customTlds: /(\.local|localhost)$/};

expect(parseDomain("mymachine.local", options)).to.eql({
subdomain: "",
Expand Down
2 changes: 1 addition & 1 deletion test/snapshots.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe("snapshots", () => {
const hostname = testArgs[0];
const expectedResult = testArgs[1];

it(`'${ hostname }' returns ${ expectedResult }`, () => {
it(`'${hostname}' returns ${expectedResult}`, () => {
expect(lookUp(parsedTrie, hostname)).to.equal(expectedResult);
});
});
Expand Down
16 changes: 8 additions & 8 deletions test/tries/serializeTrie.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ describe("serializeTrie()", () => {
// This example is from the private domains list.
// They are without the company domain (.ua in this case)
[["cc.ua", "inf.ua", "ltd.ua"], "ua>cc,inf,ltd"],
].forEach((args) => {
].forEach(args => {
const parsedList = args[0];
const expectedString = args[1];

it(`maps ${ JSON.stringify(parsedList) } on ${ JSON.stringify(expectedString) }`, () => {
it(`maps ${JSON.stringify(parsedList)} on ${JSON.stringify(expectedString)}`, () => {
expect(serializeTrie(parsedList)).to.equal(expectedString);
});
});

describe(`type ${ serializeTrie.TYPE_LIGHT }`, () => {
describe(`type ${serializeTrie.TYPE_LIGHT}`, () => {
const type = serializeTrie.TYPE_LIGHT;

[
Expand All @@ -53,17 +53,17 @@ describe("serializeTrie()", () => {
// Real-world use cases
[["com", "de", "uk", "co.uk"], "uk>co"],
[["jp", "岐阜.jp", "静岡.jp", "موقع"], "jp>岐阜,静岡"],
].forEach((args) => {
].forEach(args => {
const parsedList = args[0];
const expectedString = args[1];

it(`maps ${ JSON.stringify(parsedList) } on ${ JSON.stringify(expectedString) }`, () => {
it(`maps ${JSON.stringify(parsedList)} on ${JSON.stringify(expectedString)}`, () => {
expect(serializeTrie(parsedList, type)).to.equal(expectedString);
});
});
});

describe(`type ${ serializeTrie.TYPE_COMPLETE }`, () => {
describe(`type ${serializeTrie.TYPE_COMPLETE}`, () => {
const type = serializeTrie.TYPE_COMPLETE;

[
Expand All @@ -78,11 +78,11 @@ describe("serializeTrie()", () => {
[["pl", "gov.pl", "ap.gov.pl", "net.pl"], "pl>gov>ap<net"],
[["pl", "gov.pl", "ap.gov.pl", "uk", "ac.uk", "co.uk"], "pl>gov>ap|uk>ac,co"],
[["jp", "岐阜.jp", "静岡.jp", "موقع"], "jp>岐阜,静岡|موقع"],
].forEach((args) => {
].forEach(args => {
const parsedList = args[0];
const expectedString = args[1];

it(`maps ${ JSON.stringify(parsedList) } on ${ JSON.stringify(expectedString) }`, () => {
it(`maps ${JSON.stringify(parsedList)} on ${JSON.stringify(expectedString)}`, () => {
expect(serializeTrie(parsedList, type)).to.equal(expectedString);
});
});
Expand Down