Skip to content

Commit

Permalink
v3.0 (#318)
Browse files Browse the repository at this point in the history
* Initial configuration update for v3.0

- Moving away from gulp
- Standalone rollup and mocha config
- Use rollup/terser dependencies

* Internal refactors

- Renamed state machine methods (these will likely be replaced very
  shortly)
- Restructured core directory structure
- Refactored tests so that calling the plugin after import is no longer
  required
- New internal TLDs
- simple-html-tokenizer may now be required from the node modules

* Second pass OOP-free refactor with tests

Not working yet, the parser tests are not running properly

* Fastest working implementation without pre-build step

Use class-based State struct, hash lookup states instead of array iteration. Still 30ms though for a correct implementation though :(

* Update benchmarks

* Working default regex scanner/token implementation

Supports IDN and speeds up initialization!

* Emoji IDN support

!!!

* Cleanup scanner and TLDs

* Implement delayed initialization

This further reduces plugin initial startup time, delaying the cost to
when linkify is first executed on some text (though that cost has
already been reduced 4x in previous commits; it's now ~5-7ms on my
machine)

Including delayed plugin initialization for hashtag

* Fix plugin implementations

Including auto-register

* core-js based linkify polyfill

* Interfaces and options fixes

All mocha tests on node are now passing

* Fixed public interface

* Config updates

* Initial v3 changelog

* Update CHANGELOG.md

* Additional lint fixes

* Use self-published linkify-html

* Tweak test runner

* Fix Qunit tests

* Bump version, update packages

Including additional publish ignores and scripts

* WIP README and CHANGELOG

* chore: typo in CHANGELOG.md (#320)

* Add start and end index for where tokens are found

Fixes #234

* Oops fixed interface import statements

* Update CHANGELOG.md

* v3.0.0-beta.2

* Handle HTML with doctype

Fixes #313

* Ensure doesn't crash on mixed-language input

Fixes #293

* Don't recognize strings that start with // valid URLs

* Support for custom protocols

That was easy

* Update changelog

* v3.0.0-beta.3

* Fix punctuation/spelling

* Support emails with apostrophe

Fixes #250

* Expose additional printable characters as scanner tokens

For easier integration with custom protocols'

* Test fixes

* Install request module

Required by jsdom apparently

* Oops fix incorrect test run flag

* Additional CI script fixes

* Change prepare script to prepack

Don't need to build/publish on CI

* Attempt coveralls fix

* Do build when doing running test suite

So that browser tests get properly run

* Remove unnecessary copyfiles

* Drop Node 8 support

Dependencies no longer support it

* Refactor linkify into multi-package monorepo

To allow easier opt in/out for features you want. Especially for React,
jQuery and future interfaces

* Refactor String -> Array conversion to avoid need for polyfill

* Fix typo in test run bash file

* Fix linting rules

* Fix test require issue

* Manual workspace setup in CI

* Special build command for CI

That doesn't use workspaces

* Remove now-unnecessary helper files

* Remove additional polyfill references

* Various typo and text fixes

* Fix bug with heart emojis

* Cache addition to .gitignore

* Upgrade deps

* Replace SauceLabs with BrowserStack

Also update jQuery/React version matrices

* Complete v3.0 testing fixes and integration

Fix test run line

Bump latest node version back to 16

Attempt different run test strategy

Maybe this one won't fail

CI test run fixes

Fix incorrect npm script definition

Another test fix attempt

Attempt fix failing tests with sleep

Fix conditional bash statements

Should be final round of test fixes

Add BrowserStack + Coverage

Final fixes for coverage and browserstack

Tweaked browser CI config

Add status badges

* Implement react component as regular function

* Auto-generate typescript declarations

* Fix react test

* Bring back React span wrapper for React 15

Drop support for older versions

* Final or near-final draft of README and CHANGELOG

* README files for sub-packages

* Add additional CHANGELOG item

Co-authored-by: Jacek Karczmarczyk <[email protected]>
  • Loading branch information
Nick Frasser and jacekkarczmarczyk authored Sep 15, 2021
1 parent f7c140a commit 70c6e0e
Show file tree
Hide file tree
Showing 187 changed files with 17,627 additions and 13,977 deletions.
6 changes: 0 additions & 6 deletions .babelrc

This file was deleted.

8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,11 @@ insert_final_newline = true
[*.yml]
indent_style = space
tab_width = 2

[*.md]
indent_style = space
tab_width = 2

[package.json]
indent_style = space
tab_width = 2
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*/lib/*
*/dist/*

# Usually auto-generated
**/index.js
28 changes: 13 additions & 15 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
{
"extends": [
"eslint:recommended"
"eslint:recommended",
"plugin:mocha/recommended"
],
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"parser": "@babel/eslint-parser",
"env": {
"browser": true,
"node": true,
"jquery": true,
"es6": true,
"amd": true
"amd": true,
"mocha": true
},
"rules": {
"curly": 2,
"eqeqeq": 2,
"no-eq-null": 2,
"quotes": [2, "single", "avoid-escape"],
"semi": 2
"semi": 2,
"no-unused-vars": [ "error", { "varsIgnorePattern": "should|expect" }],
"mocha/no-mocha-arrows": 0
},
"plugins": [
"mocha",
"@babel"
],
"globals": {
"__base": false,
"__TLDS__": false,
"after": false,
"afterEach": false,
"before": false,
"beforeEach": false,
"expect": false,
"describe": false,
"it": false
"expect": false
}
}
13 changes: 11 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Node.js CI
name: Continuous Integration

on:
push:
Expand Down Expand Up @@ -38,4 +38,13 @@ jobs:

- run: npm install
- run: bash test/setup.sh ${{ matrix.node-version }}
- run: bash run-tests.sh ${{ matrix.node-version }}
- run: bash test/run.sh ${{ matrix.node-version }}
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}

- name: Coveralls GitHub Action
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ build
dist
lib
vendor
*.tar.gz
*.tgz

# IntelliJ
.idea
Expand All @@ -52,6 +54,10 @@ vendor

# Specific to plugin website branch
.sass-cache
.jekyll-cache
_site
_sass
js

# Generated typescript declarations
*.d.ts
1 change: 1 addition & 0 deletions .mocharc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require: '@babel/register'
13 changes: 9 additions & 4 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@ test
vendor

# Files
.babelrc
*.md
*.yml
*.tar.gz
*.tgz
.tags*
.babelrc*
.eslintrc*
.editorconfig
.eslintrc
.travis.yml
bower.json
gulpfile.js
testem.json
run-tests.sh
*.config.js*
tasks
88 changes: 69 additions & 19 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,73 @@
# Linkify Changelog

### v2.1.9
## v3.0.0

### BREAKING CHANGES
* React, jQuery and Element interfaces moved to dedicated packages at `linkify-react`,`linkify-jquery` and `linkify-element` respectively:
* Remove default `class="linkified"` from all discovered links. Opt back in by setting the `className` option:
```js
linkifyStr(str, { className: 'linkified' })
```
* Remove default `target="_blank"` attribute for discovered URLs. Opt back in by setting the `target` option:
```js
linkifyHtml(str, {
target: (href, type) => type === 'url' && '_blank'
})
```
* React component: Remove outer `<span>` tag wrapper in favour of tag-less `React.Fragment` for React >=16. To opt back-in, set `tagName='span'`:
```jsx
<Linkify tagName='span'>{content}</Linkify>
```
* AMD module interface is no longer provided. Use an ESM bundler instead.
* Plugins imported after linkify is called on a string for the first time will not longer work. Import all plugins _before_ calling a linkify core or interface function.
* Custom plugin API is not compatible with previous API in Linkify v2
* Dropped support for Internet Explorer versions 9 and 10. IE11 is still supported
* Dropped support for React versions <15

### Deprecations
* Use dedicated packages `linkify-string` and `linkify-html` instead of `linkifyjs/string` and `linkifyjs/html`. The embedded packages will be removed in v4.0
* Use dedicated plugin packages `linkify-plugin-[PLUGIN]` instead of `linkifyjs/plugin/[PLUGIN]`. The embedded packages will be removed in v4.0

### All Changes
* Full Internationalized Domain (IDN) and Emoji domain support 🇺🇳🌍✈️🎉💃! Detect URLs, #hashtags and @mentions in any language
* ~10x faster startup; ~4x faster combined startup + first run
* Custom protocols with `linkify.registerCustomProtocol('protocol')`
* Modernized codebase and build system
* Add new `rel` option at top level as an alternate way of including it in `attributes`
* New and improved plugin API
* TypeScript definitions included in published packages
* `linkify.find()` output includes start and end indexes for where in the string a link was found
* Plugins no longer need to be called on linkify after import
```js
// Before
import * as linkify from 'linkifyjs'
import hashtag from 'linkifyjs/plugins/hashtag'
hashtag(linkify)

// After
import * as linkify from 'linkifyjs'
import 'linkifyjs/plugins/hashtag'
```


## v2.1.9

* Move optional dependencies to peerdependencies (#282)
* Fix `npm install` displays vulnerabilities. (#265)
* Fix typo (#275)

### v2.1.8
## v2.1.8

* Allow mentions with inner @ sign for federated mentions - thanks @juliushaertl!
* Drop official support for Internet Explorer 8 and Node.js 6 (still supported unofficially but may break in future releases)
* Update dev dependencies

### v2.1.7
## v2.1.7

* Update dependencies (#243)
* Ignore .babelrc file (854e6fc)

### v2.1.6
## v2.1.6

* Fix a bug where unique element IDs aren't unique (#215)
* Update tlds.js (#213)
Expand All @@ -26,11 +76,11 @@
* Use Object.defineProperty to extend String prototype so that 'linkify' function is not enumerable (#197)
* Allow null overrides in options for target and className (#189)

### v2.1.5
## v2.1.5

* React plugin compatibility updates

### v2.1.4
## v2.1.4

* Add explicit support for mailto: addresses (#186)
* Add support for mentions containing dots (#185)
Expand All @@ -39,29 +89,29 @@
* Drop deprecated babel-preset-es2015-loose dependency (#172)
* Web workers support (#168)

### v2.1.3
## v2.1.3

* Links in angle brackets (#166)

### v2.1.2
## v2.1.2

* Single quotes should be treated as punctuation (#165)

### v2.1.1
## v2.1.1

* Detect additional whitespace characters (#163)

### v2.1.0
## v2.1.0

#### BREAKING CHANGES
### BREAKING CHANGES

* The `dist/jquery.linkify.js` 1.x legacy browser files have been permanently
removed from the release bundle.
* Use `linkify.js` and `linkify-jquery.js` instead.
* The deprecated `newLine` option from linkify 1.x has been completely removed.
* Use the [`nl2br` option](http://soapbox.github.io/linkifyjs/docs/options.html#nl2br) instead.

#### Features
### Features

* [New React.js interface](http://soapbox.github.io/linkifyjs/docs/linkify-react.html)
* [@mention plugin](http://soapbox.github.io/linkifyjs/docs/plugin-mention.html)
Expand All @@ -70,7 +120,7 @@ removed from the release bundle.
* Options that take functions with value and type arguments can now be
specified as objects, where each key is the target link type.

#### Deprecations
### Deprecations

* The `linkAttributes` option is deprecated in favour of just **`attributes`**.
* The `linkClass` option is deprecated in favour of **`className`**.
Expand All @@ -80,7 +130,7 @@ in a future release.
To maintain compatibility with versions >= 2.1, make sure options objects
include these properties instead of `linkAttributes` and `linkClass`

#### All Changes
### All Changes

* Build optimizations to make compiled AMD payload smaller
* Bugfix in quick-es3 task
Expand All @@ -92,29 +142,29 @@ include these properties instead of `linkAttributes` and `linkClass`
* Linkify React Interface (#150)
* Development upgrades (#153)

### v2.0.5
## v2.0.5

* Correct trailing symbol parsing (#149)
* Linkify element fixes (#148)

### v2.0.4
## v2.0.4

* Optimize class code to reduce file size (#147).
* Update test and dev dependencies
* Allow uglify to mangle properties, except for the specified ones (#146)
* Updated tlds.js (#121)

### v2.0.3
## v2.0.3

* Fixing element interface invalid DOM node error (#141)

### v2.0.1
## v2.0.1

* Updated build system and development dependencies
* IE8 Support
* Internal API updates

### v2.0.0
## v2.0.0

* New link-detection technique based on lexicographical analysis via two-stage scanner - essentially regexp with more flexibility.
* Faster, less destructive DOM manipulation.
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## How linkify works

_TODO: Insert diagram here_
<!-- TODO: Insert diagram here -->

Linkify uses a two stage lexicographical analysis to detect patterns in plain text.

Expand Down
Loading

0 comments on commit 70c6e0e

Please sign in to comment.