2 Commits

Author SHA1 Message Date
5577e4e4de v1.1.2
Some checks failed
Default (tags) / security (push) Successful in 40s
Default (tags) / test (push) Failing after 36s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2025-11-29 21:01:51 +00:00
6308e198c7 fix(SmartFsProviderNode): Fix Node provider watch path handling and remove main test entry 2025-11-29 21:01:51 +00:00
5 changed files with 15 additions and 10 deletions

View File

@@ -1,5 +1,12 @@
# Changelog
## 2025-11-29 - 1.1.2 - fix(SmartFsProviderNode)
Fix Node provider watch path handling and remove main test entry
- Node provider: detect at start whether the watched path is a file or directory (fs.stat) and build fullPath accordingly so watching a single file does not incorrectly join the filename onto the file path.
- Watch callback: ensure events are evaluated against the configured filter using the correct full path.
- Tests: removed test/test.ts (main test entry that previously imported provider test files).
## 2025-11-29 - 1.1.1 - fix(smartfs.provider.node)
Default deleteDirectory to recursive=true in Node provider

View File

@@ -1,6 +1,6 @@
{
"name": "@push.rocks/smartfs",
"version": "1.1.1",
"version": "1.1.2",
"private": false,
"description": "a cross platform extendable fs module",
"main": "dist_ts/index.js",

View File

@@ -1,7 +0,0 @@
/**
* Main test entry point
* Imports all test files
*/
import './test.memory.provider.js';
import './test.node.provider.js';

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartfs',
version: '1.1.1',
version: '1.1.2',
description: 'a cross platform extendable fs module'
}

View File

@@ -266,6 +266,10 @@ export class SmartFsProviderNode implements ISmartFsProvider {
// --- Watch Operations ---
public async watch(path: string, callback: TWatchCallback, options?: IWatchOptions): Promise<IWatcherHandle> {
// Check once at start if we're watching a file or directory
const watchedStats = await fs.stat(path);
const isWatchingFile = watchedStats.isFile();
const watcher = fsSync.watch(
path,
{
@@ -274,7 +278,8 @@ export class SmartFsProviderNode implements ISmartFsProvider {
async (eventType, filename) => {
if (!filename) return;
const fullPath = pathModule.join(path, filename);
// For file watching, path IS the file; for directory, join with filename
const fullPath = isWatchingFile ? path : pathModule.join(path, filename);
// Apply filter
if (options?.filter && !this.matchesPathFilter(fullPath, options.filter)) {