@blokjs/capabilities 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { createHash, randomUUID } from "node:crypto";
2
- import { constants, lstatSync, realpathSync, statSync, watch as watchPath } from "node:fs";
2
+ import { constants, existsSync, lstatSync, realpathSync, statSync, watch as watchPath } from "node:fs";
3
3
  import { lstat, open, readdir, rename, rm } from "node:fs/promises";
4
- import { dirname, extname, isAbsolute, join, relative, resolve, win32 } from "node:path";
4
+ import { basename, dirname, extname, isAbsolute, join, relative, resolve, win32 } from "node:path";
5
5
  import { intersectCapabilityAuthorities, parseCapabilityAuthority, } from "@blokjs/shared";
6
6
  import { WORKSPACE_FILESYSTEM_MAX_DURATION_MS, WORKSPACE_FILESYSTEM_MAX_LINES, WORKSPACE_FILESYSTEM_MAX_LIST_FILES, WORKSPACE_FILESYSTEM_MAX_PATH_LENGTH, WORKSPACE_FILESYSTEM_MAX_QUERY_LENGTH, WORKSPACE_FILESYSTEM_MAX_READ_BYTES, WORKSPACE_FILESYSTEM_MAX_SEARCH_BYTES, WORKSPACE_FILESYSTEM_MAX_SEARCH_FILES, WORKSPACE_FILESYSTEM_MAX_SEARCH_MATCHES, WORKSPACE_FILESYSTEM_MAX_WATCH_DEBOUNCE_MS, WORKSPACE_FILESYSTEM_MAX_WATCH_EVENTS, WORKSPACE_FILESYSTEM_MAX_WRITE_BYTES, } from "./contracts.js";
7
7
  import { WorkspaceFilesystemError } from "./errors.js";
@@ -465,6 +465,12 @@ export class WorkspaceFilesystemCapability {
465
465
  if (closed || filename === null)
466
466
  return;
467
467
  const absolute = join(watchDirectory, filename.toString());
468
+ // macOS (kqueue) reports a change to the watched directory itself with
469
+ // the directory's own name as `filename`; joined onto the directory that
470
+ // is a path that never existed. It carries no entry information and
471
+ // would eat the event budget ahead of the real per-file event.
472
+ if (filename.toString() === basename(watchDirectory) && !existsSync(absolute))
473
+ return;
468
474
  if (!filter(absolute))
469
475
  return;
470
476
  const path = this.pathFromAbsolute(target.root, absolute);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blokjs/capabilities",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "Trusted, bounded capability adapters for Blok harnesses.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -16,7 +16,7 @@
16
16
  "keywords": ["blok", "capabilities", "filesystem", "harness"],
17
17
  "license": "MIT",
18
18
  "dependencies": {
19
- "@blokjs/shared": "^2.1.0",
19
+ "@blokjs/shared": "^2.2.1",
20
20
  "uuid": "^11.1.0"
21
21
  },
22
22
  "devDependencies": {