Skip to content

Commit 2e7a8b1

Browse files
authored
refactor: use localhost-url-regex (#299)
instead of is-localhost-url since it's deprecated
1 parent 1656b26 commit 2e7a8b1

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

packages/hover-vanilla/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
],
2828
"dependencies": {
2929
"@microlink/hover-react": "^5.5.14",
30-
"is-localhost-url": "~1.0.3"
30+
"localhost-url-regex": "~1.0.4"
3131
},
3232
"devDependencies": {
3333
"@rollup/plugin-commonjs": "latest",

packages/hover-vanilla/src/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import React from 'react'
2-
import ReactDOM from 'react-dom'
3-
import styled from 'styled-components'
41
import MicrolinkHover from '@microlink/hover-react'
5-
import isLocalhostUrl from 'is-localhost-url'
2+
import localhostUrl from 'localhost-url-regex'
3+
import styled from 'styled-components'
4+
import ReactDOM from 'react-dom'
5+
import React from 'react'
66

77
function toArray (selector) {
88
const collection = Array.from(
@@ -16,7 +16,7 @@ function toArray (selector) {
1616
el.href = new URL(el.href).toString()
1717
return el
1818
})
19-
.filter(el => el.href.startsWith('http') && !isLocalhostUrl(el.href))
19+
.filter(el => el.href.startsWith('http') && !localhostUrl().test(el.href))
2020
}
2121

2222
function parseJSON (value) {

packages/react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
],
2626
"dependencies": {
2727
"@microlink/mql": "~0.10.30",
28-
"is-localhost-url": "~1.0.3",
28+
"localhost-url-regex": "~1.0.4",
2929
"nanoclamp": "~2.0.4"
3030
},
3131
"devDependencies": {

packages/react/src/utils/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { fetchFromApi, getApiUrl as createApiUrl } from '@microlink/mql'
2-
import isLocalhostUrl from 'is-localhost-url'
2+
import localhostUrl from 'localhost-url-regex'
33
import { css } from 'styled-components'
44

55
export const isSSR = typeof window === 'undefined'
@@ -81,7 +81,7 @@ export const isLarge = cardSize => cardSize === 'large'
8181
export const isSmall = cardSize => cardSize === 'small'
8282

8383
export const imageProxy = url =>
84-
isLocalhostUrl(url)
84+
localhostUrl().test(url)
8585
? url
8686
: `https://images.weserv.nl/?${new URLSearchParams({
8787
url,

0 commit comments

Comments
 (0)