vite-plugin-live-reload
Advanced tools
Comparing version 2.1.0 to 3.0.0
@@ -22,2 +22,2 @@ import { Plugin } from 'vite'; | ||
export default _default; | ||
export { _default as default }; |
@@ -1,34 +0,23 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var chokidar = require('chokidar'); | ||
var chalk = require('chalk'); | ||
var path = require('path'); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var chokidar__default = /*#__PURE__*/_interopDefaultLegacy(chokidar); | ||
var chalk__default = /*#__PURE__*/_interopDefaultLegacy(chalk); | ||
var path__default = /*#__PURE__*/_interopDefaultLegacy(path); | ||
// src/index.ts | ||
import chokidar from "chokidar"; | ||
import colors from "picocolors"; | ||
import path from "path"; | ||
function getShortName(file, root) { | ||
return file.startsWith(root + "/") ? path__default['default'].posix.relative(root, file) : file; | ||
return file.startsWith(root + "/") ? path.posix.relative(root, file) : file; | ||
} | ||
var index = (paths, config = {}) => ({ | ||
var src_default = (paths, config = {}) => ({ | ||
name: "vite-plugin-live-reload", | ||
configureServer({ws, config: {root: viteRoot, logger}}) { | ||
configureServer({ ws, config: { root: viteRoot, logger } }) { | ||
const root = config.root || viteRoot; | ||
const reload = (path2) => { | ||
var _a; | ||
ws.send({type: "full-reload", path: config.alwaysReload ? "*" : path2}); | ||
if ((_a = config.log) != null ? _a : true) { | ||
logger.info(chalk__default['default'].green(`page reload `) + chalk__default['default'].dim(getShortName(path2, root)), {clear: true, timestamp: true}); | ||
ws.send({ type: "full-reload", path: config.alwaysReload ? "*" : path2 }); | ||
if (config.log ?? true) { | ||
logger.info(colors.green(`page reload `) + colors.dim(getShortName(path2, root)), { clear: true, timestamp: true }); | ||
} | ||
}; | ||
chokidar__default['default'].watch(paths, {cwd: root, ignoreInitial: true, ...config}).on("add", reload).on("change", reload); | ||
chokidar.watch(paths, { cwd: root, ignoreInitial: true, ...config }).on("add", reload).on("change", reload); | ||
} | ||
}); | ||
exports.default = index; | ||
//# sourceMappingURL=index.js.map | ||
export { | ||
src_default as default | ||
}; |
{ | ||
"name": "vite-plugin-live-reload", | ||
"version": "2.1.0", | ||
"description": "A *very* simple live reloading plugin for vite.", | ||
"main": "dist/index.js", | ||
"version": "3.0.0", | ||
"description": "A simple live reloading plugin for vite.", | ||
"type": "module", | ||
"main": "dist/index.cjs", | ||
"module": "dist/index.js", | ||
"exports": { | ||
".": { | ||
"import": "./dist/index.js", | ||
"require": "./dist/index.cjs" | ||
} | ||
}, | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"dev": "rollup -c --watch", | ||
"build": "rollup -c" | ||
"build": "tsup src/index.ts --format esm,cjs --clean --dts" | ||
}, | ||
@@ -27,14 +34,10 @@ "repository": { | ||
"devDependencies": { | ||
"@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": "^2.0.0-beta.27" | ||
"@types/node": "^18.0.6", | ||
"tsup": "^6.1.3", | ||
"vite": "^3.0.1" | ||
}, | ||
"dependencies": { | ||
"chalk": "^4.1.0", | ||
"chokidar": "^3.5.0" | ||
"chokidar": "^3.5.0", | ||
"picocolors": "^1.0.0" | ||
} | ||
} |
# vite-plugin-live-reload | ||
A *very* simple live reloading plugin for [vite](https://github.com/vitejs/vite). | ||
A simple live reloading plugin for [vite](https://github.com/vitejs/vite). | ||
@@ -4,0 +4,0 @@ ## Example |
import { Plugin, ViteDevServer } from 'vite' | ||
import chokidar, { WatchOptions } from 'chokidar' | ||
import chalk from 'chalk' | ||
import colors from 'picocolors' | ||
import path from 'path' | ||
@@ -49,3 +49,3 @@ | ||
logger.info( | ||
chalk.green(`page reload `) + chalk.dim(getShortName(path, root)), | ||
colors.green(`page reload `) + colors.dim(getShortName(path, root)), | ||
{ clear: true, timestamp: true } | ||
@@ -52,0 +52,0 @@ ) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7862
3
153
Yes
7
+ Addedpicocolors@^1.0.0
+ Addedpicocolors@1.1.1(transitive)
- Removedchalk@^4.1.0
- Removedansi-styles@4.3.0(transitive)
- Removedchalk@4.1.2(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removedhas-flag@4.0.0(transitive)
- Removedsupports-color@7.2.0(transitive)