Giter Club home page Giter Club logo

Comments (5)

DeMoorJasper avatar DeMoorJasper commented on May 21, 2024

Supporting globs sounds like a great addition to this library, not entirely sure how much work this will be.

The file change querying is already possible let events = await watcher.getEventsSince(dirPath, snapshotPath);?

from watcher.

devongovett avatar devongovett commented on May 21, 2024

I'm curious, what would you use this for?

from watcher.

rtsao avatar rtsao commented on May 21, 2024

I would have a variety of use cases, but mainly standalone code generation tools and standalone non-web programming language compilers.

This library has a lot of appeal compared to other Node.js file watchers. I'm looking at using this as an alternative to using Watchman directly, thereby eliminating a hard requirement for end users (but still allowing for progressive enhancement if they already use it).

So I'd probably want to query the file system for specifically relevant files (probably via glob or file extension) upon cold start (changed since an arbitrary time, regardless of if an existing snapshot exists), then listen for change events if operating in watch-compile mode.

It is definitely understandable if you'd rather not have this be a general-purpose, fully featured watcher. But I think would potentially fill a really nice niche outside of just Parcel specifically.

from watcher.

aleclarson avatar aleclarson commented on May 21, 2024

watch only specific kinds of files (i.e. *.css)

You could try filespy, a wrapper for @parcel/watcher.

https://github.com/alloc/filespy

from watcher.

kresnasatya avatar kresnasatya commented on May 21, 2024
  • query/watch only specific kinds of files (i.e. *.css)

I vote for this idea especially for Backend Integration like PHP, Ruby, etc.

Currently, I create a WordPress theme integrate with ViteJS with purpose to refresh the page on the browser (without user action) with PHP file extension if I do actions like create, edit, move, and delete in PHP file. So far I know, to support this capabilities developers tend to use chokidar wrapped with vite-plugin (e.g. : ElMassimo/vite-plugin-full-reload and arnoson/vite-plugin-live-reload) because chokidar can also watch file, glob, and array beside of dir.

I wish if @parcel/watcher can support these capabilities too.

Maybe we can add more flexibility in first parameter like await watcher.subscribe(‘file, dir, glob, array’, (err, status) => {}) instead of await watcher.subscribe(process.cwd(), (err, status) => {}).

from watcher.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.