hsync-cli 1.1.6 → 1.1.7

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.
Files changed (2) hide show
  1. package/dist/bin.js +17 -3
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -68316,10 +68316,12 @@ class LocalScanner {
68316
68316
  excludePatterns;
68317
68317
  respectGitignore;
68318
68318
  ignoreRules;
68319
+ includeBases;
68319
68320
  constructor(localPath, filePatterns, excludePatterns, respectGitignore = false) {
68320
68321
  this.localPath = localPath;
68321
68322
  this.filePatterns = filePatterns || [];
68322
68323
  this.excludePatterns = excludePatterns || [];
68324
+ this.includeBases = this.filePatterns.map((p) => import_micromatch.default.scan(p).base);
68323
68325
  this.respectGitignore = respectGitignore;
68324
68326
  this.ignoreRules = respectGitignore ? [{ base: "", glob: "**/.git", negate: false, dirOnly: true }] : [];
68325
68327
  }
@@ -68355,7 +68357,15 @@ class LocalScanner {
68355
68357
  return results;
68356
68358
  }
68357
68359
  async walk(dirPath, results) {
68358
- const entries = await fs2.readdir(dirPath, { withFileTypes: true });
68360
+ let entries;
68361
+ try {
68362
+ entries = await fs2.readdir(dirPath, { withFileTypes: true });
68363
+ } catch (err) {
68364
+ if (err.code !== "EACCES" && err.code !== "EPERM")
68365
+ throw err;
68366
+ console.warn(`[LocalScanner] Skipping unreadable folder: ${dirPath}`);
68367
+ return;
68368
+ }
68359
68369
  if (this.respectGitignore && entries.some((e) => e.isFile() && e.name === ".gitignore")) {
68360
68370
  this.ignoreRules.push(...parseGitignore(await fs2.readFile(path3.join(dirPath, ".gitignore"), "utf8"), path3.relative(this.localPath, dirPath).split(path3.sep).join("/")));
68361
68371
  }
@@ -68363,7 +68373,11 @@ class LocalScanner {
68363
68373
  const fullPath = path3.join(dirPath, entry.name);
68364
68374
  const relativePath = path3.relative(this.localPath, fullPath);
68365
68375
  if (entry.isDirectory()) {
68366
- if (!matchesRules(this.ignoreRules, relativePath.split(path3.sep).join("/"), true)) {
68376
+ const dir = relativePath.split(path3.sep).join("/");
68377
+ if (this.includeBases.length > 0 && !this.includeBases.some((b) => b === "" || b === dir || b.startsWith(dir + "/") || dir.startsWith(b + "/"))) {
68378
+ continue;
68379
+ }
68380
+ if (!matchesRules(this.ignoreRules, dir, true)) {
68367
68381
  await this.walk(fullPath, results);
68368
68382
  }
68369
68383
  continue;
@@ -71504,7 +71518,7 @@ Press Ctrl+C to stop the server...
71504
71518
  // package.json
71505
71519
  var package_default = {
71506
71520
  name: "hsync-cli",
71507
- version: "1.1.6",
71521
+ version: "1.1.7",
71508
71522
  description: "hsync CLI for file sync operations",
71509
71523
  bin: {
71510
71524
  hsync: "./dist/bin.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hsync-cli",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "hsync CLI for file sync operations",
5
5
  "bin": {
6
6
  "hsync": "./dist/bin.js"