Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 4: Typescript, ESM, glob removal, drop node <18 #1195

Merged
merged 47 commits into from
Jul 1, 2024
Merged

Commits on Jan 18, 2022

  1. Configuration menu
    Copy the full SHA
    83853fd View commit details
    Browse the repository at this point in the history
  2. Rewrite in typescript

    paulmillr committed Jan 18, 2022
    Configuration menu
    Copy the full SHA
    8800112 View commit details
    Browse the repository at this point in the history
  3. prettier

    paulmillr committed Jan 18, 2022
    Configuration menu
    Copy the full SHA
    abe7809 View commit details
    Browse the repository at this point in the history
  4. Remove glob support

    paulmillr committed Jan 18, 2022
    Configuration menu
    Copy the full SHA
    cac97c6 View commit details
    Browse the repository at this point in the history
  5. Drop node <14 from CI

    paulmillr committed Jan 18, 2022
    Configuration menu
    Copy the full SHA
    49d5958 View commit details
    Browse the repository at this point in the history
  6. Lint on node 16

    paulmillr committed Jan 18, 2022
    Configuration menu
    Copy the full SHA
    46e8570 View commit details
    Browse the repository at this point in the history
  7. Bump deps

    paulmillr committed Jan 18, 2022
    Configuration menu
    Copy the full SHA
    fbc7324 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    28908d3 View commit details
    Browse the repository at this point in the history
  9. Fix gh action

    paulmillr committed Jan 18, 2022
    Configuration menu
    Copy the full SHA
    1aa80ac View commit details
    Browse the repository at this point in the history
  10. Use ESM.

    paulmillr committed Jan 18, 2022
    Configuration menu
    Copy the full SHA
    f4eb8e2 View commit details
    Browse the repository at this point in the history
  11. Fix tests

    paulmillr committed Jan 18, 2022
    Configuration menu
    Copy the full SHA
    22a5ec9 View commit details
    Browse the repository at this point in the history

Commits on Feb 5, 2024

  1. test: fix up async bug in test setup

    The dynamic import causes the `describe` blocks to happen later, which
    means the `after` and `afterEach` have already run (and cleaned up) at
    that point.
    
    It also turns out the old version of rimraf wasn't awaitable, so it has
    been upgraded in this change.
    43081j committed Feb 5, 2024
    Configuration menu
    Copy the full SHA
    585d968 View commit details
    Browse the repository at this point in the history

Commits on Feb 6, 2024

  1. test: revert close test and fix race condition

    This reverts to what the test is in `master` but fixes an async race
    condition.
    
    Essentially:
    
    ```ts
    await waitForWatcher(watcher1);
    // at this point, the ready event has fired for watcher1 _and_ watcher2
    await waitForWatcher(watcher2);
    // this never gets reached because it fired before we added the event
    // handler
    ```
    
    Awaiting both in a `Promise.all` fixes this since the event handlers
    will be attached immediately.
    43081j committed Feb 6, 2024
    Configuration menu
    Copy the full SHA
    aaa08be View commit details
    Browse the repository at this point in the history
  2. test: fix dynamic import path of chokidar

    Since we're locally importing this, node will not resolve the import
    path as if it is an NPM package (i.e. it will not infer the `main` path,
    or package exports).
    
    Instead, we need to import the exact path it seems (`lib/index.js`).
    43081j committed Feb 6, 2024
    Configuration menu
    Copy the full SHA
    44aab1b View commit details
    Browse the repository at this point in the history
  3. test: revert close test

    This reverts the test for ignoring events after close, since it seems
    the original passes fine and makes this consistent with the other tests
    again in structure.
    43081j committed Feb 6, 2024
    Configuration menu
    Copy the full SHA
    8cc1e66 View commit details
    Browse the repository at this point in the history
  4. feat: rework anymatch and fix ignored paths

    This reworks the anymatch function to be a little less generic since we
    now know exactly what we want to call it with. This means we have much
    clearer/stronger types.
    
    On top of that, support for ignored paths has been implemented again (it
    was removed with a `TODO` until now, in v4).
    
    Keep in mind the way we store ignored paths may change in future so we
    can more efficiently access and remove them without the need for full
    iterations through the set.
    43081j committed Feb 6, 2024
    Configuration menu
    Copy the full SHA
    4c98a6b View commit details
    Browse the repository at this point in the history
  5. chore: introduce tseslint and fix lint script

    We were running ESLint against `*.js` (the default) which no longer
    exists, so `--ext` has been added to make it check `*.ts` files.
    
    Alongside that, TSESLint has been added and the recommended config
    enabled.
    
    For now, these two rules are disabled:
    
    - `no-explicit-any` - until we strongly type everything
    - `no-unused-vars` - probably permanently, using typescript's own
      `noUnusedLocals` instead
    43081j committed Feb 6, 2024
    Configuration menu
    Copy the full SHA
    e2bced6 View commit details
    Browse the repository at this point in the history

Commits on Feb 7, 2024

  1. feat: rework ignore matcher add/remove & add types

    This basically does two things:
    
    1. Adds `WatchHelper` to some of the methods for a stronger type
    2. Reworks how we add/remove ignore paths ("matchers")
    
    In the latter, thanks to a previous change where we can have "matcher
    objects", we need to iterate through existing ignore paths to make sure
    we don't duplicate them.
    
    Similarly, when removing a "path", we need to find any matcher objects
    which use the same path and remove those too.
    
    Basically introducing `addIgnorePath` and `removeIgnorePath` instead of
    mutating the set directly.
    43081j committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    9ba9ac5 View commit details
    Browse the repository at this point in the history

Commits on Feb 9, 2024

  1. fix: revert default interval

    Trying to fix some tests, the `interval` used to be `undefined` by
    default. That mean we would later compare `n > undefined` (which would
    be false). Changing it to `0` means `n > 0` would now be true.
    
    This doesn't actually fix the tests most likely but may as well revert
    to the same behavior for now.
    43081j committed Feb 9, 2024
    Configuration menu
    Copy the full SHA
    cf5e73b View commit details
    Browse the repository at this point in the history
  2. fix: mac OS inodes change just like linux

    When a file changes in linux, it gets a new inode which means our
    `fs.watch` will still be watching the old inode, not the new one.
    
    To get around this, we already remove the watcher and add a new one for
    the new inode.
    
    However, we don't apply this logic to MacOS, which also has the same
    behaviour (creates a new inode when a file changes in some cases).
    
    This change just makes it so we run the same logic for linux _and_ mac.
    43081j committed Feb 9, 2024
    Configuration menu
    Copy the full SHA
    9d16426 View commit details
    Browse the repository at this point in the history
  3. chore: bump node CI versions

    43081j committed Feb 9, 2024
    Configuration menu
    Copy the full SHA
    a01bbdd View commit details
    Browse the repository at this point in the history

Commits on Mar 19, 2024

  1. chore: run build in CI

    This just enables running the build script in CI such that tests have
    access to the build output when they run (as we're now using
    typescript).
    43081j committed Mar 19, 2024
    Configuration menu
    Copy the full SHA
    5523179 View commit details
    Browse the repository at this point in the history
  2. feat: re-enable fsevents conditional

    This re-enables the conditional import of `fsevents` since it will be
    unavailable on some platforms.
    43081j committed Mar 19, 2024
    Configuration menu
    Copy the full SHA
    3caba37 View commit details
    Browse the repository at this point in the history
  3. fix: add fsevents types

    A bit of chicken-and-egg situation means we can't pull the official
    fsevents types.
    
    Basically, fsevents will only install on certain platforms (macOS?).
    
    Of course, if we're not on a supported platform, that also means we
    won't have access to the shipped typescript types.
    
    To solve this, we have to keep a copy of the types ourselves.
    43081j committed Mar 19, 2024
    Configuration menu
    Copy the full SHA
    57c0cfd View commit details
    Browse the repository at this point in the history
  4. feat: use latest typescript

    Upgrades to typescript 5.x since the latest node types require that for
    some newer syntax.
    43081j committed Mar 19, 2024
    Configuration menu
    Copy the full SHA
    d4bc683 View commit details
    Browse the repository at this point in the history

Commits on Mar 23, 2024

  1. Configuration menu
    Copy the full SHA
    a178985 View commit details
    Browse the repository at this point in the history
  2. chore: drop dtslint for now

    43081j committed Mar 23, 2024
    Configuration menu
    Copy the full SHA
    9a93273 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    cd168d6 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0101e20 View commit details
    Browse the repository at this point in the history

Commits on Mar 24, 2024

  1. test: try use fix fs delays

    43081j committed Mar 24, 2024
    Configuration menu
    Copy the full SHA
    b8fdee2 View commit details
    Browse the repository at this point in the history

Commits on Mar 25, 2024

  1. feat: drop fsevents for macos

    As per the nodeJS docs, the built-in `fs.watch` will now use `fsevents`
    under the hood for watching directories. This means we should no longer
    need the `fsevents` dependency and can instead just delegate to node.
    
    Some stability changes have been made to the tests, too. Generally
    waiting for explicit conditions rather than arbitrary delays.
    43081j committed Mar 25, 2024
    Configuration menu
    Copy the full SHA
    7e8c742 View commit details
    Browse the repository at this point in the history

Commits on Mar 26, 2024

  1. test: fix symlinks on windows during testing

    On windows, a symlink can be created as a `file`, a `dir`, or a
    `junction`. Meanwhile, on unix-like systems, this type doesn't seem to
    matter much (or is ignored).
    
    By default, the type will be `file` on windows.
    
    Due to this, all directories we symlink in tests are actually created as
    "files" which leads to all sorts of permissions errors.
    
    This change basically makes it explicit that the symlinked directories
    are in fact directories (`dir`), thus making tests pass.
    43081j committed Mar 26, 2024
    Configuration menu
    Copy the full SHA
    928a755 View commit details
    Browse the repository at this point in the history

Commits on Mar 27, 2024

  1. test: wait for each write to trigger an event

    This test is incredibly flaky across different platforms, node versions,
    etc when we try write all the files at once. Instead, we now write a
    file at a time and wait for the spy to have been called before moving
    on.
    
    Not quite as accurate as real world but seems to be the only way to make
    this stable.
    43081j committed Mar 27, 2024
    Configuration menu
    Copy the full SHA
    75eb523 View commit details
    Browse the repository at this point in the history
  2. chore: add node 21 to CI

    This adds node 21.x to the matrix in our CI workflow (making it now run
    on 18, 20 and 21).
    43081j committed Mar 27, 2024
    Configuration menu
    Copy the full SHA
    6c20448 View commit details
    Browse the repository at this point in the history

Commits on May 18, 2024

  1. test: wait for watcher in before

    Attempts to fix some timing issues in tests by waiting for watchers to
    be ready before continuing with the test cases.
    43081j committed May 18, 2024
    Configuration menu
    Copy the full SHA
    eafeb45 View commit details
    Browse the repository at this point in the history

Commits on May 20, 2024

  1. chore: bump node versions in engine constraint

    Bumps the version to `>= 18` and replaces `21` with `22` in the CI
    workflows.
    43081j committed May 20, 2024
    Configuration menu
    Copy the full SHA
    f963c0b View commit details
    Browse the repository at this point in the history

Commits on May 23, 2024

  1. Merge pull request #1304 from 43081j/v4-jg

    [DRAFT] v4 fixes
    paulmillr committed May 23, 2024
    Configuration menu
    Copy the full SHA
    cdfd50e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ae0232b View commit details
    Browse the repository at this point in the history

Commits on May 26, 2024

  1. test: switch to node test runner

    Switches to using the built-in node test runner and drops mocha.
    
    Temporarily also introduces a `TEST_TIMEOUT` as `--test-timeout` is only
    available in 20.x and above, but we run CI in 18.x.
    43081j committed May 26, 2024
    Configuration menu
    Copy the full SHA
    b879371 View commit details
    Browse the repository at this point in the history

Commits on Jun 2, 2024

  1. test: delay after initial add

    Adds a small delay in some tests after the initial path has been added
    (to avoid the FS de-duping/cancelling events).
    43081j committed Jun 2, 2024
    Configuration menu
    Copy the full SHA
    dda8034 View commit details
    Browse the repository at this point in the history
  2. Merge pull request #1318 from 43081j/v4-test-runner

    test: switch to node test runner
    paulmillr committed Jun 2, 2024
    Configuration menu
    Copy the full SHA
    abc4688 View commit details
    Browse the repository at this point in the history
  3. chore: upgrade to flat eslint configs

    Upgrades eslint and switches to using the new flat config structure.
    43081j committed Jun 2, 2024
    Configuration menu
    Copy the full SHA
    430d643 View commit details
    Browse the repository at this point in the history
  4. Merge pull request #1320 from 43081j/v4-eslint

    chore: upgrade to flat eslint configs
    paulmillr committed Jun 2, 2024
    Configuration menu
    Copy the full SHA
    bd3c8a0 View commit details
    Browse the repository at this point in the history

Commits on Jun 25, 2024

  1. feat: move to node:fs/promises

    Moves to using `node:fs/promises` rather than using `promisify`
    manually.
    43081j committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    9594771 View commit details
    Browse the repository at this point in the history

Commits on Jun 28, 2024

  1. Merge pull request #1329 from 43081j/async-fs

    feat: move to node:fs/promises
    paulmillr committed Jun 28, 2024
    Configuration menu
    Copy the full SHA
    c8c3ff2 View commit details
    Browse the repository at this point in the history

Commits on Jul 1, 2024

  1. Stale issue

    paulmillr committed Jul 1, 2024
    Configuration menu
    Copy the full SHA
    d9f30a5 View commit details
    Browse the repository at this point in the history
  2. Stale issue 2

    paulmillr committed Jul 1, 2024
    Configuration menu
    Copy the full SHA
    6f715a9 View commit details
    Browse the repository at this point in the history