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: drop Node.js 8 #191

Merged
merged 3 commits into from
Apr 26, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 2 additions & 4 deletions lib/decode_url.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const { parse, URL } = require('url');
const { toUnicode } = require('punycode.js');
const { parse, format } = require('url');

const safeDecodeURI = str => {
try {
Expand All @@ -18,8 +17,7 @@ const decodeURL = str => {
// Exit if input is a data url
if (parsed.origin === 'null') return str;

// TODO: refactor to `url.format()` once Node 8 is dropped
const url = parsed.toString().replace(parsed.hostname, toUnicode(parsed.hostname));
const url = format(parsed, { unicode: true });
return safeDecodeURI(url);
}

Expand Down
6 changes: 2 additions & 4 deletions lib/encode_url.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const { toUnicode } = require('punycode.js');
const { parse, URL } = require('url');
const { parse, format } = require('url');

const safeDecodeURI = str => {
try {
Expand All @@ -20,8 +19,7 @@ const encodeURL = str => {

parsed.search = encodeURI(safeDecodeURI(parsed.search));
// preserve IDN
// TODO: refactor to url.format() once Node 8 EOL
return parsed.toString().replace(parsed.hostname, toUnicode(parsed.hostname));
return format(parsed, { unicode: true });
}

return encodeURI(safeDecodeURI(str));
Expand Down
2 changes: 1 addition & 1 deletion lib/full_url_for.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const { parse, URL } = require('url');
const { parse } = require('url');
const encodeURL = require('./encode_url');
const prettyUrls = require('./pretty_urls');

Expand Down
2 changes: 1 addition & 1 deletion lib/is_external_link.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const { parse, URL } = require('url');
const { parse } = require('url');

const Cache = require('./cache');
const cache = new Cache();
Expand Down
2 changes: 1 addition & 1 deletion lib/url_for.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const { parse, URL } = require('url');
const { parse } = require('url');
const encodeURL = require('./encode_url');
const relative_url = require('./relative_url');
const prettyUrls = require('./pretty_urls');
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,10 @@
"highlight.js": "^9.13.1",
"htmlparser2": "^4.0.0",
"prismjs": "^1.17.1",
"punycode.js": "^2.1.0",
"strip-indent": "^3.0.0",
"striptags": "^3.1.1"
},
"engines": {
"node": ">=8.6.0"
"node": ">=10.3.0"
}
}