files-pipe
Advanced tools
Comparing version 2.0.2 to 2.0.3
{ | ||
"name": "files-pipe", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"homepage": "https://github.com/baxast/files-pipe#readme", | ||
@@ -23,4 +23,4 @@ "bugs": { | ||
"devDependencies": { | ||
"baxast": "latest" | ||
"baxast": "0.0.9" | ||
} | ||
} |
@@ -101,3 +101,3 @@ # [files-pipe] 🧪 | ||
Set `logger` to `0` if you do not want to see debug messages. Default is `2`. | ||
Set `Logger` to `0` if you do not want to see debug messages. Default is `2`. | ||
@@ -104,0 +104,0 @@ **`Index.ts`** |
import type { Pattern } from "fast-glob"; | ||
import type { Executions, Plan, Options } from "../Option/Index.js"; | ||
import type { Executions, Options, Plan } from "../Option/Index.js"; | ||
export default class Files { | ||
Pipe: (Callbacks?: Executions) => Promise<Plan>; | ||
Not: (Pattern: Options["exclude"]) => Promise<void>; | ||
By: (Glob?: Pattern | Pattern[]) => Promise<void>; | ||
In: (Path?: any) => Promise<void> | this; | ||
Not: (File: Options["Exclude"]) => Promise<this>; | ||
By: (File?: Pattern | Pattern[]) => Promise<this>; | ||
In: (Path?: any) => Promise<this>; | ||
Plan: Plan; | ||
constructor(Debug?: Plan["Debug"]); | ||
} |
@@ -1,1 +0,1 @@ | ||
import a from"../Option/Index.js";import i from"./Files/By.js";import o from"./Files/In.js";import l from"./Files/Not.js";import P from"./Files/Pipe.js";class r{Pipe=(t=a.Pipe)=>P(this.Plan,t);Not=t=>l(t,this.Plan.Results).then(s=>{this.Plan.Results=s})||this;By=(t="**/*")=>i(t,this.Plan.Paths,this.Plan.Results).then(s=>{this.Plan.Results=s})||this;In=(t="./")=>!t&&o(t,this.Plan.Paths).then(s=>{s instanceof Map?s.forEach(([e,n])=>e&&n&&this.Plan.Paths.set(e,n)):this.Plan.Paths})||this;Plan={Files:0,Debug:2,Info:{},Paths:new Map,Results:new Map,On:{Buffer:"",After:0,Before:0,Input:"",Output:""}};constructor(t=2){this.Plan.Debug=t}}export{r as default}; | ||
import e from"../Option/Index.js";import i from"./Files/By.js";import o from"./Files/In.js";import r from"./Files/Not.js";import P from"./Files/Pipe.js";class l{Pipe=async(t=e.Pipe)=>await P(this.Plan,t);Not=async t=>(this.Plan.Results=await r(t,this.Plan.Results),this);By=async(t="**/*")=>(this.Plan.Results=await i(t,this.Plan.Paths,this.Plan.Results),this);In=async(t="./")=>{const s=await o(t,this.Plan.Paths);if(s instanceof Map)for(const[a,n]of s)this.Plan.Paths.set(a,n);return this};Plan={Files:0,Debug:2,Info:{},Paths:new Map,Results:new Map,On:{Buffer:"",After:0,Before:0,Input:"",Output:""}};constructor(t=2){this.Plan.Debug=t}}export{l as default}; |
import type { Pattern } from "fast-glob"; | ||
import type { Plan } from "../../Option/Index.js"; | ||
declare const _default: (_Glob: Pattern | Pattern[], Paths: Plan["Paths"], Results: Plan["Results"]) => Promise<Map<string, string>>; | ||
declare const _default: (File: Pattern | Pattern[], Paths: Plan["Paths"], Results: Plan["Results"]) => Promise<Map<string, string>>; | ||
export default _default; |
@@ -1,1 +0,1 @@ | ||
import l from"fast-glob";var m=async(e,n,r)=>(n.forEach(([t,o])=>t&&o&&l(e,{cwd:t,onlyFiles:!0}).then(f=>f.forEach(a=>r.set(`${o}${a}`,`${t}${a}`)))),r);export{m as default}; | ||
import f from"fast-glob";var p=async(n,e,t)=>{for(const[o,a]of e)for(const r of await f(n,{cwd:o,onlyFiles:!0}))t.set(`${a}${r}`,`${o}${r}`);return t};export{p as default}; |
import type { Plan } from "../../Option/Index.js"; | ||
declare const _default: (Path: any, Paths: Plan["Paths"]) => Promise<void | Map<string, string>>; | ||
declare const _default: (Path: any, Paths: Plan["Paths"]) => Promise<Map<string, string>>; | ||
export default _default; |
@@ -1,1 +0,1 @@ | ||
import{fileURLToPath as s}from"url";import o from"../Apply.js";var m=async(i,e)=>o(t=>t instanceof URL?s(t):t,i).then(t=>o(n=>n.endsWith("/")?n:`${n}/`,t).then(n=>n instanceof Map?n.forEach(([r,p])=>e.set(r,p)):e.set(n,n)))||e;export{m as default}; | ||
import o from"../Apply.js";var p=async(a,e)=>{const n=await o(t=>t.endsWith("/")?t:`${t}/`,await o(t=>t instanceof URL?n(t):t,a));if(n instanceof Map)for(const[t,i]of n)e.set(t,i);else e.set(n,n);return e};export{p as default}; |
import type { Options, Plan } from "../../Option/Index.js"; | ||
declare const _default: (Pattern: Options["exclude"], Files: Plan["Results"]) => Promise<Map<string, string>>; | ||
declare const _default: (Pattern: Options["Exclude"], Files: Plan["Results"]) => Promise<Map<string, string>>; | ||
export default _default; |
@@ -1,1 +0,1 @@ | ||
var a=async(n,p)=>new Map(Array.from(p).filter(([f,s])=>!(n instanceof Array?n:n instanceof Set?Array.from(n):[n]).some(o=>typeof o=="string"&&(f.match(o)||s.match(o))||typeof o=="function"&&(o(f)||o(s)))));export{a as default}; | ||
var f=async(n,o)=>{const s=new Set;if(typeof n<"u")if(n instanceof Array||n instanceof Set)for(const t of n)s.add(t);else s.add(n);for(const t of s)for(const e of o)switch(!0){case typeof t=="string":{(e[0].match(t)||e[1].match(t))&&o.delete(e[0]);break}case typeof t=="function":(t(e[0])||t(e[1]))&&o.delete(e[0])}return o};export{f as default}; |
@@ -1,1 +0,1 @@ | ||
import{constants as w}from"fs";import{access as m,mkdir as y,stat as c,writeFile as B}from"fs/promises";import{dirname as l}from"path";var E=async(p,{Fulfilled:a,Failed:s,Accomplished:o,Changed:f,Passed:u,Read:r,Wrote:O})=>{let t=p;for(const[e,g]of t.Results)try{if(t.On.Input=g,t.On.Output=e,t.On.Before=(await c(t.On.Input)).size,r&&O){t.On.Buffer=await r(t.On);const i=await O(t.On);if(!i)continue;if(t.On.Buffer=i,u&&await u(t.On)){try{await m(l(t.On.Output),w.W_OK)}catch{await y(l(t.On.Output),{recursive:!0})}if(await B(t.On.Output,t.On.Buffer,"utf-8"),t.On.After=(await c(t.On.Output)).size,t.Debug>0&&(t.Files++,f&&(t=await f(t))),t.Debug>1&&typeof o=="function"){const n=await o(t.On);n&&n.length>0&&console.log(n)}}}}catch(i){if(t.Results.delete(e),typeof s=="function"){const n=await s(t.On,i);n&&n.length>0&&console.log(n)}else t.Debug>1&&console.log(i)}if(t.Debug>0&&t.Results.size>0&&typeof a=="function"){const e=await a(t);e&&e.length>0&&console.log(e)}return t};export{E as default}; | ||
import{constants as w}from"fs";import{access as m,writeFile as y,mkdir as B,stat as c}from"fs/promises";import{dirname as l}from"path";var E=async(p,{Fulfilled:a,Failed:s,Accomplished:o,Changed:f,Passed:u,Read:r,Wrote:O})=>{let t=p;for(const[e,g]of t.Results)try{if(t.On.Input=g,t.On.Output=e,t.On.Before=(await c(t.On.Input)).size,r&&O){t.On.Buffer=await r(t.On);const i=await O(t.On);if(!i)continue;if(t.On.Buffer=i,u&&await u(t.On)){try{await m(l(t.On.Output),w.W_OK)}catch{await B(l(t.On.Output),{recursive:!0})}if(await y(t.On.Output,t.On.Buffer,"utf-8"),t.On.After=(await c(t.On.Output)).size,t.Debug>0&&(t.Files++,f&&(t=await f(t))),t.Debug>1&&typeof o=="function"){const n=await o(t.On);n&&n.length>0&&console.log(n)}}}}catch(i){if(t.Results.delete(e),typeof s=="function"){const n=await s(t.On,i);n&&n.length>0&&console.log(n)}else t.Debug>1&&console.log(i)}if(t.Debug>0&&t.Results.size>0&&typeof a=="function"){const e=await a(t);e&&e.length>0&&console.log(e)}return t};export{E as default}; |
@@ -1,1 +0,1 @@ | ||
import{readFile as t}from"fs/promises";var i={Path:"./Target",Logger:2,Pipe:{Wrote:async e=>e.Buffer,Read:async e=>await t(e.Input,"utf-8"),Passed:async e=>e&&!0,Failed:async e=>`Error: Cannot process file ${e.Input}!`,Accomplished:async e=>`Processed ${e.Input} in ${e.Output}.`,Fulfilled:async e=>e.files>0?`Successfully processed a total of ${e.Files} ${e.Files===1?"file":"files"}.`:!1,Changed:async e=>e}};export{i as default}; | ||
import{readFile as t}from"fs/promises";var i={Path:"./Target",Logger:2,Pipe:{Wrote:async e=>e.Buffer,Read:async e=>await t(e.Input,"utf-8"),Passed:async e=>e&&!0,Failed:async e=>`Error: Cannot process file ${e.Input}!`,Accomplished:async e=>`Processed ${e.Input} in ${e.Output}.`,Fulfilled:async e=>e.Files>0?`Successfully processed a total of ${e.Files} ${e.Files===1?"file":"files"}.`:!1,Changed:async e=>e}};export{i as default}; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
8692
64
0