@stacksjs/storage 0.59.4 → 0.59.5

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.
package/dist/index.js CHANGED
@@ -17,9 +17,9 @@ import {contains} from "@stacksjs/arrays";
17
17
 
18
18
  // src/fs.ts
19
19
  import * as fs from "fs-extra";
20
- import {pathExists as existsSync, mkdirSync, readFileSync, writeFileSync} from "fs-extra";
20
+ import {pathExists as existsSync2, mkdirSync, readFileSync, writeFileSync} from "fs-extra";
21
21
  async function exists(path) {
22
- return await existsSync(path);
22
+ return await existsSync2(path);
23
23
  }
24
24
 
25
25
  // src/files.ts
@@ -37,7 +37,7 @@ async function readPackageJson(name, cwd) {
37
37
  async function writeFile(path2, data) {
38
38
  if (typeof path2 === "string") {
39
39
  const dirPath = dirname(path2);
40
- if (!await existsSync(dirPath))
40
+ if (!await existsSync2(dirPath))
41
41
  await createFolder(dirPath);
42
42
  return await Bun.write(Bun.file(path2), data);
43
43
  }
@@ -188,6 +188,10 @@ var folders = {
188
188
  import {createHash} from "crypto";
189
189
  import {path as p2} from "@stacksjs/path";
190
190
  function hashFileOrDirectory(path4, hash) {
191
+ if (!existsSync(path4)) {
192
+ console.error(`Path does not exist: ${path4}`);
193
+ return;
194
+ }
191
195
  if (fs.statSync(path4).isDirectory()) {
192
196
  const files2 = fs.readdirSync(path4);
193
197
  for (const file of files2) {
@@ -594,7 +598,7 @@ __export(exports_storage, {
594
598
  },
595
599
  existsSync: () => {
596
600
  {
597
- return existsSync;
601
+ return existsSync2;
598
602
  }
599
603
  },
600
604
  exists: () => {
@@ -797,7 +801,7 @@ export {
797
801
  fs,
798
802
  folders,
799
803
  files,
800
- existsSync,
804
+ existsSync2 as existsSync,
801
805
  exists,
802
806
  doesNotExist,
803
807
  doesFolderExist,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/storage",
3
3
  "type": "module",
4
- "version": "0.59.4",
4
+ "version": "0.59.5",
5
5
  "description": "The Stacks file system.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
package/src/hash.ts CHANGED
@@ -4,6 +4,13 @@ import { path as p } from '@stacksjs/path'
4
4
  import { fs } from './fs'
5
5
 
6
6
  export function hashFileOrDirectory(path: string, hash: Hash): void {
7
+ // Check if the path exists before proceeding
8
+ if (!existsSync(path)) {
9
+ console.error(`Path does not exist: ${path}`)
10
+ // Handle the non-existent path as needed (e.g., skip or log)
11
+ return
12
+ }
13
+
7
14
  if (fs.statSync(path).isDirectory()) {
8
15
  const files = fs.readdirSync(path)
9
16
  for (const file of files) {