New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vite-plugin-watch-and-run

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-watch-and-run - npm Package Compare versions

Comparing version 1.3.0-exp.0 to 1.3.0-exp.1

8

CHANGELOG.md
# @kitql/vite-plugin-watch-and-run
## 1.3.0-exp.1
### Patch Changes
- [#382](https://github.com/jycouet/kitql/pull/382)
[`55a08b1`](https://github.com/jycouet/kitql/commit/55a08b1d9010f425c44568ec06939e7a0db220fa)
Thanks [@jycouet](https://github.com/jycouet)! - add viteDevServer in run() args
## 1.3.0-exp.0

@@ -4,0 +12,0 @@

6

dist/index.d.ts

@@ -1,2 +0,2 @@

import type { Plugin } from 'vite';
import type { Plugin, ViteDevServer } from 'vite';
export type Options = {

@@ -22,3 +22,3 @@ /**

*/
run: string | (() => void | Promise<void>);
run: string | ((server: ViteDevServer) => void | Promise<void>);
/**

@@ -50,3 +50,3 @@ * Delay before running the run command (in ms)

quiet: boolean;
run: string | (() => void | Promise<void>);
run: string | ((server: ViteDevServer) => void | Promise<void>);
delay: number;

@@ -53,0 +53,0 @@ isRunning: boolean;

@@ -0,6 +1,6 @@

import { spawn } from 'node:child_process';
import { cyan, green, Log, magenta, red } from '@kitql/helper';
import micromatch from 'micromatch';
import { spawn } from 'node:child_process';
const nbOverlap = (a1, a2) => {
return a1.filter((value) => a2?.includes(value)).length;
return a1.filter(value => a2?.includes(value)).length;
};

@@ -25,3 +25,3 @@ export const kindWithPath = ['add', 'addDir', 'change', 'unlink', 'unlinkDir'];

watchFile: paramRow.watchFile,
formatErrors: paramRow.formatErrors
formatErrors: paramRow.formatErrors,
};

@@ -68,3 +68,3 @@ // @ts-ignore (because the config is in a js file, and people maybe didn't update their config.)

}
async function watcher(absolutePath, watchKind, watchAndRunConf) {
async function watcher(server, absolutePath, watchKind, watchAndRunConf) {
const info = await shouldRun(absolutePath, watchKind, watchAndRunConf);

@@ -89,3 +89,3 @@ if (info) {

if (typeof info.run === 'function') {
const promise = info.run();
const promise = info.run(server);
try {

@@ -109,10 +109,10 @@ if (promise) {

//spit stdout to screen
child.stdout.on('data', (data) => {
child.stdout.on('data', data => {
process.stdout.write(formatLog(data.toString(), info.name ?? ''));
});
//spit stderr to screen
child.stderr.on('data', (data) => {
child.stderr.on('data', data => {
process.stdout.write(formatLog(data.toString(), info.name ?? ''));
});
child.on('close', (code) => {
child.on('close', code => {
if (code === 0) {

@@ -143,11 +143,11 @@ log.info(`${green('✔')} finished ${green('successfully')}`);

for (const kind of kindWithPath) {
const _watcher = async (absolutePath) => watcher(absolutePath, kind, watchAndRunConf);
const _watcher = async (absolutePath) => watcher(server, absolutePath, kind, watchAndRunConf);
server.watcher.on(kind, _watcher);
}
for (const kind of kindWithoutPath) {
const _watcher = () => watcher(null, kind, watchAndRunConf);
const _watcher = () => watcher(server, null, kind, watchAndRunConf);
server.watcher.on(kind, _watcher);
}
}
},
};
}
{
"name": "vite-plugin-watch-and-run",
"description": "vite-plugin that will watch some files and run a package.json script on change",
"version": "1.3.0-exp.0",
"version": "1.3.0-exp.1",
"license": "MIT",

@@ -6,0 +6,0 @@ "type": "module",

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