@design-edito/tools 0.0.25 → 0.0.26
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export default function getDocument(): Promise<
|
1
|
+
export default function getDocument(): Promise<any>;
|
@@ -1 +1 @@
|
|
1
|
-
export default function selectorToElement(selector: string, documentObj?: Document): Promise<
|
1
|
+
export default function selectorToElement(selector: string, documentObj?: Document): Promise<any>;
|
@@ -1,13 +1,13 @@
|
|
1
1
|
export declare function makeTextBlock(text: string, vPadding?: number, hPadding?: number): string;
|
2
2
|
export declare const styles: {
|
3
3
|
regular: (text: string) => string;
|
4
|
-
light: (text: string) =>
|
5
|
-
danger: (text: string) =>
|
6
|
-
important: (text: string) =>
|
4
|
+
light: (text: string) => any;
|
5
|
+
danger: (text: string) => any;
|
6
|
+
important: (text: string) => any;
|
7
7
|
title: (text: string) => string;
|
8
|
-
info: (text: string) =>
|
9
|
-
error: (text: string) =>
|
10
|
-
warning: (text: string) =>
|
8
|
+
info: (text: string) => any;
|
9
|
+
error: (text: string) => any;
|
10
|
+
warning: (text: string) => any;
|
11
11
|
};
|
12
12
|
type ConsoleMethod = 'assert' | 'count' | 'countReset' | 'debug' | 'dir' | 'dirxml' | 'error' | 'group' | 'groupCollapsed' | 'groupEnd' | 'info' | 'log' | 'table' | 'time' | 'timeEnd' | 'trace' | 'warn';
|
13
13
|
type ConsoleMethodsParams = {
|
@@ -14,14 +14,20 @@ export type Options = {
|
|
14
14
|
followSimlinks?: boolean;
|
15
15
|
dedupeSimlinksContents?: boolean;
|
16
16
|
maxDepth?: number;
|
17
|
-
|
17
|
+
returnRelative?: boolean;
|
18
|
+
exclude?: RegExp | null;
|
19
|
+
include?: RegExp | null;
|
20
|
+
filter?: ((path: string, details: ChildDetails) => boolean | Promise<boolean>);
|
18
21
|
};
|
19
22
|
export declare const defaultOptions: Required<Options>;
|
20
23
|
export declare const fillOptions: (input: Options) => Required<Options>;
|
21
24
|
export type Context = {
|
22
25
|
depth?: number;
|
23
26
|
lstats?: Stats | null;
|
27
|
+
rootPath?: string | null;
|
24
28
|
};
|
25
29
|
export declare const defaultContext: Required<Context>;
|
26
30
|
export declare const fillContext: (input: Context) => Required<Context>;
|
27
|
-
export default function listSubpaths(
|
31
|
+
export default function listSubpaths(...args: Parameters<typeof listAbsoluteSubpaths>): Promise<string[]>;
|
32
|
+
declare function listAbsoluteSubpaths(inputPath: string, _options?: Options, __private_context?: Context): Promise<string[]>;
|
33
|
+
export {};
|
@@ -1 +1 @@
|
|
1
|
-
import{promises as a}from"node:fs";import
|
1
|
+
import{promises as a}from"node:fs";import h from"node:path";var P={directories:!0,files:!0,symlinks:!0,hidden:!0,followSimlinks:!1,dedupeSimlinksContents:!1,maxDepth:1/0,returnRelative:!1,exclude:null,include:null,filter:()=>!0},w=s=>({...P,...s}),v={depth:0,lstats:null,rootPath:null},g=s=>({...v,...s});async function O(...s){let[u,c]=s,t=w(c??{}),e=await p(...s);return t.returnRelative?e.map(i=>h.relative(u,i)):e}async function p(s,u={},c={}){let t=w(u),e=g(c);e.rootPath===null&&(e.rootPath=s);let i=[];if(e.depth>t.maxDepth)return i;try{if(!(e.lstats??await a.lstat(s)).isDirectory())return i}catch{return i}let S=await a.readdir(s);return await Promise.all(S.map(async d=>{let o=h.join(s,d),k=h.relative(e.rootPath??s,o),r=await a.lstat(o);try{let l=r.isDirectory(),n=r.isSymbolicLink(),f=!l&&!n,x=h.basename(o).startsWith("."),C=l?"directory":n?"symlink":"file";if(l&&t.directories===!1)throw!0;if(n&&t.symlinks===!1||f&&t.files===!1||x&&t.hidden===!1)throw!1;let m=n?await a.realpath(o):o,y=t.returnRelative?k:o,R=t.exclude?.test(y)===!0,D=t.include?.test(y)===!0;if(R&&!D)throw!1;if(!await t.filter(y,{type:C,hidden:x,realPath:m}))throw!0;if(n)if(t.followSimlinks===!1)i.push(o);else{let b=await p(m,t,{...e,depth:e.depth+1});i.push(m,...b)}else if(l){let b=await p(o,t,{...e,depth:e.depth+1,lstats:r});i.push(o,...b)}else i.push(o)}catch(l){if(typeof l!="boolean")throw new Error("This try/catch block should only throw booleans");if(!l)return[];let f=await p(o,t,{...e,depth:e.depth+1,lstats:r});i.push(...f)}})),t.dedupeSimlinksContents?Array.from(new Set(i)):i}export{O as default,v as defaultContext,P as defaultOptions,g as fillContext,w as fillOptions};
|