@design-edito/tools 0.5.0 → 0.5.1
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/agnostic/arrays/index.d.ts +1 -1
- package/agnostic/arrays/index.js +1 -1
- package/agnostic/colors/index.d.ts +1 -1
- package/agnostic/colors/index.js +1 -1
- package/agnostic/css/index.d.ts +1 -1
- package/agnostic/css/index.js +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/index.d.ts +13 -13
- package/agnostic/html/hyper-json/smart-tags/coalesced/index.js +13 -13
- package/agnostic/html/hyper-json/smart-tags/isolated/index.d.ts +2 -2
- package/agnostic/html/hyper-json/smart-tags/isolated/index.js +2 -2
- package/agnostic/html/index.d.ts +3 -3
- package/agnostic/html/index.js +3 -3
- package/agnostic/index.d.ts +3 -3
- package/agnostic/index.js +3 -3
- package/agnostic/misc/index.d.ts +1 -1
- package/agnostic/misc/index.js +1 -1
- package/agnostic/numbers/index.d.ts +3 -3
- package/agnostic/numbers/index.js +3 -3
- package/agnostic/objects/index.d.ts +3 -3
- package/agnostic/objects/index.js +3 -3
- package/agnostic/random/index.d.ts +1 -1
- package/agnostic/random/index.js +1 -1
- package/agnostic/strings/index.d.ts +3 -3
- package/agnostic/strings/index.js +3 -3
- package/components/index.d.ts +5 -5
- package/components/index.js +5 -5
- package/node/@google-cloud/storage/directory/index.d.ts +2 -2
- package/node/@google-cloud/storage/directory/index.js +2 -2
- package/node/@google-cloud/storage/file/index.d.ts +2 -2
- package/node/@google-cloud/storage/file/index.js +2 -2
- package/node/@google-cloud/storage/index.d.ts +1 -1
- package/node/@google-cloud/storage/index.js +1 -1
- package/node/cloud-storage/operations/index.d.ts +2 -2
- package/node/cloud-storage/operations/index.js +2 -2
- package/node/files/get-size/index.d.ts +56 -0
- package/node/files/get-size/index.js +167 -0
- package/node/files/get-size/index.test.d.ts +1 -0
- package/node/files/get-size/index.test.js +143 -0
- package/node/files/index.d.ts +1 -0
- package/node/files/index.js +1 -0
- package/node/ftps/directory/index.d.ts +1 -1
- package/node/ftps/directory/index.js +1 -1
- package/node/ftps/file/index.d.ts +2 -2
- package/node/ftps/file/index.js +2 -2
- package/node/images/index.d.ts +1 -1
- package/node/images/index.js +1 -1
- package/node/images/transform/operations/index.d.ts +4 -4
- package/node/images/transform/operations/index.js +4 -4
- package/node/index.d.ts +2 -2
- package/node/index.js +2 -2
- package/node/process/index.d.ts +1 -1
- package/node/process/index.js +1 -1
- package/node/sftp/directory/index.d.ts +1 -1
- package/node/sftp/directory/index.js +1 -1
- package/node/sftp/file/index.d.ts +1 -1
- package/node/sftp/file/index.js +1 -1
- package/package.json +8 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * as dedupe from './dedupe/index.js'
|
|
2
2
|
export * as findDuplicates from './find-duplicates/index.js'
|
|
3
3
|
export * as isArrayOf from './is-array-of/index.js'
|
|
4
|
-
export * as make from './make/index.js'
|
|
5
4
|
export * as randomPick from './random-pick/index.js'
|
|
5
|
+
export * as make from './make/index.js'
|
|
6
6
|
export * as shuffle from './shuffle/index.js'
|
package/agnostic/arrays/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * as dedupe from './dedupe/index.js'
|
|
2
2
|
export * as findDuplicates from './find-duplicates/index.js'
|
|
3
3
|
export * as isArrayOf from './is-array-of/index.js'
|
|
4
|
-
export * as make from './make/index.js'
|
|
5
4
|
export * as randomPick from './random-pick/index.js'
|
|
5
|
+
export * as make from './make/index.js'
|
|
6
6
|
export * as shuffle from './shuffle/index.js'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * as channels from './channels/index.js'
|
|
2
|
-
export * as contrast from './contrast/index.js'
|
|
3
2
|
export * as convert from './convert/index.js'
|
|
3
|
+
export * as contrast from './contrast/index.js'
|
|
4
4
|
export * as distance from './distance/index.js'
|
|
5
5
|
export * as grayscale from './grayscale/index.js'
|
|
6
6
|
export * as invert from './invert/index.js'
|
package/agnostic/colors/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * as channels from './channels/index.js'
|
|
2
|
-
export * as contrast from './contrast/index.js'
|
|
3
2
|
export * as convert from './convert/index.js'
|
|
3
|
+
export * as contrast from './contrast/index.js'
|
|
4
4
|
export * as distance from './distance/index.js'
|
|
5
5
|
export * as grayscale from './grayscale/index.js'
|
|
6
6
|
export * as invert from './invert/index.js'
|
package/agnostic/css/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
export * as isValidCssClassName from './is-valid-css-class-name/index.js'
|
|
1
2
|
export * as bem from './bem/index.js'
|
|
2
3
|
export * as clss from './clss/index.js'
|
|
3
4
|
export * as generateNiceColor from './generate-nice-color/index.js'
|
|
4
|
-
export * as isValidCssClassName from './is-valid-css-class-name/index.js'
|
|
5
5
|
export * as scale from './scale/index.js'
|
|
6
6
|
export * as stylesSet from './styles-set/index.js'
|
package/agnostic/css/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
export * as isValidCssClassName from './is-valid-css-class-name/index.js'
|
|
1
2
|
export * as bem from './bem/index.js'
|
|
2
3
|
export * as clss from './clss/index.js'
|
|
3
4
|
export * as generateNiceColor from './generate-nice-color/index.js'
|
|
4
|
-
export * as isValidCssClassName from './is-valid-css-class-name/index.js'
|
|
5
5
|
export * as scale from './scale/index.js'
|
|
6
6
|
export * as stylesSet from './styles-set/index.js'
|
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
export * as add from './add/index.js'
|
|
2
2
|
export * as addclass from './addclass/index.js'
|
|
3
3
|
export * as and from './and/index.js'
|
|
4
|
-
export * as append from './append/index.js'
|
|
5
|
-
export * as call from './call/index.js'
|
|
6
4
|
export * as at from './at/index.js'
|
|
5
|
+
export * as call from './call/index.js'
|
|
6
|
+
export * as append from './append/index.js'
|
|
7
7
|
export * as clone from './clone/index.js'
|
|
8
8
|
export * as deleteproperties from './deleteproperties/index.js'
|
|
9
9
|
export * as equals from './equals/index.js'
|
|
10
|
-
export * as getattribute from './getattribute/index.js'
|
|
11
10
|
export * as getproperties from './getproperties/index.js'
|
|
11
|
+
export * as getattribute from './getattribute/index.js'
|
|
12
12
|
export * as getproperty from './getproperty/index.js'
|
|
13
|
-
export * as hjparse from './hjparse/index.js'
|
|
14
13
|
export * as hjstringify from './hjstringify/index.js'
|
|
14
|
+
export * as hjparse from './hjparse/index.js'
|
|
15
|
+
export * as initialize from './initialize/index.js'
|
|
15
16
|
export * as join from './join/index.js'
|
|
16
17
|
export * as length from './length/index.js'
|
|
17
|
-
export * as
|
|
18
|
-
export * as initialize from './initialize/index.js'
|
|
18
|
+
export * as map from './map/index.js'
|
|
19
19
|
export * as negate from './negate/index.js'
|
|
20
20
|
export * as notrailing from './notrailing/index.js'
|
|
21
21
|
export * as or from './or/index.js'
|
|
22
22
|
export * as pickrandom from './pickrandom/index.js'
|
|
23
|
+
export * as if from './if/index.js'
|
|
23
24
|
export * as populate from './populate/index.js'
|
|
24
25
|
export * as print from './print/index.js'
|
|
25
26
|
export * as push from './push/index.js'
|
|
26
|
-
export * as map from './map/index.js'
|
|
27
27
|
export * as pusheach from './pusheach/index.js'
|
|
28
28
|
export * as recordtoarray from './recordtoarray/index.js'
|
|
29
29
|
export * as removeattribute from './removeattribute/index.js'
|
|
30
30
|
export * as removeclass from './removeclass/index.js'
|
|
31
|
-
export * as replace from './replace/index.js'
|
|
32
|
-
export * as select from './select/index.js'
|
|
33
31
|
export * as renameproperty from './renameproperty/index.js'
|
|
34
|
-
export * as
|
|
32
|
+
export * as replace from './replace/index.js'
|
|
35
33
|
export * as setattribute from './setattribute/index.js'
|
|
36
34
|
export * as setproperty from './setproperty/index.js'
|
|
37
35
|
export * as sorton from './sorton/index.js'
|
|
38
36
|
export * as split from './split/index.js'
|
|
39
37
|
export * as spread from './spread/index.js'
|
|
38
|
+
export * as set from './set/index.js'
|
|
40
39
|
export * as toarray from './toarray/index.js'
|
|
41
40
|
export * as toboolean from './toboolean/index.js'
|
|
41
|
+
export * as select from './select/index.js'
|
|
42
42
|
export * as toelement from './toelement/index.js'
|
|
43
|
-
export * as
|
|
43
|
+
export * as tonumber from './tonumber/index.js'
|
|
44
44
|
export * as tonodelist from './tonodelist/index.js'
|
|
45
45
|
export * as tonull from './tonull/index.js'
|
|
46
|
-
export * as
|
|
47
|
-
export * as torecord from './torecord/index.js'
|
|
46
|
+
export * as toggleclass from './toggleclass/index.js'
|
|
48
47
|
export * as toref from './toref/index.js'
|
|
49
48
|
export * as tostring from './tostring/index.js'
|
|
50
49
|
export * as totext from './totext/index.js'
|
|
51
50
|
export * as transformselected from './transformselected/index.js'
|
|
52
51
|
export * as trim from './trim/index.js'
|
|
52
|
+
export * as torecord from './torecord/index.js'
|
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
export * as add from './add/index.js'
|
|
2
2
|
export * as addclass from './addclass/index.js'
|
|
3
3
|
export * as and from './and/index.js'
|
|
4
|
-
export * as append from './append/index.js'
|
|
5
|
-
export * as call from './call/index.js'
|
|
6
4
|
export * as at from './at/index.js'
|
|
5
|
+
export * as call from './call/index.js'
|
|
6
|
+
export * as append from './append/index.js'
|
|
7
7
|
export * as clone from './clone/index.js'
|
|
8
8
|
export * as deleteproperties from './deleteproperties/index.js'
|
|
9
9
|
export * as equals from './equals/index.js'
|
|
10
|
-
export * as getattribute from './getattribute/index.js'
|
|
11
10
|
export * as getproperties from './getproperties/index.js'
|
|
11
|
+
export * as getattribute from './getattribute/index.js'
|
|
12
12
|
export * as getproperty from './getproperty/index.js'
|
|
13
|
-
export * as hjparse from './hjparse/index.js'
|
|
14
13
|
export * as hjstringify from './hjstringify/index.js'
|
|
14
|
+
export * as hjparse from './hjparse/index.js'
|
|
15
|
+
export * as initialize from './initialize/index.js'
|
|
15
16
|
export * as join from './join/index.js'
|
|
16
17
|
export * as length from './length/index.js'
|
|
17
|
-
export * as
|
|
18
|
-
export * as initialize from './initialize/index.js'
|
|
18
|
+
export * as map from './map/index.js'
|
|
19
19
|
export * as negate from './negate/index.js'
|
|
20
20
|
export * as notrailing from './notrailing/index.js'
|
|
21
21
|
export * as or from './or/index.js'
|
|
22
22
|
export * as pickrandom from './pickrandom/index.js'
|
|
23
|
+
export * as if from './if/index.js'
|
|
23
24
|
export * as populate from './populate/index.js'
|
|
24
25
|
export * as print from './print/index.js'
|
|
25
26
|
export * as push from './push/index.js'
|
|
26
|
-
export * as map from './map/index.js'
|
|
27
27
|
export * as pusheach from './pusheach/index.js'
|
|
28
28
|
export * as recordtoarray from './recordtoarray/index.js'
|
|
29
29
|
export * as removeattribute from './removeattribute/index.js'
|
|
30
30
|
export * as removeclass from './removeclass/index.js'
|
|
31
|
-
export * as replace from './replace/index.js'
|
|
32
|
-
export * as select from './select/index.js'
|
|
33
31
|
export * as renameproperty from './renameproperty/index.js'
|
|
34
|
-
export * as
|
|
32
|
+
export * as replace from './replace/index.js'
|
|
35
33
|
export * as setattribute from './setattribute/index.js'
|
|
36
34
|
export * as setproperty from './setproperty/index.js'
|
|
37
35
|
export * as sorton from './sorton/index.js'
|
|
38
36
|
export * as split from './split/index.js'
|
|
39
37
|
export * as spread from './spread/index.js'
|
|
38
|
+
export * as set from './set/index.js'
|
|
40
39
|
export * as toarray from './toarray/index.js'
|
|
41
40
|
export * as toboolean from './toboolean/index.js'
|
|
41
|
+
export * as select from './select/index.js'
|
|
42
42
|
export * as toelement from './toelement/index.js'
|
|
43
|
-
export * as
|
|
43
|
+
export * as tonumber from './tonumber/index.js'
|
|
44
44
|
export * as tonodelist from './tonodelist/index.js'
|
|
45
45
|
export * as tonull from './tonull/index.js'
|
|
46
|
-
export * as
|
|
47
|
-
export * as torecord from './torecord/index.js'
|
|
46
|
+
export * as toggleclass from './toggleclass/index.js'
|
|
48
47
|
export * as toref from './toref/index.js'
|
|
49
48
|
export * as tostring from './tostring/index.js'
|
|
50
49
|
export * as totext from './totext/index.js'
|
|
51
50
|
export * as transformselected from './transformselected/index.js'
|
|
52
51
|
export * as trim from './trim/index.js'
|
|
52
|
+
export * as torecord from './torecord/index.js'
|
|
@@ -3,10 +3,10 @@ export * as array from './array/index.js'
|
|
|
3
3
|
export * as boolean from './boolean/index.js'
|
|
4
4
|
export * as element from './element/index.js'
|
|
5
5
|
export * as get from './get/index.js'
|
|
6
|
-
export * as guess from './guess/index.js'
|
|
7
6
|
export * as nodelist from './nodelist/index.js'
|
|
8
|
-
export * as
|
|
7
|
+
export * as guess from './guess/index.js'
|
|
9
8
|
export * as null from './null/index.js'
|
|
9
|
+
export * as number from './number/index.js'
|
|
10
10
|
export * as record from './record/index.js'
|
|
11
11
|
export * as ref from './ref/index.js'
|
|
12
12
|
export * as string from './string/index.js'
|
|
@@ -3,10 +3,10 @@ export * as array from './array/index.js'
|
|
|
3
3
|
export * as boolean from './boolean/index.js'
|
|
4
4
|
export * as element from './element/index.js'
|
|
5
5
|
export * as get from './get/index.js'
|
|
6
|
-
export * as guess from './guess/index.js'
|
|
7
6
|
export * as nodelist from './nodelist/index.js'
|
|
8
|
-
export * as
|
|
7
|
+
export * as guess from './guess/index.js'
|
|
9
8
|
export * as null from './null/index.js'
|
|
9
|
+
export * as number from './number/index.js'
|
|
10
10
|
export * as record from './record/index.js'
|
|
11
11
|
export * as ref from './ref/index.js'
|
|
12
12
|
export * as string from './string/index.js'
|
package/agnostic/html/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
export * as getNodeAncestors from './get-node-ancestors/index.js'
|
|
1
2
|
export * as deepSelect from './deep-select/index.js'
|
|
2
3
|
export * as getPositionInsideParent from './get-position-inside-parent/index.js'
|
|
3
4
|
export * as hyperJson from './hyper-json/index.js'
|
|
4
5
|
export * as insertNode from './insert-node/index.js'
|
|
5
|
-
export * as placeholders from './placeholders/index.js'
|
|
6
6
|
export * as replaceInElement from './replace-in-element/index.js'
|
|
7
|
-
export * as
|
|
7
|
+
export * as placeholders from './placeholders/index.js'
|
|
8
8
|
export * as stringToNodes from './string-to-nodes/index.js'
|
|
9
|
-
export * as
|
|
9
|
+
export * as selectorToElement from './selector-to-element/index.js'
|
|
10
10
|
export * as watchSelection from './watch-selection/index.js'
|
package/agnostic/html/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
export * as getNodeAncestors from './get-node-ancestors/index.js'
|
|
1
2
|
export * as deepSelect from './deep-select/index.js'
|
|
2
3
|
export * as getPositionInsideParent from './get-position-inside-parent/index.js'
|
|
3
4
|
export * as hyperJson from './hyper-json/index.js'
|
|
4
5
|
export * as insertNode from './insert-node/index.js'
|
|
5
|
-
export * as placeholders from './placeholders/index.js'
|
|
6
6
|
export * as replaceInElement from './replace-in-element/index.js'
|
|
7
|
-
export * as
|
|
7
|
+
export * as placeholders from './placeholders/index.js'
|
|
8
8
|
export * as stringToNodes from './string-to-nodes/index.js'
|
|
9
|
-
export * as
|
|
9
|
+
export * as selectorToElement from './selector-to-element/index.js'
|
|
10
10
|
export * as watchSelection from './watch-selection/index.js'
|
package/agnostic/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export * as arrays from './arrays/index.js'
|
|
2
1
|
export * as booleans from './booleans/index.js'
|
|
3
2
|
export * as colors from './colors/index.js'
|
|
3
|
+
export * as arrays from './arrays/index.js'
|
|
4
4
|
export * as css from './css/index.js'
|
|
5
5
|
export * as errors from './errors/index.js'
|
|
6
|
-
export * as html from './html/index.js'
|
|
7
6
|
export * as misc from './misc/index.js'
|
|
7
|
+
export * as html from './html/index.js'
|
|
8
8
|
export * as numbers from './numbers/index.js'
|
|
9
9
|
export * as objects from './objects/index.js'
|
|
10
10
|
export * as optim from './optim/index.js'
|
|
11
11
|
export * as random from './random/index.js'
|
|
12
|
-
export * as regexps from './regexps/index.js'
|
|
13
12
|
export * as sanitization from './sanitization/index.js'
|
|
14
13
|
export * as strings from './strings/index.js'
|
|
14
|
+
export * as regexps from './regexps/index.js'
|
|
15
15
|
export * as time from './time/index.js'
|
|
16
16
|
export * as typescript from './typescript/index.js'
|
package/agnostic/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export * as arrays from './arrays/index.js'
|
|
2
1
|
export * as booleans from './booleans/index.js'
|
|
3
2
|
export * as colors from './colors/index.js'
|
|
3
|
+
export * as arrays from './arrays/index.js'
|
|
4
4
|
export * as css from './css/index.js'
|
|
5
5
|
export * as errors from './errors/index.js'
|
|
6
|
-
export * as html from './html/index.js'
|
|
7
6
|
export * as misc from './misc/index.js'
|
|
7
|
+
export * as html from './html/index.js'
|
|
8
8
|
export * as numbers from './numbers/index.js'
|
|
9
9
|
export * as objects from './objects/index.js'
|
|
10
10
|
export * as optim from './optim/index.js'
|
|
11
11
|
export * as random from './random/index.js'
|
|
12
|
-
export * as regexps from './regexps/index.js'
|
|
13
12
|
export * as sanitization from './sanitization/index.js'
|
|
14
13
|
export * as strings from './strings/index.js'
|
|
14
|
+
export * as regexps from './regexps/index.js'
|
|
15
15
|
export * as time from './time/index.js'
|
|
16
16
|
export * as typescript from './typescript/index.js'
|
package/agnostic/misc/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export * as crossenv from './crossenv/index.js'
|
|
|
6
6
|
export * as dataSize from './data-size/index.js'
|
|
7
7
|
export * as isConstructorFunction from './is-constructor-function/index.js'
|
|
8
8
|
export * as isNullish from './is-nullish/index.js'
|
|
9
|
+
export * as outcome from './outcome/index.js'
|
|
9
10
|
export * as logs from './logs/index.js'
|
|
10
11
|
export * as loremIpsum from './lorem-ipsum/index.js'
|
|
11
12
|
export * as normalizeExtension from './normalize-extension/index.js'
|
|
12
|
-
export * as outcome from './outcome/index.js'
|
package/agnostic/misc/index.js
CHANGED
|
@@ -6,7 +6,7 @@ export * as crossenv from './crossenv/index.js'
|
|
|
6
6
|
export * as dataSize from './data-size/index.js'
|
|
7
7
|
export * as isConstructorFunction from './is-constructor-function/index.js'
|
|
8
8
|
export * as isNullish from './is-nullish/index.js'
|
|
9
|
+
export * as outcome from './outcome/index.js'
|
|
9
10
|
export * as logs from './logs/index.js'
|
|
10
11
|
export * as loremIpsum from './lorem-ipsum/index.js'
|
|
11
12
|
export * as normalizeExtension from './normalize-extension/index.js'
|
|
12
|
-
export * as outcome from './outcome/index.js'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * as absoluteModulo from './absolute-modulo/index.js'
|
|
2
|
-
export * as approximateRational from './approximate-rational/index.js'
|
|
3
1
|
export * as clamp from './clamp/index.js'
|
|
2
|
+
export * as approximateRational from './approximate-rational/index.js'
|
|
3
|
+
export * as absoluteModulo from './absolute-modulo/index.js'
|
|
4
4
|
export * as geometricProgressions from './geometric-progressions/index.js'
|
|
5
|
-
export * as interpolate from './interpolate/index.js'
|
|
6
5
|
export * as round from './round/index.js'
|
|
6
|
+
export * as interpolate from './interpolate/index.js'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * as absoluteModulo from './absolute-modulo/index.js'
|
|
2
|
-
export * as approximateRational from './approximate-rational/index.js'
|
|
3
1
|
export * as clamp from './clamp/index.js'
|
|
2
|
+
export * as approximateRational from './approximate-rational/index.js'
|
|
3
|
+
export * as absoluteModulo from './absolute-modulo/index.js'
|
|
4
4
|
export * as geometricProgressions from './geometric-progressions/index.js'
|
|
5
|
-
export * as interpolate from './interpolate/index.js'
|
|
6
5
|
export * as round from './round/index.js'
|
|
6
|
+
export * as interpolate from './interpolate/index.js'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * as deepGetProperty from './deep-get-property/index.js'
|
|
2
1
|
export * as enums from './enums/index.js'
|
|
2
|
+
export * as deepGetProperty from './deep-get-property/index.js'
|
|
3
3
|
export * as flattenGetters from './flatten-getters/index.js'
|
|
4
|
-
export * as isObject from './is-object/index.js'
|
|
5
4
|
export * as isRecord from './is-record/index.js'
|
|
6
|
-
export * as
|
|
5
|
+
export * as isObject from './is-object/index.js'
|
|
7
6
|
export * as recordMap from './record-map/index.js'
|
|
7
|
+
export * as recordFormat from './record-format/index.js'
|
|
8
8
|
export * as sortKeys from './sort-keys/index.js'
|
|
9
9
|
export * as validation from './validation/index.js'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * as deepGetProperty from './deep-get-property/index.js'
|
|
2
1
|
export * as enums from './enums/index.js'
|
|
2
|
+
export * as deepGetProperty from './deep-get-property/index.js'
|
|
3
3
|
export * as flattenGetters from './flatten-getters/index.js'
|
|
4
|
-
export * as isObject from './is-object/index.js'
|
|
5
4
|
export * as isRecord from './is-record/index.js'
|
|
6
|
-
export * as
|
|
5
|
+
export * as isObject from './is-object/index.js'
|
|
7
6
|
export * as recordMap from './record-map/index.js'
|
|
7
|
+
export * as recordFormat from './record-format/index.js'
|
|
8
8
|
export * as sortKeys from './sort-keys/index.js'
|
|
9
9
|
export * as validation from './validation/index.js'
|
package/agnostic/random/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * as charCodes from './char-codes/index.js'
|
|
2
1
|
export * as matches from './matches/index.js'
|
|
3
|
-
export * as
|
|
2
|
+
export * as charCodes from './char-codes/index.js'
|
|
3
|
+
export * as splitTrim from './split-trim/index.js'
|
|
4
4
|
export * as parseTable from './parse-table/index.js'
|
|
5
5
|
export * as replaceAll from './replace-all/index.js'
|
|
6
|
-
export * as splitTrim from './split-trim/index.js'
|
|
7
6
|
export * as toAlphanum from './to-alphanum/index.js'
|
|
7
|
+
export * as normalizeIndent from './normalize-indent/index.js'
|
|
8
8
|
export * as trim from './trim/index.js'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * as charCodes from './char-codes/index.js'
|
|
2
1
|
export * as matches from './matches/index.js'
|
|
3
|
-
export * as
|
|
2
|
+
export * as charCodes from './char-codes/index.js'
|
|
3
|
+
export * as splitTrim from './split-trim/index.js'
|
|
4
4
|
export * as parseTable from './parse-table/index.js'
|
|
5
5
|
export * as replaceAll from './replace-all/index.js'
|
|
6
|
-
export * as splitTrim from './split-trim/index.js'
|
|
7
6
|
export * as toAlphanum from './to-alphanum/index.js'
|
|
7
|
+
export * as normalizeIndent from './normalize-indent/index.js'
|
|
8
8
|
export * as trim from './trim/index.js'
|
package/components/index.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
export * as beforeAfter from './BeforeAfter/index.js'
|
|
2
2
|
export * as button from './Button/index.js'
|
|
3
3
|
export * as clippable from './Clippable/index.js'
|
|
4
|
-
export * as disclaimer from './Disclaimer/index.js'
|
|
5
4
|
export * as drawer from './Drawer/index.js'
|
|
5
|
+
export * as disclaimer from './Disclaimer/index.js'
|
|
6
6
|
export * as eventListener from './EventListener/index.js'
|
|
7
7
|
export * as gallery from './Gallery/index.js'
|
|
8
8
|
export * as iframe from './Iframe/index.js'
|
|
9
|
-
export * as image from './Image/index.js'
|
|
10
9
|
export * as input from './Input/index.js'
|
|
11
10
|
export * as intersectionObserver from './IntersectionObserver/index.js'
|
|
12
|
-
export * as jsonEditor from './JsonEditor/index.js'
|
|
13
11
|
export * as overlayer from './Overlayer/index.js'
|
|
12
|
+
export * as jsonEditor from './JsonEditor/index.js'
|
|
14
13
|
export * as paginator from './Paginator/index.js'
|
|
15
|
-
export * as scrllgngn from './Scrllgngn/index.js'
|
|
16
14
|
export * as resizeObserver from './ResizeObserver/index.js'
|
|
15
|
+
export * as scrllgngn from './Scrllgngn/index.js'
|
|
17
16
|
export * as scrollListener from './ScrollListener/index.js'
|
|
17
|
+
export * as image from './Image/index.js'
|
|
18
18
|
export * as select from './Select/index.js'
|
|
19
|
-
export * as sequencer from './Sequencer/index.js'
|
|
20
19
|
export * as shadowRoot from './ShadowRoot/index.js'
|
|
20
|
+
export * as sequencer from './Sequencer/index.js'
|
|
21
21
|
export * as subtitles from './Subtitles/index.js'
|
|
22
22
|
export * as textarea from './Textarea/index.js'
|
|
23
23
|
export * as theatre from './Theatre/index.js'
|
package/components/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
export * as beforeAfter from './BeforeAfter/index.js'
|
|
2
2
|
export * as button from './Button/index.js'
|
|
3
3
|
export * as clippable from './Clippable/index.js'
|
|
4
|
-
export * as disclaimer from './Disclaimer/index.js'
|
|
5
4
|
export * as drawer from './Drawer/index.js'
|
|
5
|
+
export * as disclaimer from './Disclaimer/index.js'
|
|
6
6
|
export * as eventListener from './EventListener/index.js'
|
|
7
7
|
export * as gallery from './Gallery/index.js'
|
|
8
8
|
export * as iframe from './Iframe/index.js'
|
|
9
|
-
export * as image from './Image/index.js'
|
|
10
9
|
export * as input from './Input/index.js'
|
|
11
10
|
export * as intersectionObserver from './IntersectionObserver/index.js'
|
|
12
|
-
export * as jsonEditor from './JsonEditor/index.js'
|
|
13
11
|
export * as overlayer from './Overlayer/index.js'
|
|
12
|
+
export * as jsonEditor from './JsonEditor/index.js'
|
|
14
13
|
export * as paginator from './Paginator/index.js'
|
|
15
|
-
export * as scrllgngn from './Scrllgngn/index.js'
|
|
16
14
|
export * as resizeObserver from './ResizeObserver/index.js'
|
|
15
|
+
export * as scrllgngn from './Scrllgngn/index.js'
|
|
17
16
|
export * as scrollListener from './ScrollListener/index.js'
|
|
17
|
+
export * as image from './Image/index.js'
|
|
18
18
|
export * as select from './Select/index.js'
|
|
19
|
-
export * as sequencer from './Sequencer/index.js'
|
|
20
19
|
export * as shadowRoot from './ShadowRoot/index.js'
|
|
20
|
+
export * as sequencer from './Sequencer/index.js'
|
|
21
21
|
export * as subtitles from './Subtitles/index.js'
|
|
22
22
|
export * as textarea from './Textarea/index.js'
|
|
23
23
|
export * as theatre from './Theatre/index.js'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * as
|
|
1
|
+
export * as moveDir from './move-dir/index.js'
|
|
2
2
|
export * as list from './list/index.js'
|
|
3
|
+
export * as copyDir from './copy-dir/index.js'
|
|
3
4
|
export * as removeDir from './remove-dir/index.js'
|
|
4
|
-
export * as moveDir from './move-dir/index.js'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * as
|
|
1
|
+
export * as moveDir from './move-dir/index.js'
|
|
2
2
|
export * as list from './list/index.js'
|
|
3
|
+
export * as copyDir from './copy-dir/index.js'
|
|
3
4
|
export * as removeDir from './remove-dir/index.js'
|
|
4
|
-
export * as moveDir from './move-dir/index.js'
|
|
@@ -4,9 +4,9 @@ export * as exists from './exists/index.js'
|
|
|
4
4
|
export * as generateSignedUrl from './generate-signed-url/index.js'
|
|
5
5
|
export * as getMetadata from './get-metadata/index.js'
|
|
6
6
|
export * as getPermissions from './get-permissions/index.js'
|
|
7
|
-
export * as move from './move/index.js'
|
|
8
7
|
export * as remove from './remove/index.js'
|
|
8
|
+
export * as move from './move/index.js'
|
|
9
9
|
export * as revokeSignedUrls from './revoke-signed-urls/index.js'
|
|
10
10
|
export * as stat from './stat/index.js'
|
|
11
|
-
export * as updateMetadata from './update-metadata/index.js'
|
|
12
11
|
export * as upload from './upload/index.js'
|
|
12
|
+
export * as updateMetadata from './update-metadata/index.js'
|
|
@@ -4,9 +4,9 @@ export * as exists from './exists/index.js'
|
|
|
4
4
|
export * as generateSignedUrl from './generate-signed-url/index.js'
|
|
5
5
|
export * as getMetadata from './get-metadata/index.js'
|
|
6
6
|
export * as getPermissions from './get-permissions/index.js'
|
|
7
|
-
export * as move from './move/index.js'
|
|
8
7
|
export * as remove from './remove/index.js'
|
|
8
|
+
export * as move from './move/index.js'
|
|
9
9
|
export * as revokeSignedUrls from './revoke-signed-urls/index.js'
|
|
10
10
|
export * as stat from './stat/index.js'
|
|
11
|
-
export * as updateMetadata from './update-metadata/index.js'
|
|
12
11
|
export * as upload from './upload/index.js'
|
|
12
|
+
export * as updateMetadata from './update-metadata/index.js'
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export * as copyDir from './copy-dir/index.js'
|
|
2
|
-
export * as copyFile from './copy-file/index.js'
|
|
3
2
|
export * as downloadFile from './download-file/index.js'
|
|
3
|
+
export * as copyFile from './copy-file/index.js'
|
|
4
4
|
export * as existsFile from './exists-file/index.js'
|
|
5
5
|
export * as listDir from './list-dir/index.js'
|
|
6
6
|
export * as moveDir from './move-dir/index.js'
|
|
7
7
|
export * as moveFile from './move-file/index.js'
|
|
8
|
-
export * as removeDir from './remove-dir/index.js'
|
|
9
8
|
export * as removeFile from './remove-file/index.js'
|
|
9
|
+
export * as removeDir from './remove-dir/index.js'
|
|
10
10
|
export * as statFile from './stat-file/index.js'
|
|
11
11
|
export * as uploadFile from './upload-file/index.js'
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export * as copyDir from './copy-dir/index.js'
|
|
2
|
-
export * as copyFile from './copy-file/index.js'
|
|
3
2
|
export * as downloadFile from './download-file/index.js'
|
|
3
|
+
export * as copyFile from './copy-file/index.js'
|
|
4
4
|
export * as existsFile from './exists-file/index.js'
|
|
5
5
|
export * as listDir from './list-dir/index.js'
|
|
6
6
|
export * as moveDir from './move-dir/index.js'
|
|
7
7
|
export * as moveFile from './move-file/index.js'
|
|
8
|
-
export * as removeDir from './remove-dir/index.js'
|
|
9
8
|
export * as removeFile from './remove-file/index.js'
|
|
9
|
+
export * as removeDir from './remove-dir/index.js'
|
|
10
10
|
export * as statFile from './stat-file/index.js'
|
|
11
11
|
export * as uploadFile from './upload-file/index.js'
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type PathLike } from 'node:fs';
|
|
2
|
+
import { Duration } from '../../../agnostic/time/duration/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* How to react to a per-entry read error (a failing `lstat`/`readdir`):
|
|
5
|
+
* - `'throw'`: reject the whole computation (default).
|
|
6
|
+
* - `'skip'`: count the offending entry as 0 bytes and keep going.
|
|
7
|
+
* - a function: called with the error and the offending path, then the entry
|
|
8
|
+
* counts as 0 bytes.
|
|
9
|
+
*/
|
|
10
|
+
export type OnError = 'throw' | 'skip' | ((error: unknown, path: string) => void);
|
|
11
|
+
export type GetSizeOptions = {
|
|
12
|
+
/** Maximum number of concurrent filesystem reads. Bounds file-descriptor usage on large trees. @default 32 */
|
|
13
|
+
concurrency?: number;
|
|
14
|
+
/** How to handle a per-entry read error. @default 'throw' */
|
|
15
|
+
onError?: OnError;
|
|
16
|
+
/** Abort the traversal; aborting rejects with the signal's reason. */
|
|
17
|
+
signal?: AbortSignal;
|
|
18
|
+
/** Abort the traversal after this delay. A `number` is milliseconds; a `Duration` is converted via `toMs()`. Combined with `signal` when both are given. */
|
|
19
|
+
timeoutMs?: number | Duration;
|
|
20
|
+
/** Maximum directory depth to descend; entries deeper than this are not counted. @default Infinity */
|
|
21
|
+
maxDepth?: number;
|
|
22
|
+
/** Follow symbolic links instead of counting the link itself. Cycle-safe via inode tracking. @default false */
|
|
23
|
+
followSymlinks?: boolean;
|
|
24
|
+
/** Count a file reached through several hard links only once. @default false */
|
|
25
|
+
dedupeHardlinks?: boolean;
|
|
26
|
+
/** `'content'` = apparent size (`stat.size`); `'allocated'` = on-disk blocks (`stat.blocks × 512`). @default 'content' */
|
|
27
|
+
sizeOf?: 'content' | 'allocated';
|
|
28
|
+
};
|
|
29
|
+
export declare const defaultGetSizeOptions: {
|
|
30
|
+
concurrency: number;
|
|
31
|
+
onError: "throw";
|
|
32
|
+
maxDepth: number;
|
|
33
|
+
followSymlinks: false;
|
|
34
|
+
dedupeHardlinks: false;
|
|
35
|
+
sizeOf: "content";
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Computes the total size, in bytes, of a file or directory.
|
|
39
|
+
*
|
|
40
|
+
* For a regular file, returns its own size. For a directory, returns the summed
|
|
41
|
+
* size of everything it contains, recursively.
|
|
42
|
+
*
|
|
43
|
+
* @param target - Path to a file or directory (`string`, `Buffer`, or a `file:` URL).
|
|
44
|
+
* @param [options] - Optional configuration. See `GetSizeOptions`.
|
|
45
|
+
* @returns The total size in bytes.
|
|
46
|
+
*
|
|
47
|
+
* @remarks
|
|
48
|
+
* By default symbolic links are not followed (each link counts as its own small
|
|
49
|
+
* size) and hard links are counted once per link. Enable `followSymlinks` to
|
|
50
|
+
* resolve links — cycles and repeated targets are made safe by tracking visited
|
|
51
|
+
* inodes — and `dedupeHardlinks` to count a shared inode only once.
|
|
52
|
+
*
|
|
53
|
+
* @throws If a path cannot be read and `onError` is `'throw'` (the default), or if
|
|
54
|
+
* `options.signal` is aborted.
|
|
55
|
+
*/
|
|
56
|
+
export declare function getSize(target: PathLike, options?: GetSizeOptions): Promise<number>;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { promises as fs } from 'node:fs';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { Duration } from '../../../agnostic/time/duration/index.js';
|
|
5
|
+
export const defaultGetSizeOptions = {
|
|
6
|
+
concurrency: 32,
|
|
7
|
+
onError: 'throw',
|
|
8
|
+
maxDepth: Infinity,
|
|
9
|
+
followSymlinks: false,
|
|
10
|
+
dedupeHardlinks: false,
|
|
11
|
+
sizeOf: 'content'
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Computes the total size, in bytes, of a file or directory.
|
|
15
|
+
*
|
|
16
|
+
* For a regular file, returns its own size. For a directory, returns the summed
|
|
17
|
+
* size of everything it contains, recursively.
|
|
18
|
+
*
|
|
19
|
+
* @param target - Path to a file or directory (`string`, `Buffer`, or a `file:` URL).
|
|
20
|
+
* @param [options] - Optional configuration. See `GetSizeOptions`.
|
|
21
|
+
* @returns The total size in bytes.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* By default symbolic links are not followed (each link counts as its own small
|
|
25
|
+
* size) and hard links are counted once per link. Enable `followSymlinks` to
|
|
26
|
+
* resolve links — cycles and repeated targets are made safe by tracking visited
|
|
27
|
+
* inodes — and `dedupeHardlinks` to count a shared inode only once.
|
|
28
|
+
*
|
|
29
|
+
* @throws If a path cannot be read and `onError` is `'throw'` (the default), or if
|
|
30
|
+
* `options.signal` is aborted.
|
|
31
|
+
*/
|
|
32
|
+
export async function getSize(target, options = {}) {
|
|
33
|
+
const concurrency = Math.max(1, Math.floor(options.concurrency ?? defaultGetSizeOptions.concurrency));
|
|
34
|
+
const timeoutMs = options.timeoutMs instanceof Duration ? options.timeoutMs.toMs() : options.timeoutMs;
|
|
35
|
+
const timeout = timeoutMs === undefined ? null : createTimeoutSignal(timeoutMs, options.signal);
|
|
36
|
+
const resolved = {
|
|
37
|
+
onError: options.onError ?? defaultGetSizeOptions.onError,
|
|
38
|
+
signal: timeout?.signal ?? options.signal,
|
|
39
|
+
limit: createLimiter(concurrency),
|
|
40
|
+
maxDepth: options.maxDepth ?? defaultGetSizeOptions.maxDepth,
|
|
41
|
+
followSymlinks: options.followSymlinks ?? defaultGetSizeOptions.followSymlinks,
|
|
42
|
+
dedupeHardlinks: options.dedupeHardlinks ?? defaultGetSizeOptions.dedupeHardlinks,
|
|
43
|
+
sizeOf: options.sizeOf ?? defaultGetSizeOptions.sizeOf,
|
|
44
|
+
visited: new Set()
|
|
45
|
+
};
|
|
46
|
+
try {
|
|
47
|
+
return await computeSize(toPathString(target), resolved, 0);
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
timeout?.dispose();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// Builds an abort signal that fires after `timeoutMs`, merged with a caller
|
|
54
|
+
// signal when provided. Aborting either aborts the returned one. `dispose`
|
|
55
|
+
// clears the timer and detaches the listener.
|
|
56
|
+
function createTimeoutSignal(timeoutMs, userSignal) {
|
|
57
|
+
const controller = new AbortController();
|
|
58
|
+
const timer = setTimeout(() => { controller.abort(new Error(`getSize timed out after ${timeoutMs} ms`)); }, Math.max(0, timeoutMs));
|
|
59
|
+
timer.unref();
|
|
60
|
+
if (userSignal === undefined) {
|
|
61
|
+
return { signal: controller.signal, dispose: () => { clearTimeout(timer); } };
|
|
62
|
+
}
|
|
63
|
+
if (userSignal.aborted)
|
|
64
|
+
controller.abort(userSignal.reason);
|
|
65
|
+
const onUserAbort = () => { controller.abort(userSignal.reason); };
|
|
66
|
+
userSignal.addEventListener('abort', onUserAbort, { once: true });
|
|
67
|
+
return {
|
|
68
|
+
signal: controller.signal,
|
|
69
|
+
dispose: () => {
|
|
70
|
+
clearTimeout(timer);
|
|
71
|
+
userSignal.removeEventListener('abort', onUserAbort);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function toPathString(target) {
|
|
76
|
+
if (typeof target === 'string')
|
|
77
|
+
return target;
|
|
78
|
+
if (Buffer.isBuffer(target))
|
|
79
|
+
return target.toString('utf-8');
|
|
80
|
+
return fileURLToPath(target);
|
|
81
|
+
}
|
|
82
|
+
function measure(stats, options) {
|
|
83
|
+
return options.sizeOf === 'allocated' ? stats.blocks * 512 : stats.size;
|
|
84
|
+
}
|
|
85
|
+
async function computeSize(target, options, depth) {
|
|
86
|
+
options.signal?.throwIfAborted();
|
|
87
|
+
let stats;
|
|
88
|
+
try {
|
|
89
|
+
stats = await options.limit(async () => await fs.lstat(target));
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
return handleError(error, target, options);
|
|
93
|
+
}
|
|
94
|
+
// Resolve symlinks when asked; otherwise a link counts as its own size.
|
|
95
|
+
let realTarget = target;
|
|
96
|
+
if (stats.isSymbolicLink()) {
|
|
97
|
+
if (!options.followSymlinks)
|
|
98
|
+
return measure(stats, options);
|
|
99
|
+
try {
|
|
100
|
+
stats = await options.limit(async () => await fs.stat(target));
|
|
101
|
+
if (stats.isDirectory())
|
|
102
|
+
realTarget = await options.limit(async () => await fs.realpath(target));
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
return handleError(error, target, options);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// Count each physical inode once when following links (cycle safety) or
|
|
109
|
+
// deduping hard links.
|
|
110
|
+
if (options.followSymlinks || options.dedupeHardlinks) {
|
|
111
|
+
const key = `${stats.dev}:${stats.ino}`;
|
|
112
|
+
if (options.visited.has(key))
|
|
113
|
+
return 0;
|
|
114
|
+
options.visited.add(key);
|
|
115
|
+
}
|
|
116
|
+
if (!stats.isDirectory())
|
|
117
|
+
return measure(stats, options);
|
|
118
|
+
if (depth >= options.maxDepth)
|
|
119
|
+
return 0;
|
|
120
|
+
let children;
|
|
121
|
+
try {
|
|
122
|
+
children = await options.limit(async () => await fs.readdir(realTarget));
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
return handleError(error, realTarget, options);
|
|
126
|
+
}
|
|
127
|
+
const childSizes = await Promise.all(children.map(async (child) => await computeSize(path.join(realTarget, child), options, depth + 1)));
|
|
128
|
+
return childSizes.reduce((total, size) => total + size, 0);
|
|
129
|
+
}
|
|
130
|
+
function handleError(error, target, options) {
|
|
131
|
+
if (options.onError === 'throw')
|
|
132
|
+
throw error;
|
|
133
|
+
if (typeof options.onError === 'function')
|
|
134
|
+
options.onError(error, target);
|
|
135
|
+
return 0;
|
|
136
|
+
}
|
|
137
|
+
// Global concurrency limiter: at most `max` wrapped calls run at once. Wrapped
|
|
138
|
+
// calls must be leaf operations (single fs syscalls) that never await another
|
|
139
|
+
// wrapped call, so the recursive traversal cannot deadlock on slots.
|
|
140
|
+
function createLimiter(max) {
|
|
141
|
+
let active = 0;
|
|
142
|
+
const waiters = [];
|
|
143
|
+
const acquire = async () => {
|
|
144
|
+
if (active < max) {
|
|
145
|
+
active += 1;
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
// Resumed by `release`, which hands over the slot without decrementing.
|
|
149
|
+
await new Promise(resolve => { waiters.push(resolve); });
|
|
150
|
+
};
|
|
151
|
+
const release = () => {
|
|
152
|
+
const resume = waiters.shift();
|
|
153
|
+
if (resume !== undefined)
|
|
154
|
+
resume();
|
|
155
|
+
else
|
|
156
|
+
active -= 1;
|
|
157
|
+
};
|
|
158
|
+
return async function limit(fn) {
|
|
159
|
+
await acquire();
|
|
160
|
+
try {
|
|
161
|
+
return await fn();
|
|
162
|
+
}
|
|
163
|
+
finally {
|
|
164
|
+
release();
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
|
2
|
+
import { promises as fs } from 'node:fs';
|
|
3
|
+
import { pathToFileURL } from 'node:url';
|
|
4
|
+
import os from 'node:os';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { getSize } from './index.js';
|
|
7
|
+
import { seconds } from '../../../agnostic/time/duration/index.js';
|
|
8
|
+
// Fixtures (all under the OS temp dir):
|
|
9
|
+
// root/ a.txt (10) + sub/b.txt (5) + sub/empty/
|
|
10
|
+
// wideRoot/ 60 x 1-byte files (exercises concurrency)
|
|
11
|
+
// linkRoot/ target.txt (7) + link -> target.txt (symlink to file)
|
|
12
|
+
// cycleRoot/ self -> cycleRoot (symlink cycle to its own dir)
|
|
13
|
+
// hlRoot/ original.txt (9) + hard.txt (hard link to original.txt)
|
|
14
|
+
let root;
|
|
15
|
+
let wideRoot;
|
|
16
|
+
let linkRoot;
|
|
17
|
+
let cycleRoot;
|
|
18
|
+
let hlRoot;
|
|
19
|
+
const aBytes = 10;
|
|
20
|
+
const bBytes = 5;
|
|
21
|
+
const wideFileCount = 60;
|
|
22
|
+
const targetBytes = 7;
|
|
23
|
+
const hardBytes = 9;
|
|
24
|
+
beforeAll(async () => {
|
|
25
|
+
root = await fs.mkdtemp(path.join(os.tmpdir(), 'lm-get-size-'));
|
|
26
|
+
await fs.writeFile(path.join(root, 'a.txt'), 'x'.repeat(aBytes));
|
|
27
|
+
await fs.mkdir(path.join(root, 'sub'));
|
|
28
|
+
await fs.writeFile(path.join(root, 'sub', 'b.txt'), 'y'.repeat(bBytes));
|
|
29
|
+
await fs.mkdir(path.join(root, 'sub', 'empty'));
|
|
30
|
+
wideRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'lm-get-size-wide-'));
|
|
31
|
+
await Promise.all([...Array(wideFileCount)].map(async (_, i) => await fs.writeFile(path.join(wideRoot, `f${i}.txt`), 'z')));
|
|
32
|
+
linkRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'lm-get-size-link-'));
|
|
33
|
+
await fs.writeFile(path.join(linkRoot, 'target.txt'), 't'.repeat(targetBytes));
|
|
34
|
+
await fs.symlink(path.join(linkRoot, 'target.txt'), path.join(linkRoot, 'link'));
|
|
35
|
+
cycleRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'lm-get-size-cycle-'));
|
|
36
|
+
await fs.symlink(cycleRoot, path.join(cycleRoot, 'self'));
|
|
37
|
+
hlRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'lm-get-size-hl-'));
|
|
38
|
+
await fs.writeFile(path.join(hlRoot, 'original.txt'), 'h'.repeat(hardBytes));
|
|
39
|
+
await fs.link(path.join(hlRoot, 'original.txt'), path.join(hlRoot, 'hard.txt'));
|
|
40
|
+
});
|
|
41
|
+
afterAll(async () => {
|
|
42
|
+
await Promise.all([root, wideRoot, linkRoot, cycleRoot, hlRoot].map(async (dir) => await fs.rm(dir, { recursive: true, force: true })));
|
|
43
|
+
});
|
|
44
|
+
describe('getSize', () => {
|
|
45
|
+
it('returns the size of a single file', async () => {
|
|
46
|
+
expect(await getSize(path.join(root, 'a.txt'))).toBe(aBytes);
|
|
47
|
+
});
|
|
48
|
+
it('sums the sizes of a directory recursively', async () => {
|
|
49
|
+
expect(await getSize(root)).toBe(aBytes + bBytes);
|
|
50
|
+
});
|
|
51
|
+
it('returns the size of a nested directory', async () => {
|
|
52
|
+
expect(await getSize(path.join(root, 'sub'))).toBe(bBytes);
|
|
53
|
+
});
|
|
54
|
+
it('returns 0 for an empty directory', async () => {
|
|
55
|
+
expect(await getSize(path.join(root, 'sub', 'empty'))).toBe(0);
|
|
56
|
+
});
|
|
57
|
+
describe('PathLike variants', () => {
|
|
58
|
+
it('accepts a Buffer path', async () => {
|
|
59
|
+
expect(await getSize(Buffer.from(path.join(root, 'a.txt')))).toBe(aBytes);
|
|
60
|
+
});
|
|
61
|
+
it('accepts a file: URL', async () => {
|
|
62
|
+
expect(await getSize(pathToFileURL(root))).toBe(aBytes + bBytes);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
it('rejects when the path does not exist', async () => {
|
|
66
|
+
await expect(getSize(path.join(root, 'does-not-exist'))).rejects.toThrow();
|
|
67
|
+
});
|
|
68
|
+
describe('concurrency', () => {
|
|
69
|
+
it('computes the same total with concurrency: 1', async () => {
|
|
70
|
+
expect(await getSize(root, { concurrency: 1 })).toBe(aBytes + bBytes);
|
|
71
|
+
});
|
|
72
|
+
it('handles a wide directory under a low concurrency', async () => {
|
|
73
|
+
expect(await getSize(wideRoot, { concurrency: 4 })).toBe(wideFileCount);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
describe('onError', () => {
|
|
77
|
+
it("counts a missing path as 0 when onError is 'skip'", async () => {
|
|
78
|
+
expect(await getSize(path.join(root, 'nope'), { onError: 'skip' })).toBe(0);
|
|
79
|
+
});
|
|
80
|
+
it('invokes the onError callback and skips the entry', async () => {
|
|
81
|
+
const seen = [];
|
|
82
|
+
const size = await getSize(path.join(root, 'nope'), {
|
|
83
|
+
onError: (_error, failedPath) => { seen.push(failedPath); }
|
|
84
|
+
});
|
|
85
|
+
expect(size).toBe(0);
|
|
86
|
+
expect(seen).toHaveLength(1);
|
|
87
|
+
expect(seen[0]).toBe(path.join(root, 'nope'));
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
describe('signal', () => {
|
|
91
|
+
it('rejects when the signal is already aborted', async () => {
|
|
92
|
+
await expect(getSize(root, { signal: AbortSignal.abort() })).rejects.toThrow();
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
describe('maxDepth', () => {
|
|
96
|
+
it('counts only the first level with maxDepth: 1', async () => {
|
|
97
|
+
// a.txt (depth 1) counted; sub/ is a dir at depth 1, not descended.
|
|
98
|
+
expect(await getSize(root, { maxDepth: 1 })).toBe(aBytes);
|
|
99
|
+
});
|
|
100
|
+
it('descends one more level with maxDepth: 2', async () => {
|
|
101
|
+
expect(await getSize(root, { maxDepth: 2 })).toBe(aBytes + bBytes);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
describe('followSymlinks', () => {
|
|
105
|
+
it('does not follow links by default (link counts as its own size)', async () => {
|
|
106
|
+
// target.txt (7) + the link's own (non-zero) size.
|
|
107
|
+
expect(await getSize(linkRoot)).toBeGreaterThan(targetBytes);
|
|
108
|
+
});
|
|
109
|
+
it('follows links and dedupes the shared target', async () => {
|
|
110
|
+
// The link resolves to target.txt, so the shared inode is counted once.
|
|
111
|
+
expect(await getSize(linkRoot, { followSymlinks: true })).toBe(targetBytes);
|
|
112
|
+
});
|
|
113
|
+
it('is cycle-safe when a link points back into the tree', async () => {
|
|
114
|
+
expect(await getSize(cycleRoot, { followSymlinks: true })).toBe(0);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
describe('dedupeHardlinks', () => {
|
|
118
|
+
it('counts each hard link separately by default', async () => {
|
|
119
|
+
expect(await getSize(hlRoot)).toBe(hardBytes * 2);
|
|
120
|
+
});
|
|
121
|
+
it('counts a shared inode once when dedupeHardlinks is set', async () => {
|
|
122
|
+
expect(await getSize(hlRoot, { dedupeHardlinks: true })).toBe(hardBytes);
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
describe('sizeOf', () => {
|
|
126
|
+
it("'allocated' is at least the apparent content size", async () => {
|
|
127
|
+
const content = await getSize(root);
|
|
128
|
+
const allocated = await getSize(root, { sizeOf: 'allocated' });
|
|
129
|
+
expect(allocated).toBeGreaterThanOrEqual(content);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
describe('timeoutMs', () => {
|
|
133
|
+
it('completes normally within a generous timeout (number)', async () => {
|
|
134
|
+
expect(await getSize(root, { timeoutMs: 10_000 })).toBe(aBytes + bBytes);
|
|
135
|
+
});
|
|
136
|
+
it('accepts a Duration', async () => {
|
|
137
|
+
expect(await getSize(root, { timeoutMs: seconds(10) })).toBe(aBytes + bBytes);
|
|
138
|
+
});
|
|
139
|
+
it('still honours an already-aborted signal when combined with a timeout', async () => {
|
|
140
|
+
await expect(getSize(root, { timeoutMs: 10_000, signal: AbortSignal.abort() })).rejects.toThrow();
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
});
|
package/node/files/index.d.ts
CHANGED
package/node/files/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * as copy from './copy/index.js'
|
|
2
1
|
export * as download from './download/index.js'
|
|
3
|
-
export * as
|
|
2
|
+
export * as copy from './copy/index.js'
|
|
4
3
|
export * as move from './move/index.js'
|
|
4
|
+
export * as exists from './exists/index.js'
|
|
5
5
|
export * as remove from './remove/index.js'
|
|
6
6
|
export * as stat from './stat/index.js'
|
|
7
7
|
export * as upload from './upload/index.js'
|
package/node/ftps/file/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * as copy from './copy/index.js'
|
|
2
1
|
export * as download from './download/index.js'
|
|
3
|
-
export * as
|
|
2
|
+
export * as copy from './copy/index.js'
|
|
4
3
|
export * as move from './move/index.js'
|
|
4
|
+
export * as exists from './exists/index.js'
|
|
5
5
|
export * as remove from './remove/index.js'
|
|
6
6
|
export * as stat from './stat/index.js'
|
|
7
7
|
export * as upload from './upload/index.js'
|
package/node/images/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * as create from './create/index.js'
|
|
2
1
|
export * as format from './format/index.js'
|
|
3
2
|
export * as metadata from './metadata/index.js'
|
|
3
|
+
export * as create from './create/index.js'
|
|
4
4
|
export * as transform from './transform/index.js'
|
|
5
5
|
export * as utils from './utils/index.js'
|
package/node/images/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * as create from './create/index.js'
|
|
2
1
|
export * as format from './format/index.js'
|
|
3
2
|
export * as metadata from './metadata/index.js'
|
|
3
|
+
export * as create from './create/index.js'
|
|
4
4
|
export * as transform from './transform/index.js'
|
|
5
5
|
export * as utils from './utils/index.js'
|
|
@@ -5,11 +5,11 @@ export * as extract from './extract/index.js'
|
|
|
5
5
|
export * as flatten from './flatten/index.js'
|
|
6
6
|
export * as flip from './flip/index.js'
|
|
7
7
|
export * as flop from './flop/index.js'
|
|
8
|
-
export * as hue from './hue/index.js'
|
|
9
|
-
export * as level from './level/index.js'
|
|
10
8
|
export * as lighten from './lighten/index.js'
|
|
9
|
+
export * as level from './level/index.js'
|
|
11
10
|
export * as normalize from './normalize/index.js'
|
|
12
|
-
export * as overlay from './overlay/index.js'
|
|
13
11
|
export * as resize from './resize/index.js'
|
|
14
|
-
export * as
|
|
12
|
+
export * as overlay from './overlay/index.js'
|
|
13
|
+
export * as hue from './hue/index.js'
|
|
15
14
|
export * as rotate from './rotate/index.js'
|
|
15
|
+
export * as saturate from './saturate/index.js'
|
|
@@ -5,11 +5,11 @@ export * as extract from './extract/index.js'
|
|
|
5
5
|
export * as flatten from './flatten/index.js'
|
|
6
6
|
export * as flip from './flip/index.js'
|
|
7
7
|
export * as flop from './flop/index.js'
|
|
8
|
-
export * as hue from './hue/index.js'
|
|
9
|
-
export * as level from './level/index.js'
|
|
10
8
|
export * as lighten from './lighten/index.js'
|
|
9
|
+
export * as level from './level/index.js'
|
|
11
10
|
export * as normalize from './normalize/index.js'
|
|
12
|
-
export * as overlay from './overlay/index.js'
|
|
13
11
|
export * as resize from './resize/index.js'
|
|
14
|
-
export * as
|
|
12
|
+
export * as overlay from './overlay/index.js'
|
|
13
|
+
export * as hue from './hue/index.js'
|
|
15
14
|
export * as rotate from './rotate/index.js'
|
|
15
|
+
export * as saturate from './saturate/index.js'
|
package/node/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * as awsS3 from './@aws-s3/index.js'
|
|
2
1
|
export * as designEdito from './@design-edito/index.js'
|
|
3
2
|
export * as express from './@express/index.js'
|
|
4
|
-
export * as
|
|
3
|
+
export * as awsS3 from './@aws-s3/index.js'
|
|
5
4
|
export * as cloudStorage from './cloud-storage/index.js'
|
|
6
5
|
export * as encryption from './encryption/index.js'
|
|
7
6
|
export * as files from './files/index.js'
|
|
7
|
+
export * as googleCloud from './@google-cloud/index.js'
|
|
8
8
|
export * as ftps from './ftps/index.js'
|
|
9
9
|
export * as images from './images/index.js'
|
|
10
10
|
export * as process from './process/index.js'
|
package/node/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * as awsS3 from './@aws-s3/index.js'
|
|
2
1
|
export * as designEdito from './@design-edito/index.js'
|
|
3
2
|
export * as express from './@express/index.js'
|
|
4
|
-
export * as
|
|
3
|
+
export * as awsS3 from './@aws-s3/index.js'
|
|
5
4
|
export * as cloudStorage from './cloud-storage/index.js'
|
|
6
5
|
export * as encryption from './encryption/index.js'
|
|
7
6
|
export * as files from './files/index.js'
|
|
7
|
+
export * as googleCloud from './@google-cloud/index.js'
|
|
8
8
|
export * as ftps from './ftps/index.js'
|
|
9
9
|
export * as images from './images/index.js'
|
|
10
10
|
export * as process from './process/index.js'
|
package/node/process/index.d.ts
CHANGED
package/node/process/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * as copy from './copy/index.js'
|
|
2
2
|
export * as download from './download/index.js'
|
|
3
|
+
export * as remove from './remove/index.js'
|
|
3
4
|
export * as exists from './exists/index.js'
|
|
4
5
|
export * as move from './move/index.js'
|
|
5
|
-
export * as remove from './remove/index.js'
|
|
6
6
|
export * as stat from './stat/index.js'
|
|
7
7
|
export * as upload from './upload/index.js'
|
package/node/sftp/file/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * as copy from './copy/index.js'
|
|
2
2
|
export * as download from './download/index.js'
|
|
3
|
+
export * as remove from './remove/index.js'
|
|
3
4
|
export * as exists from './exists/index.js'
|
|
4
5
|
export * as move from './move/index.js'
|
|
5
|
-
export * as remove from './remove/index.js'
|
|
6
6
|
export * as stat from './stat/index.js'
|
|
7
7
|
export * as upload from './upload/index.js'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@design-edito/tools",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Maxime Fabas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -1981,6 +1981,13 @@
|
|
|
1981
1981
|
"import": "./node/files/index.js",
|
|
1982
1982
|
"types": "./node/files/index.d.ts"
|
|
1983
1983
|
},
|
|
1984
|
+
"./node/files/get-size": {
|
|
1985
|
+
"import": "./node/files/get-size/index.js",
|
|
1986
|
+
"types": "./node/files/get-size/index.d.ts"
|
|
1987
|
+
},
|
|
1988
|
+
"./node/files/get-size/index.js": {
|
|
1989
|
+
"import": "./node/files/get-size/index.js"
|
|
1990
|
+
},
|
|
1984
1991
|
"./node/files/index.js": {
|
|
1985
1992
|
"import": "./node/files/index.js"
|
|
1986
1993
|
},
|