-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f48c0e0
commit bb2759f
Showing
6 changed files
with
78 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
interface linkMatcher { | ||
regex: RegExp; | ||
matchIndex: number; | ||
} | ||
|
||
// Based on the regex used in xterm-addon-web-links | ||
export const URLMatcher: linkMatcher = (() => { | ||
const protocolClause = '(https?:\\/\\/)'; | ||
const domainCharacterSet = '[\\da-z\\.-]+'; | ||
const negatedDomainCharacterSet = '[^\\da-z\\.-]+'; | ||
const domainBodyClause = '(' + domainCharacterSet + ')'; | ||
const tldClause = '([a-z\\.]{2,6})'; | ||
const ipClause = '((\\d{1,3}\\.){3}\\d{1,3})'; | ||
const localHostClause = '(localhost)'; | ||
const portClause = '(:\\d{1,5})'; | ||
const hostClause = | ||
'((' + domainBodyClause + '\\.' + tldClause + ')|' + ipClause + '|' + localHostClause + ')' + portClause + '?'; | ||
const pathCharacterSet = '(\\/[\\/\\w\\.\\-%~:+@]*)*([^:"\'\\s])'; | ||
const pathClause = '(' + pathCharacterSet + ')?'; | ||
const queryStringHashFragmentCharacterSet = "[0-9\\w\\[\\]\\(\\)\\/\\?\\!#@$%&'*+,:;~\\=\\.\\-]*"; | ||
const queryStringClause = '(\\?' + queryStringHashFragmentCharacterSet + ')?'; | ||
const hashFragmentClause = '(#' + queryStringHashFragmentCharacterSet + ')?'; | ||
const negatedPathCharacterSet = '[^\\/\\w\\.\\-%]+'; | ||
const bodyClause = hostClause + pathClause + queryStringClause + hashFragmentClause; | ||
const start = '(?:^|' + negatedDomainCharacterSet + ')('; | ||
const end = ')($|' + negatedPathCharacterSet + ')'; | ||
return {regex: new RegExp(start + protocolClause + bodyClause + end), matchIndex: 1}; | ||
})(); | ||
|
||
// Simple file url matcher | ||
export const FileURLMatcher: linkMatcher = (() => { | ||
const protocolClause = '(file:\\/\\/)'; | ||
const negatedDomainCharacterSet = '[^\\da-z\\.-]+'; | ||
const pathCharacterSet = '(\\/[\\/\\w\\.\\-%~:+@]*)*([^:"\'\\s])'; | ||
const pathClause = '(' + pathCharacterSet + ')'; | ||
const negatedPathCharacterSet = '[^\\/\\w\\.\\-%]+'; | ||
const bodyClause = pathClause; | ||
const start = '(?:^|' + negatedDomainCharacterSet + ')('; | ||
const end = ')($|' + negatedPathCharacterSet + ')'; | ||
return {regex: new RegExp(start + protocolClause + bodyClause + end), matchIndex: 1}; | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7741,21 +7741,28 @@ [email protected]: | |
resolved "https://registry.npmjs.org/xterm-addon-unicode11/-/xterm-addon-unicode11-0.5.0.tgz#41c0d96acc1e3bb6c6596eee64e163b6bca74be7" | ||
integrity sha512-Jm4/g4QiTxiKiTbYICQgC791ubhIZyoIwxAIgOW8z8HWFNY+lwk+dwaKEaEeGBfM48Vk8fklsUW9u/PlenYEBg== | ||
|
||
[email protected]: | ||
version "0.8.0" | ||
resolved "https://registry.npmjs.org/xterm-addon-web-links/-/xterm-addon-web-links-0.8.0.tgz#2cb1d57129271022569208578b0bf4774e7e6ea9" | ||
integrity sha512-J4tKngmIu20ytX9SEJjAP3UGksah7iALqBtfTwT9ZnmFHVplCumYQsUJfKuS+JwMhjsjH61YXfndenLNvjRrEw== | ||
|
||
[email protected]: | ||
version "0.15.0" | ||
resolved "https://registry.npmjs.org/xterm-addon-webgl/-/xterm-addon-webgl-0.15.0.tgz#c10f93ca619524f5a470eaac44258bab0ae8e3c7" | ||
integrity sha512-ZLcqogMFHr4g/YRhcCh3xE8tTklnyut/M+O/XhVsFBRB/YCvYhPdLQ5/AQk54V0wjWAQpa8CF3W8DVR9OqyMCg== | ||
|
||
[email protected]: | ||
version "1.3.1" | ||
resolved "https://registry.npmjs.org/xterm-link-provider/-/xterm-link-provider-1.3.1.tgz#69727223220dfa8758056ad6b2b5394a8454b9cb" | ||
integrity sha512-uOlaIeUED6kJeL2nIIf5YwreO0obMhsC0RWypEUmWkz7SAQewzgwdWFjQ2He7NGcT93c4KUf8bRgAu8cV9bAYA== | ||
dependencies: | ||
xterm "^4.6.0" | ||
|
||
[email protected]: | ||
version "5.2.1" | ||
resolved "https://registry.npmjs.org/xterm/-/xterm-5.2.1.tgz#b3fea7bdb55b9be1d4b31f4cd1091f26ac42afb8" | ||
integrity sha512-cs5Y1fFevgcdoh2hJROMVIWwoBHD80P1fIP79gopLHJIE4kTzzblanoivxTiQ4+92YM9IxS36H1q0MxIJXQBcA== | ||
|
||
xterm@^4.6.0: | ||
version "4.14.1" | ||
resolved "https://registry.npmjs.org/xterm/-/xterm-4.14.1.tgz#6884cb8fb3b83353b1a98139ea23daedf8e35796" | ||
integrity sha512-jgzNg5BuGPwq5/M4dGnmbghZvHx2jaj+9crSEt15bV34Za49VziBmCu7zIy88zUKKiGTxeo7aVzirFSJArIMFw== | ||
|
||
y18n@^5.0.5: | ||
version "5.0.5" | ||
resolved "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz#8769ec08d03b1ea2df2500acef561743bbb9ab18" | ||
|