@stacksjs/storage 0.66.0 → 0.68.0

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/aws.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import type { StorageDriver } from '@stacksjs/types';
2
+
3
+ declare const client: unknown;
4
+ export declare const awsStorage: FileStorage;
5
+ export declare const aws: StorageDriver;
package/dist/copy.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export declare function copy(src: string | string[], dest: string, exclude?: string[]): void;
1
+ export declare function copy(src: string | string[], dest: string, exclude: string[] = []): void;
2
2
  export declare function copyFile(src: string, dest: string): void;
3
- export declare function copyFolder(src: string, dest: string, exclude?: string[]): void;
3
+ export declare function copyFolder(src: string, dest: string, exclude: string[] = []): void;
package/dist/delete.d.ts CHANGED
@@ -1,8 +1,7 @@
1
- import type { Result } from "@stacksjs/error-handling";
2
1
  export declare function deleteFolder(path: string): Promise<Result<string, Error>>;
3
2
  export declare function isDirectoryEmpty(path: string): Promise<Result<boolean, Error>>;
4
3
  export declare function deleteEmptyFolder(path: string): Promise<Result<string, Error>>;
5
4
  export declare function deleteEmptyFolders(dir: string): Promise<Result<string, Error>>;
6
5
  export declare function deleteFile(path: string): Promise<Result<string, Error>>;
7
6
  export declare function deleteGlob(path: string): Promise<Result<string, Error>>;
8
- export declare function del(path: string): Promise<Result<string, Error>>;
7
+ export declare function del(path: string): Promise<Result<string, Error>>;
package/dist/files.d.ts CHANGED
@@ -1,52 +1,33 @@
1
- import type { JsonFile, PackageJson, TextFile } from "@stacksjs/types";
2
- /**
3
- * Reads a JSON file and returns the parsed data.
4
- */
1
+ import type { JsonFile, TextFile } from '@stacksjs/types';
2
+
5
3
  export declare function readJsonFile(name: string, cwd?: string): Promise<JsonFile>;
6
- /**
7
- * Reads a package.json file and returns the parsed data.
8
- */
9
4
  export declare function readPackageJson(name: string, cwd?: string): Promise<PackageJson>;
10
- /**
11
- * Writes the given text to the specified file.
12
- */
13
5
  export declare function writeFile(path: string, data: any): Promise<number>;
14
- /**
15
- * Writes the given data to the specified JSON file.
16
- */
17
6
  export declare function writeJsonFile(file: JsonFile): Promise<number>;
18
- /**
19
- * Reads a text file and returns its contents.
20
- */
21
7
  export declare function readTextFile(name: string, cwd?: string): Promise<TextFile>;
22
- /**
23
- * Writes the given text to the specified file.
24
- */
25
8
  export declare function writeTextFile(file: TextFile): Promise<number>;
9
+ declare function isFile(path: string): boolean;
26
10
  export declare function doesExist(path: string): boolean;
27
11
  export declare function doesNotExist(path: string): boolean;
28
- /**
29
- * Determine whether a folder has any files in it.
30
- */
31
12
  export declare function hasFiles(folder: string): boolean;
32
13
  export declare function hasComponents(): boolean;
33
14
  export declare function hasFunctions(): boolean;
34
- export declare function deleteFiles(dir: string, exclude?: string[]): void;
35
- export declare function getFiles(dir: string, exclude?: string[]): string[];
15
+ export declare function deleteFiles(dir: string, exclude: string[] = []): void;
16
+ export declare function getFiles(dir: string, exclude: string[] = []): string[];
36
17
  export declare function put(path: string, contents: string): void;
37
18
  export declare function get(path: string): Promise<string>;
38
- export interface Files {
39
- readJsonFile: typeof readJsonFile;
40
- readPackageJson: typeof readPackageJson;
41
- readTextFile: typeof readTextFile;
42
- writeJsonFile: typeof writeJsonFile;
43
- writeTextFile: typeof writeTextFile;
44
- hasFiles: typeof hasFiles;
45
- hasComponents: typeof hasComponents;
46
- hasFunctions: typeof hasFunctions;
47
- deleteFiles: typeof deleteFiles;
48
- getFiles: typeof getFiles;
49
- put: typeof put;
50
- get: typeof get;
19
+ export declare interface Files {
20
+ readJsonFile: typeof readJsonFile
21
+ readPackageJson: typeof readPackageJson
22
+ readTextFile: typeof readTextFile
23
+ writeJsonFile: typeof writeJsonFile
24
+ writeTextFile: typeof writeTextFile
25
+ hasFiles: typeof hasFiles
26
+ hasComponents: typeof hasComponents
27
+ hasFunctions: typeof hasFunctions
28
+ deleteFiles: typeof deleteFiles
29
+ getFiles: typeof getFiles
30
+ put: typeof put
31
+ get: typeof get
51
32
  }
52
- export declare const files: Files;
33
+ export declare const files: Files;
@@ -1,4 +1,4 @@
1
- export { AwsS3StorageAdapter, DefaultAwsPublicUrlGenerator, HostStyleAwsPublicUrlGenerator } from "@flystorage/aws-s3";
2
- export { checksumFromStream, closeReadable, DirectoryListing, FileStorage, isDirectory, isFile, normalizeExpiryToDate, normalizeExpiryToMilliseconds, readableToString, readableToUint8Array, toReadable } from "@flystorage/file-storage";
3
- export { InMemoryStorageAdapter, resolveMimeType } from "@flystorage/in-memory";
4
- export { BaseUrlLocalPublicUrlGenerator, FailingLocalTemporaryUrlGenerator, LocalStorageAdapter } from "@flystorage/local-fs";
1
+ export { AwsS3StorageAdapter, DefaultAwsPublicUrlGenerator, HostStyleAwsPublicUrlGenerator } from '@flystorage/aws-s3'
2
+ export { checksumFromStream, closeReadable, DirectoryListing, FileStorage, isDirectory, isFile, normalizeExpiryToDate, normalizeExpiryToMilliseconds, readableToString, readableToUint8Array, toReadable } from '@flystorage/file-storage'
3
+ export { InMemoryStorageAdapter, resolveMimeType } from '@flystorage/in-memory'
4
+ export { BaseUrlLocalPublicUrlGenerator, FailingLocalTemporaryUrlGenerator, LocalStorageAdapter } from '@flystorage/local-fs'
package/dist/folders.d.ts CHANGED
@@ -1,15 +1,12 @@
1
- /**
2
- * Determine whether a path is a folder.
3
- */
4
1
  export declare function isFolder(path: string): boolean;
5
2
  export declare function isDir(path: string): boolean;
6
3
  export declare function doesFolderExist(path: string): boolean;
7
4
  export declare function createFolder(dir: string): Promise<void>;
8
5
  export declare function getFolders(dir: string): string[];
9
- export interface Folders {
10
- isFolder: (path: string) => boolean;
11
- doesFolderExist: (path: string) => boolean;
12
- createFolder: (dir: string) => Promise<void>;
13
- getFolders: (dir: string) => string[];
6
+ export declare interface Folders {
7
+ isFolder: (path: string) => boolean
8
+ doesFolderExist: (path: string) => boolean
9
+ createFolder: (dir: string) => Promise<void>
10
+ getFolders: (dir: string) => string[]
14
11
  }
15
- export declare const folders: Folders;
12
+ export declare const folders: Folders;
package/dist/fs.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as fs from "fs-extra";
2
- import { pathExists as existsSync, watch as fsWatch, mkdirSync, readFileSync, watchFile, writeFileSync } from "fs-extra";
3
- export declare function exists(path: string): Promise<boolean>;
4
- export { existsSync, fs, fsWatch, mkdirSync, readFileSync, watchFile, writeFileSync };
1
+ import { mkdirSync, pathExists as existsSync, readFileSync, watch as fsWatch, watchFile, writeFileSync } from 'fs-extra';
2
+
3
+ export { existsSync, fs, fsWatch, mkdirSync, readFileSync, watchFile, writeFileSync }
4
+ export declare function exists(path: string): Promise<boolean>;
Binary file
package/dist/glob.d.ts CHANGED
@@ -1,13 +1,15 @@
1
- export { glob } from "tinyglobby";
2
- export interface GlobOptions {
3
- absolute?: boolean;
4
- cwd?: string;
5
- patterns?: string[];
6
- ignore?: string[];
7
- dot?: boolean;
8
- deep?: number;
9
- expandDirectories?: boolean;
10
- onlyDirectories?: boolean;
11
- onlyFiles?: boolean;
1
+ import { globSync as gs } from 'tinyglobby';
2
+
3
+ export { glob } from 'tinyglobby'
4
+ export declare interface GlobOptions {
5
+ absolute?: boolean
6
+ cwd?: string
7
+ patterns?: string[]
8
+ ignore?: string[]
9
+ dot?: boolean
10
+ deep?: number
11
+ expandDirectories?: boolean
12
+ onlyDirectories?: boolean
13
+ onlyFiles?: boolean
12
14
  }
13
- export declare function globSync(patterns: string | string[], options?: Omit<GlobOptions, "patterns">): string[];
15
+ export declare function globSync(patterns: string | string[], options?: Omit<GlobOptions, 'patterns'>): string[];
package/dist/hash.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import type { Hash } from "node:crypto";
1
+ import type { Hash } from 'node:crypto';
2
+
2
3
  export declare function hashFileOrDirectory(path: string, hash: Hash): void;
3
4
  export declare function hashDirectory(directory: string): string;
4
5
  export declare function hashPath(path: string): string;
5
- export declare function hashPaths(paths: string | string[]): string;
6
+ export declare function hashPaths(paths: string | string[]): string;
package/dist/helpers.d.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  export declare const _dirname: string;
2
2
  export declare function updateConfigFile(filePath: string, newConfig: Record<string, unknown>): Promise<void>;
3
- interface Helpers {
4
- _dirname: string;
5
- updateConfigFile: (filePath: string, newConfig: Record<string, unknown>) => Promise<void>;
3
+ declare interface Helpers {
4
+ _dirname: string
5
+ updateConfigFile: (filePath: string, newConfig: Record<string, unknown>) => Promise<void>
6
6
  }
7
- export declare const helpers: Helpers;
8
- export {};
7
+ export declare const helpers: Helpers;
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- export * from "./copy";
2
- export * from "./delete";
3
- export * from "./files";
4
- export * from "./flystorage";
5
- export * from "./folders";
6
- export * from "./fs";
7
- export * from "./glob";
8
- export * from "./hash";
9
- export * from "./helpers";
10
- export * as storage from "./storage";
11
- export * from "./zip";
1
+ export * from './copy'
2
+ export * from './delete'
3
+ export * from './files'
4
+ export * from './flystorage'
5
+ export * from './folders'
6
+ export * from './fs'
7
+ export * from './glob'
8
+ export * from './hash'
9
+ export * from './helpers'
10
+ export * as storage from './storage'
11
+ export * from './zip'