Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vite-plugin-live-reload

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-live-reload - npm Package Compare versions

Comparing version 0.1.2 to 2.0.0-beta.0

31

dist/index.js

@@ -5,23 +5,22 @@ 'use strict';

var chokidar2 = require('chokidar');
var chalk2 = require('chalk');
var chokidar = require('chokidar');
var chalk = require('chalk');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var chokidar2__default = /*#__PURE__*/_interopDefaultLegacy(chokidar2);
var chalk2__default = /*#__PURE__*/_interopDefaultLegacy(chalk2);
var chokidar__default = /*#__PURE__*/_interopDefaultLegacy(chokidar);
var chalk__default = /*#__PURE__*/_interopDefaultLegacy(chalk);
var index = (paths, config = {}) => ({
configureServer: [
({watcher, config: {root}}) => {
const reload = (path, action) => {
var _a;
watcher.send({type: "full-reload", path});
if ((_a = config.log) != null ? _a : true) {
console.log(chalk2__default['default'].green(`[vite-live-reload] `) + `${path} ${action}.`);
}
};
chokidar2__default['default'].watch(paths, {cwd: root, ignoreInitial: true, ...config}).on("add", (path) => reload(path, "added")).on("change", (path) => reload(path, "changed"));
}
]
name: "vite-plugin-live-reload",
configureServer({ws, config: {root}}) {
const reload = (path, action) => {
var _a;
ws.send({type: "full-reload", path});
if ((_a = config.log) != null ? _a : true) {
console.log(chalk__default['default'].green(`[vite-live-reload] `) + `${path} ${action}.`);
}
};
chokidar__default['default'].watch(paths, {cwd: root, ignoreInitial: true, ...config}).on("add", (path) => reload(path, "added")).on("change", (path) => reload(path, "changed"));
}
});

@@ -28,0 +27,0 @@

{
"name": "vite-plugin-live-reload",
"version": "0.1.2",
"version": "2.0.0-beta.0",
"description": "A *very* simple live reloading plugin for vite.",

@@ -26,15 +26,15 @@ "main": "dist/index.js",

"homepage": "https://github.com/arnoson/vite-plugin-live-reload#readme",
"peerDependencies": {
"chokidar": "*",
"chalk": "*"
},
"devDependencies": {
"esbuild": "^0.8.22",
"rollup": "^2.34.2",
"@types/node": "^14.14.20",
"esbuild": "^0.8.31",
"rollup": "^2.36.1",
"rollup-plugin-dts": "^2.0.1",
"rollup-plugin-esbuild": "^2.6.1",
"typescript": "^4.1.3",
"vite": "^1.0.0-rc.13"
"vite": "^2.0.0-beta.27"
},
"dependencies": {}
"dependencies": {
"chalk": "^4.1.0",
"chokidar": "^3.5.0"
}
}

@@ -6,2 +6,4 @@ # vite-plugin-live-reload

I use this configuration when working with [Kirby CMS](https://getkirby.com/) (assuming your Kirby site is inside a `public` folder).
Note: the paths you are watching are relative to vite's root folder.
```js

@@ -8,0 +10,0 @@ // vite.config.js

@@ -1,3 +0,3 @@

import { Plugin } from 'vite'
import chokidar, { WatchOptions} from 'chokidar'
import { Plugin, ViteDevServer } from 'vite'
import chokidar, { WatchOptions } from 'chokidar'
import chalk from 'chalk'

@@ -20,19 +20,16 @@

): Plugin => ({
configureServer: [
({ watcher, config: { root } }) => {
const reload = (path: string, action: string) => {
// We utilize the `send()` method of the `watcher` instance. I'm not
// sure if this is the correct way to send messages to the client but it
// works great.
watcher.send({ type: 'full-reload', path })
if (config.log ?? true) {
console.log(chalk.green(`[vite-live-reload] `) + `${path} ${action}.`)
}
name: 'vite-plugin-live-reload',
configureServer({ ws, config: { root } }: ViteDevServer) {
const reload = (path: string, action: string) => {
ws.send({ type: 'full-reload', path })
if (config.log ?? true) {
console.log(chalk.green(`[vite-live-reload] `) + `${path} ${action}.`)
}
chokidar
.watch(paths, { cwd: root, ignoreInitial: true, ...config })
.on('add', path => reload(path, 'added'))
.on('change', path => reload(path, 'changed'))
}
]
chokidar
.watch(paths, { cwd: root, ignoreInitial: true, ...config })
.on('add', path => reload(path, 'added'))
.on('change', path => reload(path, 'changed'))
}
})

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc