diff --git a/.babelrc b/.babelrc index c1a6e38..480305e 100644 --- a/.babelrc +++ b/.babelrc @@ -1,3 +1,16 @@ { - "presets": ["es2015", "babili"] + "presets": [ + ["@babel/preset-env", { + "modules": false + }] + ], + "env": { + "production": { + "presets": [ + ["@babel/preset-env", { + "modules": "commonjs" + }] + ] + } + } } diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..4291656 --- /dev/null +++ b/.eslintrc.js @@ -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: { + } +} + diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..7f3919b --- /dev/null +++ b/CHANGELOG.md @@ -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 + diff --git a/PR_DESCRIPTION.md b/PR_DESCRIPTION.md new file mode 100644 index 0000000..0fbdf3e --- /dev/null +++ b/PR_DESCRIPTION.md @@ -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+ +``` + diff --git a/README.md b/README.md index bdec1a8..d8e20c0 100644 --- a/README.md +++ b/README.md @@ -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 `