Skip to content
Open
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
15 changes: 14 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
{
"presets": ["es2015", "babili"]
"presets": [
["@babel/preset-env", {
"modules": false
}]
],
"env": {
"production": {
"presets": [
["@babel/preset-env", {
"modules": "commonjs"
}]
]
}
}
}
21 changes: 21 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
env: {
browser: true,
es2021: true,
node: true
},
extends: [
'eslint:recommended',
'plugin:vue/essential'
],
parserOptions: {
ecmaVersion: 12,
sourceType: 'module'
},
plugins: [
'vue'
],
rules: {
}
}

39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Changelog

All notable changes to this project will be documented in this file.

## [2.0.0] - 2025-10-08

### Security
- **FIXED:** Updated `linkifyjs` from ^2.1.3 to ^4.1.3 to address security vulnerabilities
- **FIXED:** Resolved all dependabot security alerts
- **FIXED:** Updated Vue to support both Vue 2.7+ and Vue 3 (addressing Vue 2 ReDoS vulnerability)

### Changed
- **BREAKING:** Vue is now a peer dependency instead of a direct dependency
- **BREAKING:** Minimum Vue 2 version is now 2.7.0
- Added support for Vue 3 while maintaining Vue 2.7+ compatibility
- Updated directive implementation to support both Vue 2 and Vue 3 lifecycle hooks
- Migrated from Babel 6 to Babel 7
- Updated all dev dependencies to latest stable versions:
- Webpack 1.x → 5.x
- Karma 1.x → 6.x
- Mocha 3.x → 10.x
- ESLint 3.x → 8.x
- And many more...
- Replaced deprecated PhantomJS with ChromeHeadless for testing
- Updated test suite to work with both Vue 2 and Vue 3

### Added
- Babel configuration file (.babelrc) for modern ES6+ transpilation
- Updated ESLint configuration for modern JavaScript
- Comprehensive documentation for Vue 2 and Vue 3 usage in README

### Removed
- Removed Vue from direct dependencies (now peer dependency)
- Removed outdated babel-preset-babili
- Removed deprecated phantomjs-prebuilt

## [1.0.1] - Original Release
- Initial release with Vue 2.1.6 and linkifyjs 2.1.3

81 changes: 81 additions & 0 deletions PR_DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Security fixes and Vue 3 support

## Summary
This PR addresses critical security vulnerabilities and adds Vue 3 support while maintaining backward compatibility with Vue 2.7+. All dependencies have been modernized and the package is now properly bundled for use in any environment.

## Security Fixes
- ✅ Updated `linkifyjs` from 2.1.3 to 4.1.3 (addresses multiple security vulnerabilities)
- ✅ Updated `linkify-html` to 4.3.2 (separate package in v4.x)
- ✅ Fixed all dependabot security alerts (0 vulnerabilities remaining)
- ✅ Resolved ReDoS vulnerability in Vue 2 by supporting Vue 3 and requiring Vue 2.7+ minimum

## New Features
- ✅ Added Vue 3 support
- ✅ Maintained Vue 2.7+ backward compatibility
- ✅ Vue is now a peer dependency for better flexibility
- ✅ Added proper ES module default export
- ✅ Properly bundled with Webpack - no external dependencies needed at runtime

## Updated Dependencies

### Production
- `linkifyjs`: 2.1.3 → 4.3.2
- `linkify-html`: 4.3.2 (new, required by linkifyjs v4.x)
- Dependencies are now bundled into the output file

### Development (all updated to latest stable versions)
- Babel 6 → Babel 7 with @babel/preset-env
- Webpack 1.x → 5.x (now used for bundling instead of just Babel)
- ESLint 3.x → 8.x
- Karma 1.x → 6.x
- Mocha 3.x → 10.x
- Replaced deprecated PhantomJS with ChromeHeadless

## Code Changes
- Updated directive implementation with both Vue 2 and Vue 3 lifecycle hooks (`bind`/`update` for Vue 2, `mounted`/`updated` for Vue 3)
- Added proper ES module, CommonJS, AMD, and browser global exports via Webpack UMD build
- Fixed module resolution issues - linkifyjs is now bundled into the output
- Updated test suite for Vue 3 compatibility
- Configured Webpack to properly bundle all dependencies

## Build System
- Switched from Babel-only transpilation to Webpack bundling
- Created webpack.config.js for UMD build
- Output is now a single, self-contained bundle
- Supports all module systems: CommonJS, AMD, ES modules, and browser globals

## Documentation
- Updated README with usage examples for both Vue 2 and Vue 3
- Added CHANGELOG.md documenting all changes

## Testing
- ✅ Linting passes
- ✅ Build succeeds with Webpack
- ✅ No security vulnerabilities (npm audit shows 0 vulnerabilities)
- ✅ No module resolution errors

## Breaking Changes
- Vue is now a peer dependency (users must install Vue separately)
- Minimum Vue 2 version is now 2.7.0
- Package is now self-contained - linkifyjs is bundled (no need to install separately)

## Version History
- **v2.0.0**: Initial security updates and Vue 3 support
- **v2.0.1**: Fixed ES module default export issue
- **v2.0.2**: Fixed linkifyjs bundling - resolved "Could not resolve linkifyjs/html" error

## Note
This fork is published on npm as `vue-linkify-vue3` to avoid conflicts and is actively maintained at https://www.npmjs.com/package/vue-linkify-vue3

Users can install and use it immediately:
```bash
npm install vue-linkify-vue3
```

```js
import linkify from 'vue-linkify-vue3'
app.directive('linkified', linkify) // Vue 3
// or
Vue.directive('linkified', linkify) // Vue 2.7+
```

30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# vue-linkify [![Build Status](https://travis-ci.org/phanan/vue-linkify.svg?branch=master)](https://travis-ci.org/phanan/vue-linkify)
# vue-linkify

> A simple Vue directive to turn URL's and emails into clickable links. Based on SoapBox's [Linkify](https://github.com/SoapBox/linkifyjs).

**Note:** This is a maintained fork of the [original vue-linkify](https://github.com/phanan/vue-linkify) which is no longer maintained. This version includes updated dependencies, security fixes, and supports both Vue 2.7+ and Vue 3.

## Install

This directive can be installed as a module:

``` bash
$ npm install vue-linkify
$ npm install vue-linkify-vue3
```

or, if you're not in a module environment, just include it as a `<script>`.
Expand All @@ -16,7 +18,18 @@ or, if you're not in a module environment, just include it as a `<script>`.

In a browser environment, you should now have a `v-linkified` directive set up for free. If you're in a module environment, just `import` and register it as you please:

**For Vue 3:**
``` js
import { createApp } from 'vue'
import linkify from 'vue-linkify'

const app = createApp(App)
app.directive('linkified', linkify)
```

**For Vue 2:**
``` js
import Vue from 'vue'
import linkify from 'vue-linkify'

Vue.directive('linkified', linkify)
Expand Down Expand Up @@ -67,6 +80,17 @@ Hello from <a href="http://vuejs.org" class="foo" target="_blank">vuejs.org</a>

A list of available options is available [here](http://soapbox.github.io/linkifyjs/docs/options.html).

## Maintainer

This fork is maintained by **shekh**.

## Credits

Original package created by [Phan An](http://phanan.net).

## License

MIT &copy; [Phan An](http://phanan.net)
MIT

Original work &copy; [Phan An](http://phanan.net)
Modified work &copy; shekh
2 changes: 1 addition & 1 deletion dist/vue-linkify.min.js

Large diffs are not rendered by default.

32 changes: 20 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
/*global define*/
import linkify from 'linkifyjs/html'
import linkify from 'linkify-html'

(function () {
function install (el, binding) {
const linkifiedDirective = {
mounted(el, binding) {
el.innerHTML = linkify(el.innerHTML, binding.value)
},
updated(el, binding) {
el.innerHTML = linkify(el.innerHTML, binding.value)
},
// Vue 2 compatibility
bind(el, binding) {
el.innerHTML = linkify(el.innerHTML, binding.value)
},
update(el, binding) {
el.innerHTML = linkify(el.innerHTML, binding.value)
}
}

if (typeof exports === 'object') {
module.exports = install
} else if (typeof define === 'function' && define.amd) {
define([], function () { return install })
} else if (window.Vue) {
window.Vue.directive('linkified', install)
}
})()
// Browser global export
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.directive('linkified', linkifiedDirective)
}

export default linkifiedDirective
Loading