Skip to content

Commit

Permalink
squash!
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaRHristov committed Sep 19, 2023
1 parent 8af40e1 commit db59ec0
Show file tree
Hide file tree
Showing 50 changed files with 154 additions and 98 deletions.
4 changes: 2 additions & 2 deletions Source/Class/Files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export default class Files {
};

/**
* The function `By` takes in a file pattern or an array of file patterns and returns the promise that
* resolves to the results after executing the patterns to the specified paths.
* The function `By` takes a file pattern or an array of file patterns and returns a promise that
* resolves to the results of executing the patterns on the specified paths.
* @param {Pattern | Pattern[]} [File=**/ /*] - The `File` parameter is of type `Pattern` or
* `Pattern[]`. It represents the file or files that you want to search for. The `Pattern` type is a
* string pattern that can include wildcards to match multiple files. The default value for `File` is
Expand Down
8 changes: 4 additions & 4 deletions Target/Library/Files.d.ts → Target/Class/Files.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Type as Action } from "../Library/Files/Action.js";
import type { Type as Path } from "../Library/Files/Path.js";
import type { Type as Plan } from "../Library/Files/Plan.js";
import type { Type as Option } from "../Option/Index.js";
import type { Type as Action } from "../Interface/Action.js";
import type { Type as Option } from "../Interface/Option.js";
import type { Type as Path } from "../Interface/Path.js";
import type { Type as Plan } from "../Interface/Plan.js";
import type { Pattern } from "fast-glob";
export default class Files {
/**
Expand Down
1 change: 1 addition & 0 deletions Target/Class/Files.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions Target/Export.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export type { Type as Action } from "./Interface/Action.js";
export type { Type as Buffer } from "./Interface/Buffer.js";
export type { Type as Dir } from "./Interface/Dir.js";
export type { Type as Exclude } from "./Interface/Exclude.js";
export type { Type as File } from "./Interface/File.js";
export type { Type as Logger } from "./Interface/Logger.js";
export type { Type as Option } from "./Interface/Option.js";
export type { Type as Path } from "./Interface/Path.js";
export { default as Files } from "./Class/Files.js";
export { default as Apply } from "./Fn/Apply.js";
export { default as By } from "./Fn/By.js";
export { default as Bytes } from "./Fn/Bytes.js";
export { default as In } from "./Fn/In.js";
export { default as Merge } from "./Fn/Merge.js";
export { default as Not } from "./Fn/Not.js";
export { default as Pipe } from "./Fn/Pipe.js";
export { default as Default } from "./Object/Option.js";
1 change: 1 addition & 0 deletions Target/Export.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion Target/Library/Files/By.d.ts → Target/Fn/By.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Type as Plan } from "../Interface/Plan.ts";
import type { Pattern } from "fast-glob";
/**
* The function `By` takes in a file pattern or an array of file patterns, a set of
Expand All @@ -13,5 +14,5 @@ import type { Pattern } from "fast-glob";
* keep track of the files that have been processed and their respective destinations.
* @returns the `Results` object.
*/
declare const _default: (File: Pattern | Pattern[], Paths: Plan, Results: Plan) => Promise<Plan>;
declare const _default: (File: Pattern | Pattern[], Paths: Plan["Paths"], Results: Plan["Results"]) => Promise<Map<string, string>>;
export default _default;
1 change: 1 addition & 0 deletions Target/Fn/By.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import f from"fast-glob";var p=async(a,e,t)=>{for(const[o,n]of e)for(const r of await f(a,{cwd:o,onlyFiles:!0}))t.set(`${n}${r}`,`${o}${r}`);return t};export{p as default};
File renamed without changes.
File renamed without changes.
4 changes: 3 additions & 1 deletion Target/Library/Files/In.d.ts → Target/Fn/In.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { Type as Path } from "../Interface/Path.js";
import type { Type as Plan } from "../Interface/Plan.js";
/**
* The function `In` takes a `Path` and a `Paths` object, and adds the `Path` to the `Paths` object.
* @param {Path} Path - The `Path` parameter is a string or URL that represents the path to a file or
Expand All @@ -6,5 +8,5 @@
* stores key-value pairs.
* @returns The function `In` returns the `Paths` object.
*/
declare const _default: (Path: Path, Paths: Plan) => Promise<Plan>;
declare const _default: (Path: Path, Paths: Plan["Paths"]) => Promise<Map<string, string>>;
export default _default;
1 change: 1 addition & 0 deletions Target/Fn/In.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions Target/Library/Files/Not.d.ts → Target/Fn/Not.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Type as Option } from "../../Option/Index.js";
import type { Type as Option } from "../Interface/Option.js";
import type { Type as Plan } from "../Interface/Plan.js";
/**
* The function `Not` filters out files from the `Files` array based on the provided `Pattern`
* parameter.
Expand All @@ -9,5 +10,5 @@ import type { Type as Option } from "../../Option/Index.js";
* name, and the second element represents the file content.
* @returns the modified `Files` set after applying the filters.
*/
declare const _default: (Pattern: Option["Exclude"], Files: Plan) => Promise<Plan>;
declare const _default: (Pattern: Option["Exclude"], Files: Plan["Results"]) => Promise<Map<string, string>>;
export default _default;
1 change: 1 addition & 0 deletions Target/Fn/Not.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Target/Library/Files/Pipe.d.ts → Target/Fn/Pipe.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Type as Action } from "./Action.js";
import type { Type as Plan } from "./Plan.js";
import type { Type as Action } from "../Interface/Action.ts";
import type { Type as Plan } from "../Interface/Plan.ts";
/**
* The function `Pipe` takes a `Plan` and an `Action` object as input, and performs a series of
* operations based on the plan, handling various callbacks and error handling along the way.
Expand Down
1 change: 1 addition & 0 deletions Target/Fn/Pipe.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 0 additions & 17 deletions Target/Index.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion Target/Index.js

This file was deleted.

52 changes: 52 additions & 0 deletions Target/Interface/Action.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import type { Type as Buffer } from "./Buffer.js";
import type { Type as Cache } from "./Cache.js";
import type { Type as File } from "./File.js";
import type { Type as Plan } from "./Plan.js";
/**
* Represents the execution configuration for specific actions on files.
*/
export interface Type {
/**
* Attaches a callback for the fulfillment of the Action.
* @param Plan The execution plan to be fulfilled.
* @returns A Promise that resolves to either a string or false.
*/
Fulfilled?: boolean | ((Plan: Plan) => Promise<false | string>);
/**
* Attaches a callback for handling failures in the Action.
* @param Input The input file being processed.
* @param _Error The error encountered during execution.
* @returns A Promise that resolves to either a string or false.
*/
Failed?: boolean | ((Input: File, _Error: unknown) => Promise<false | string>);
/**
* Attaches a callback for actions that are accomplished.
* @param On The file on which an action was accomplished.
* @returns A Promise that resolves to either a string or false.
*/
Accomplished?: boolean | ((On: File) => Promise<false | string>);
/**
* Attaches a callback for actions that result in changes to the plan.
* @param Plan The execution plan to be changed.
* @returns A Promise that resolves to the modified execution plan.
*/
Changed?: (Plan: Plan) => Promise<Plan>;
/**
* Attaches a callback for actions that check if a file can pass through the pipe.
* @param On The file on which the action is being checked.
* @returns A Promise that resolves to a boolean value indicating if the file has passed the checks.
*/
Passed?: (On: File) => Promise<Boolean>;
/**
* Attaches a callback for reading from a file.
* @param On The file to be read.
* @returns A Promise that resolves to the buffer read from the file.
*/
Read?: (On: File) => Promise<Buffer>;
/**
* Attaches a callback for writing to a file.
* @param On The file to be written to.
* @returns A Promise that resolves to the buffer written to the file.
*/
Wrote?: (On: File, Cache: Cache) => Promise<Buffer>;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
42 changes: 42 additions & 0 deletions Target/Interface/Option.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import type { Type as Action } from "./Action.js";
import type { Type as Cache } from "./Cache.js";
import type { Type as Exclude } from "./Exclude.js";
import type { Type as Logger } from "./Logger.js";
import type { Type as Path } from "./Path.js";
import type { Pattern } from "fast-glob";
/**
* Represents options for configuring the behavior of the program.
*/
export interface Type {
[key: string]: any;
/**
* Configuration for the target cache.
*
* @default "./Cache"
*/
Cache?: Cache;
/**
* Configuration for the target path(s).
*
* @default "./Target"
*/
Path?: Path | Path[] | Set<Path>;
/**
* Criteria for excluding files.
*/
Exclude?: Exclude | Exclude[] | Set<Exclude>;
/**
* File patterns to be matched.
*/
Files?: Pattern | Pattern[];
/**
* Action pipe configuration.
*/
Action?: Action;
/**
* Debugging level.
*
* @default 2
*/
Logger?: Logger;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added Target/Interface/Plan.js
Empty file.
1 change: 0 additions & 1 deletion Target/Library/Files.js

This file was deleted.

1 change: 0 additions & 1 deletion Target/Library/Files/By.js

This file was deleted.

1 change: 0 additions & 1 deletion Target/Library/Files/In.js

This file was deleted.

1 change: 0 additions & 1 deletion Target/Library/Files/Not.js

This file was deleted.

1 change: 0 additions & 1 deletion Target/Library/Files/Pipe.js

This file was deleted.

18 changes: 18 additions & 0 deletions Target/Object/Option.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Default configuration object.
*/
declare const _default: {
Cache: string;
Path: string;
Logger: 2;
Action: {
Read: (On: import("../Export.ts").File) => Promise<string>;
Wrote: (On: import("../Export.ts").File) => Promise<import("../Export.ts").Buffer>;
Passed: (On: import("../Export.ts").File) => Promise<boolean>;
Failed: (On: import("../Export.ts").File) => Promise<string>;
Accomplished: (On: import("../Export.ts").File) => Promise<string>;
Fulfilled: (Plan: import("../Interface/Plan.ts").Type) => Promise<string | false>;
Changed: (Plan: import("../Interface/Plan.ts").Type) => Promise<import("../Interface/Plan.ts").Type>;
};
};
export default _default;
2 changes: 1 addition & 1 deletion Target/Option/Index.js → Target/Object/Option.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 0 additions & 60 deletions Target/Option/Index.d.ts

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"url": "https://nikolahristov.tech"
},
"type": "module",
"main": "./Target/Index.js",
"types": "./Target/Index.d.ts",
"main": "./Target/Export.js",
"types": "./Target/Export.d.ts",
"scripts": {
"prepublishOnly": "TypeScriptESBuild 'Source/**/*.ts'"
},
Expand Down

0 comments on commit db59ec0

Please sign in to comment.