@design-edito/tools 0.5.12 → 0.5.14

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.
Files changed (53) hide show
  1. package/agnostic/arrays/index.d.ts +2 -2
  2. package/agnostic/arrays/index.js +2 -2
  3. package/agnostic/colors/index.d.ts +1 -1
  4. package/agnostic/colors/index.js +1 -1
  5. package/agnostic/css/index.d.ts +1 -1
  6. package/agnostic/css/index.js +1 -1
  7. package/agnostic/html/hyper-json/smart-tags/coalesced/index.d.ts +12 -12
  8. package/agnostic/html/hyper-json/smart-tags/coalesced/index.js +12 -12
  9. package/agnostic/html/hyper-json/smart-tags/isolated/index.d.ts +4 -4
  10. package/agnostic/html/hyper-json/smart-tags/isolated/index.js +4 -4
  11. package/agnostic/html/index.d.ts +3 -3
  12. package/agnostic/html/index.js +3 -3
  13. package/agnostic/index.d.ts +3 -3
  14. package/agnostic/index.js +3 -3
  15. package/agnostic/misc/index.d.ts +3 -3
  16. package/agnostic/misc/index.js +3 -3
  17. package/agnostic/misc/logs/index.d.ts +1 -1
  18. package/agnostic/misc/logs/index.js +1 -1
  19. package/agnostic/numbers/index.d.ts +2 -2
  20. package/agnostic/numbers/index.js +2 -2
  21. package/agnostic/objects/index.d.ts +1 -1
  22. package/agnostic/objects/index.js +1 -1
  23. package/agnostic/random/index.d.ts +1 -1
  24. package/agnostic/random/index.js +1 -1
  25. package/agnostic/strings/index.d.ts +1 -1
  26. package/agnostic/strings/index.js +1 -1
  27. package/agnostic/subtitles/index.d.ts +1 -1
  28. package/agnostic/subtitles/index.js +1 -1
  29. package/agnostic/time/index.d.ts +1 -1
  30. package/agnostic/time/index.js +1 -1
  31. package/components/Video/index.controlled.d.ts +7 -0
  32. package/components/Video/index.controlled.js +6 -2
  33. package/components/Video/utils.d.ts +19 -17
  34. package/components/Video/utils.js +32 -25
  35. package/components/index.d.ts +2 -2
  36. package/components/index.js +2 -2
  37. package/node/@aws-s3/storage/file/index.d.ts +1 -1
  38. package/node/@aws-s3/storage/file/index.js +1 -1
  39. package/node/@google-cloud/storage/directory/index.d.ts +1 -1
  40. package/node/@google-cloud/storage/directory/index.js +1 -1
  41. package/node/@google-cloud/storage/file/index.d.ts +4 -4
  42. package/node/@google-cloud/storage/file/index.js +4 -4
  43. package/node/cloud-storage/operations/index.d.ts +1 -1
  44. package/node/cloud-storage/operations/index.js +1 -1
  45. package/node/encryption/@aes-256-gcm/index.d.ts +1 -1
  46. package/node/encryption/@aes-256-gcm/index.js +1 -1
  47. package/node/process/index.d.ts +1 -1
  48. package/node/process/index.js +1 -1
  49. package/node/process/spawner/index.d.ts +26 -0
  50. package/node/process/spawner/index.js +21 -8
  51. package/node/sftp/file/index.d.ts +1 -1
  52. package/node/sftp/file/index.js +1 -1
  53. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
- export * as dedupe from './dedupe/index.js'
2
1
  export * as findDuplicates from './find-duplicates/index.js'
3
2
  export * as isArrayOf from './is-array-of/index.js'
3
+ export * as dedupe from './dedupe/index.js'
4
4
  export * as make from './make/index.js'
5
- export * as randomPick from './random-pick/index.js'
6
5
  export * as shuffle from './shuffle/index.js'
6
+ export * as randomPick from './random-pick/index.js'
@@ -1,6 +1,6 @@
1
- export * as dedupe from './dedupe/index.js'
2
1
  export * as findDuplicates from './find-duplicates/index.js'
3
2
  export * as isArrayOf from './is-array-of/index.js'
3
+ export * as dedupe from './dedupe/index.js'
4
4
  export * as make from './make/index.js'
5
- export * as randomPick from './random-pick/index.js'
6
5
  export * as shuffle from './shuffle/index.js'
6
+ export * as randomPick from './random-pick/index.js'
@@ -8,5 +8,5 @@ export * as lerp from './lerp/index.js'
8
8
  export * as luminance from './luminance/index.js'
9
9
  export * as palette from './palette/index.js'
10
10
  export * as rotate from './rotate/index.js'
11
- export * as tidy from './tidy/index.js'
12
11
  export * as typechecks from './typechecks/index.js'
12
+ export * as tidy from './tidy/index.js'
@@ -8,5 +8,5 @@ export * as lerp from './lerp/index.js'
8
8
  export * as luminance from './luminance/index.js'
9
9
  export * as palette from './palette/index.js'
10
10
  export * as rotate from './rotate/index.js'
11
- export * as tidy from './tidy/index.js'
12
11
  export * as typechecks from './typechecks/index.js'
12
+ export * as tidy from './tidy/index.js'
@@ -1,6 +1,6 @@
1
1
  export * as bem from './bem/index.js'
2
2
  export * as clss from './clss/index.js'
3
3
  export * as generateNiceColor from './generate-nice-color/index.js'
4
- export * as isValidCssClassName from './is-valid-css-class-name/index.js'
5
4
  export * as scale from './scale/index.js'
6
5
  export * as stylesSet from './styles-set/index.js'
6
+ export * as isValidCssClassName from './is-valid-css-class-name/index.js'
@@ -1,6 +1,6 @@
1
1
  export * as bem from './bem/index.js'
2
2
  export * as clss from './clss/index.js'
3
3
  export * as generateNiceColor from './generate-nice-color/index.js'
4
- export * as isValidCssClassName from './is-valid-css-class-name/index.js'
5
4
  export * as scale from './scale/index.js'
6
5
  export * as stylesSet from './styles-set/index.js'
6
+ export * as isValidCssClassName from './is-valid-css-class-name/index.js'
@@ -1,52 +1,52 @@
1
1
  export * as add from './add/index.js'
2
- export * as and from './and/index.js'
3
2
  export * as addclass from './addclass/index.js'
3
+ export * as and from './and/index.js'
4
4
  export * as append from './append/index.js'
5
5
  export * as at from './at/index.js'
6
- export * as clone from './clone/index.js'
7
6
  export * as call from './call/index.js'
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 getproperties from './getproperties/index.js'
11
10
  export * as getattribute from './getattribute/index.js'
12
11
  export * as getproperty from './getproperty/index.js'
12
+ export * as getproperties from './getproperties/index.js'
13
13
  export * as hjparse from './hjparse/index.js'
14
14
  export * as hjstringify from './hjstringify/index.js'
15
15
  export * as if from './if/index.js'
16
+ export * as initialize from './initialize/index.js'
16
17
  export * as join from './join/index.js'
17
18
  export * as length from './length/index.js'
18
- export * as initialize from './initialize/index.js'
19
19
  export * as map from './map/index.js'
20
20
  export * as negate from './negate/index.js'
21
21
  export * as notrailing from './notrailing/index.js'
22
22
  export * as or from './or/index.js'
23
23
  export * as pickrandom from './pickrandom/index.js'
24
24
  export * as populate from './populate/index.js'
25
- export * as print from './print/index.js'
26
25
  export * as push from './push/index.js'
26
+ export * as print from './print/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
31
  export * as renameproperty from './renameproperty/index.js'
32
32
  export * as replace from './replace/index.js'
33
- export * as select from './select/index.js'
34
33
  export * as set from './set/index.js'
35
- export * as setproperty from './setproperty/index.js'
34
+ export * as select from './select/index.js'
36
35
  export * as setattribute from './setattribute/index.js'
36
+ export * as setproperty from './setproperty/index.js'
37
37
  export * as split from './split/index.js'
38
- export * as sorton from './sorton/index.js'
39
38
  export * as spread from './spread/index.js'
40
39
  export * as toarray from './toarray/index.js'
41
40
  export * as toboolean from './toboolean/index.js'
42
- export * as toelement from './toelement/index.js'
43
41
  export * as toggleclass from './toggleclass/index.js'
44
- export * as tonull from './tonull/index.js'
45
- export * as tonumber from './tonumber/index.js'
42
+ export * as toelement from './toelement/index.js'
46
43
  export * as tonodelist from './tonodelist/index.js'
44
+ export * as tonumber from './tonumber/index.js'
45
+ export * as sorton from './sorton/index.js'
46
+ export * as tonull from './tonull/index.js'
47
47
  export * as toref from './toref/index.js'
48
48
  export * as tostring from './tostring/index.js'
49
- export * as totext from './totext/index.js'
50
49
  export * as transformselected from './transformselected/index.js'
50
+ export * as totext from './totext/index.js'
51
51
  export * as trim from './trim/index.js'
52
52
  export * as torecord from './torecord/index.js'
@@ -1,52 +1,52 @@
1
1
  export * as add from './add/index.js'
2
- export * as and from './and/index.js'
3
2
  export * as addclass from './addclass/index.js'
3
+ export * as and from './and/index.js'
4
4
  export * as append from './append/index.js'
5
5
  export * as at from './at/index.js'
6
- export * as clone from './clone/index.js'
7
6
  export * as call from './call/index.js'
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 getproperties from './getproperties/index.js'
11
10
  export * as getattribute from './getattribute/index.js'
12
11
  export * as getproperty from './getproperty/index.js'
12
+ export * as getproperties from './getproperties/index.js'
13
13
  export * as hjparse from './hjparse/index.js'
14
14
  export * as hjstringify from './hjstringify/index.js'
15
15
  export * as if from './if/index.js'
16
+ export * as initialize from './initialize/index.js'
16
17
  export * as join from './join/index.js'
17
18
  export * as length from './length/index.js'
18
- export * as initialize from './initialize/index.js'
19
19
  export * as map from './map/index.js'
20
20
  export * as negate from './negate/index.js'
21
21
  export * as notrailing from './notrailing/index.js'
22
22
  export * as or from './or/index.js'
23
23
  export * as pickrandom from './pickrandom/index.js'
24
24
  export * as populate from './populate/index.js'
25
- export * as print from './print/index.js'
26
25
  export * as push from './push/index.js'
26
+ export * as print from './print/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
31
  export * as renameproperty from './renameproperty/index.js'
32
32
  export * as replace from './replace/index.js'
33
- export * as select from './select/index.js'
34
33
  export * as set from './set/index.js'
35
- export * as setproperty from './setproperty/index.js'
34
+ export * as select from './select/index.js'
36
35
  export * as setattribute from './setattribute/index.js'
36
+ export * as setproperty from './setproperty/index.js'
37
37
  export * as split from './split/index.js'
38
- export * as sorton from './sorton/index.js'
39
38
  export * as spread from './spread/index.js'
40
39
  export * as toarray from './toarray/index.js'
41
40
  export * as toboolean from './toboolean/index.js'
42
- export * as toelement from './toelement/index.js'
43
41
  export * as toggleclass from './toggleclass/index.js'
44
- export * as tonull from './tonull/index.js'
45
- export * as tonumber from './tonumber/index.js'
42
+ export * as toelement from './toelement/index.js'
46
43
  export * as tonodelist from './tonodelist/index.js'
44
+ export * as tonumber from './tonumber/index.js'
45
+ export * as sorton from './sorton/index.js'
46
+ export * as tonull from './tonull/index.js'
47
47
  export * as toref from './toref/index.js'
48
48
  export * as tostring from './tostring/index.js'
49
- export * as totext from './totext/index.js'
50
49
  export * as transformselected from './transformselected/index.js'
50
+ export * as totext from './totext/index.js'
51
51
  export * as trim from './trim/index.js'
52
52
  export * as torecord from './torecord/index.js'
@@ -1,13 +1,13 @@
1
1
  export * as any from './any/index.js'
2
- export * as boolean from './boolean/index.js'
3
2
  export * as array from './array/index.js'
4
- export * as element from './element/index.js'
3
+ export * as boolean from './boolean/index.js'
5
4
  export * as guess from './guess/index.js'
6
5
  export * as get from './get/index.js'
6
+ export * as element from './element/index.js'
7
7
  export * as nodelist from './nodelist/index.js'
8
+ export * as number from './number/index.js'
8
9
  export * as null from './null/index.js'
9
10
  export * as record from './record/index.js'
11
+ export * as ref from './ref/index.js'
10
12
  export * as string from './string/index.js'
11
13
  export * as text from './text/index.js'
12
- export * as ref from './ref/index.js'
13
- export * as number from './number/index.js'
@@ -1,13 +1,13 @@
1
1
  export * as any from './any/index.js'
2
- export * as boolean from './boolean/index.js'
3
2
  export * as array from './array/index.js'
4
- export * as element from './element/index.js'
3
+ export * as boolean from './boolean/index.js'
5
4
  export * as guess from './guess/index.js'
6
5
  export * as get from './get/index.js'
6
+ export * as element from './element/index.js'
7
7
  export * as nodelist from './nodelist/index.js'
8
+ export * as number from './number/index.js'
8
9
  export * as null from './null/index.js'
9
10
  export * as record from './record/index.js'
11
+ export * as ref from './ref/index.js'
10
12
  export * as string from './string/index.js'
11
13
  export * as text from './text/index.js'
12
- export * as ref from './ref/index.js'
13
- export * as number from './number/index.js'
@@ -1,10 +1,10 @@
1
1
  export * as deepSelect from './deep-select/index.js'
2
+ export * as getNodeAncestors from './get-node-ancestors/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
- export * as getNodeAncestors from './get-node-ancestors/index.js'
5
5
  export * as insertNode from './insert-node/index.js'
6
- export * as replaceInElement from './replace-in-element/index.js'
7
6
  export * as placeholders from './placeholders/index.js'
8
- export * as selectorToElement from './selector-to-element/index.js'
7
+ export * as replaceInElement from './replace-in-element/index.js'
9
8
  export * as stringToNodes from './string-to-nodes/index.js'
9
+ export * as selectorToElement from './selector-to-element/index.js'
10
10
  export * as watchSelection from './watch-selection/index.js'
@@ -1,10 +1,10 @@
1
1
  export * as deepSelect from './deep-select/index.js'
2
+ export * as getNodeAncestors from './get-node-ancestors/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
- export * as getNodeAncestors from './get-node-ancestors/index.js'
5
5
  export * as insertNode from './insert-node/index.js'
6
- export * as replaceInElement from './replace-in-element/index.js'
7
6
  export * as placeholders from './placeholders/index.js'
8
- export * as selectorToElement from './selector-to-element/index.js'
7
+ export * as replaceInElement from './replace-in-element/index.js'
9
8
  export * as stringToNodes from './string-to-nodes/index.js'
9
+ export * as selectorToElement from './selector-to-element/index.js'
10
10
  export * as watchSelection from './watch-selection/index.js'
@@ -2,16 +2,16 @@ export * as arrays from './arrays/index.js'
2
2
  export * as booleans from './booleans/index.js'
3
3
  export * as colors from './colors/index.js'
4
4
  export * as css from './css/index.js'
5
- export * as errors from './errors/index.js'
6
5
  export * as html from './html/index.js'
6
+ export * as errors from './errors/index.js'
7
+ export * as misc from './misc/index.js'
7
8
  export * as numbers from './numbers/index.js'
8
9
  export * as objects from './objects/index.js'
9
- export * as misc from './misc/index.js'
10
10
  export * as optim from './optim/index.js'
11
11
  export * as random from './random/index.js'
12
12
  export * as regexps from './regexps/index.js'
13
13
  export * as sanitization from './sanitization/index.js'
14
14
  export * as strings from './strings/index.js'
15
- export * as subtitles from './subtitles/index.js'
16
15
  export * as time from './time/index.js'
16
+ export * as subtitles from './subtitles/index.js'
17
17
  export * as typescript from './typescript/index.js'
package/agnostic/index.js CHANGED
@@ -2,16 +2,16 @@ export * as arrays from './arrays/index.js'
2
2
  export * as booleans from './booleans/index.js'
3
3
  export * as colors from './colors/index.js'
4
4
  export * as css from './css/index.js'
5
- export * as errors from './errors/index.js'
6
5
  export * as html from './html/index.js'
6
+ export * as errors from './errors/index.js'
7
+ export * as misc from './misc/index.js'
7
8
  export * as numbers from './numbers/index.js'
8
9
  export * as objects from './objects/index.js'
9
- export * as misc from './misc/index.js'
10
10
  export * as optim from './optim/index.js'
11
11
  export * as random from './random/index.js'
12
12
  export * as regexps from './regexps/index.js'
13
13
  export * as sanitization from './sanitization/index.js'
14
14
  export * as strings from './strings/index.js'
15
- export * as subtitles from './subtitles/index.js'
16
15
  export * as time from './time/index.js'
16
+ export * as subtitles from './subtitles/index.js'
17
17
  export * as typescript from './typescript/index.js'
@@ -1,11 +1,11 @@
1
- export * as assert from './assert/index.js'
2
1
  export * as cast from './cast/index.js'
3
2
  export * as connection from './connection/index.js'
4
3
  export * as crawler from './crawler/index.js'
5
- export * as crossenv from './crossenv/index.js'
4
+ export * as assert from './assert/index.js'
6
5
  export * as dataSize from './data-size/index.js'
7
- export * as isConstructorFunction from './is-constructor-function/index.js'
8
6
  export * as isNullish from './is-nullish/index.js'
7
+ export * as crossenv from './crossenv/index.js'
8
+ export * as isConstructorFunction from './is-constructor-function/index.js'
9
9
  export * as logs from './logs/index.js'
10
10
  export * as loremIpsum from './lorem-ipsum/index.js'
11
11
  export * as normalizeExtension from './normalize-extension/index.js'
@@ -1,11 +1,11 @@
1
- export * as assert from './assert/index.js'
2
1
  export * as cast from './cast/index.js'
3
2
  export * as connection from './connection/index.js'
4
3
  export * as crawler from './crawler/index.js'
5
- export * as crossenv from './crossenv/index.js'
4
+ export * as assert from './assert/index.js'
6
5
  export * as dataSize from './data-size/index.js'
7
- export * as isConstructorFunction from './is-constructor-function/index.js'
8
6
  export * as isNullish from './is-nullish/index.js'
7
+ export * as crossenv from './crossenv/index.js'
8
+ export * as isConstructorFunction from './is-constructor-function/index.js'
9
9
  export * as logs from './logs/index.js'
10
10
  export * as loremIpsum from './lorem-ipsum/index.js'
11
11
  export * as normalizeExtension from './normalize-extension/index.js'
@@ -1,3 +1,3 @@
1
1
  export * as logger from './logger/index.js'
2
- export * as styles from './styles/index.js'
3
2
  export * as makeTextBlock from './make-text-block/index.js'
3
+ export * as styles from './styles/index.js'
@@ -1,3 +1,3 @@
1
1
  export * as logger from './logger/index.js'
2
- export * as styles from './styles/index.js'
3
2
  export * as makeTextBlock from './make-text-block/index.js'
3
+ export * as styles from './styles/index.js'
@@ -1,6 +1,6 @@
1
1
  export * as absoluteModulo from './absolute-modulo/index.js'
2
- export * as approximateRational from './approximate-rational/index.js'
3
2
  export * as clamp from './clamp/index.js'
4
- export * as interpolate from './interpolate/index.js'
3
+ export * as approximateRational from './approximate-rational/index.js'
5
4
  export * as geometricProgressions from './geometric-progressions/index.js'
6
5
  export * as round from './round/index.js'
6
+ export * as interpolate from './interpolate/index.js'
@@ -1,6 +1,6 @@
1
1
  export * as absoluteModulo from './absolute-modulo/index.js'
2
- export * as approximateRational from './approximate-rational/index.js'
3
2
  export * as clamp from './clamp/index.js'
4
- export * as interpolate from './interpolate/index.js'
3
+ export * as approximateRational from './approximate-rational/index.js'
5
4
  export * as geometricProgressions from './geometric-progressions/index.js'
6
5
  export * as round from './round/index.js'
6
+ export * as interpolate from './interpolate/index.js'
@@ -2,8 +2,8 @@ export * as deepGetProperty from './deep-get-property/index.js'
2
2
  export * as enums from './enums/index.js'
3
3
  export * as flattenGetters from './flatten-getters/index.js'
4
4
  export * as isObject from './is-object/index.js'
5
- export * as isRecord from './is-record/index.js'
6
5
  export * as recordFormat from './record-format/index.js'
7
6
  export * as recordMap from './record-map/index.js'
8
7
  export * as sortKeys from './sort-keys/index.js'
9
8
  export * as validation from './validation/index.js'
9
+ export * as isRecord from './is-record/index.js'
@@ -2,8 +2,8 @@ export * as deepGetProperty from './deep-get-property/index.js'
2
2
  export * as enums from './enums/index.js'
3
3
  export * as flattenGetters from './flatten-getters/index.js'
4
4
  export * as isObject from './is-object/index.js'
5
- export * as isRecord from './is-record/index.js'
6
5
  export * as recordFormat from './record-format/index.js'
7
6
  export * as recordMap from './record-map/index.js'
8
7
  export * as sortKeys from './sort-keys/index.js'
9
8
  export * as validation from './validation/index.js'
9
+ export * as isRecord from './is-record/index.js'
@@ -1,3 +1,3 @@
1
- export * as hexChar from './hex-char/index.js'
2
1
  export * as random from './random/index.js'
3
2
  export * as uuid from './uuid/index.js'
3
+ export * as hexChar from './hex-char/index.js'
@@ -1,3 +1,3 @@
1
- export * as hexChar from './hex-char/index.js'
2
1
  export * as random from './random/index.js'
3
2
  export * as uuid from './uuid/index.js'
3
+ export * as hexChar from './hex-char/index.js'
@@ -3,6 +3,6 @@ export * as matches from './matches/index.js'
3
3
  export * as normalizeIndent from './normalize-indent/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 splitTrim from './split-trim/index.js'
8
8
  export * as trim from './trim/index.js'
@@ -3,6 +3,6 @@ export * as matches from './matches/index.js'
3
3
  export * as normalizeIndent from './normalize-indent/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 splitTrim from './split-trim/index.js'
8
8
  export * as trim from './trim/index.js'
@@ -1,2 +1,2 @@
1
- export * as parseSrt from './parse-srt/index.js'
2
1
  export * as srtTimecodeToMs from './srt-timecode-to-ms/index.js'
2
+ export * as parseSrt from './parse-srt/index.js'
@@ -1,2 +1,2 @@
1
- export * as parseSrt from './parse-srt/index.js'
2
1
  export * as srtTimecodeToMs from './srt-timecode-to-ms/index.js'
2
+ export * as parseSrt from './parse-srt/index.js'
@@ -1,5 +1,5 @@
1
+ export * as dates from './dates/index.js'
1
2
  export * as duration from './duration/index.js'
2
3
  export * as timeout from './timeout/index.js'
3
- export * as dates from './dates/index.js'
4
4
  export * as wait from './wait/index.js'
5
5
  export * as transitions from './transitions/index.js'
@@ -1,5 +1,5 @@
1
+ export * as dates from './dates/index.js'
1
2
  export * as duration from './duration/index.js'
2
3
  export * as timeout from './timeout/index.js'
3
- export * as dates from './dates/index.js'
4
4
  export * as wait from './wait/index.js'
5
5
  export * as transitions from './transitions/index.js'
@@ -85,6 +85,12 @@ type TrackData = {
85
85
  * fullscreen on its own — pressing Escape, typically — with the new state. This is
86
86
  * the signal a parent needs to update its `fullscreen` prop, and it is distinct
87
87
  * from `onIsFullscreenChanged`, which merely echoes that prop back once changed.
88
+ * @property timeFormat - How the two clocks are written, as a {@link formatTime}
89
+ * pattern. Tokens go in `{{…}}` and the rest is literal, so `'{{m}} min {{ss}}'` is a
90
+ * valid answer. Defaults to `'{{mm}}:{{ss}}:{{ms}}'` — milliseconds included, which is
91
+ * what a cutting room wants and almost never what an article does: `'{{mm}}:{{ss}}'` is
92
+ * the usual one. Frames (`{{frame}}`, `{{f}}`) are derived at 25 fps, not configurable
93
+ * here.
88
94
  * @property className - Additional CSS class for the root element.
89
95
  * @property children - React content inserted into the <video> tag (fallback, etc).
90
96
  *
@@ -105,6 +111,7 @@ export type Props = PropsWithChildren<WithClassName<{
105
111
  mute?: boolean;
106
112
  playbackRate?: number;
107
113
  currentTimeMs?: number;
114
+ timeFormat?: string;
108
115
  onPlayButtonClicked?: (e: React.MouseEvent<HTMLButtonElement>, isPlaying: boolean, video: HTMLVideoElement | null) => void;
109
116
  onPauseButtonClicked?: (e: React.MouseEvent<HTMLButtonElement>, isPlaying: boolean, video: HTMLVideoElement | null) => void;
110
117
  onLoudButtonClicked?: (e: React.MouseEvent<HTMLButtonElement>, isLoud: boolean, video: HTMLVideoElement | null) => void;
@@ -49,7 +49,11 @@ import { forceExitFullscreen, forceFullscreen, forceLoud, forceMute, forcePause,
49
49
  * @returns A `<figure>` element containing the video, its controls, optional
50
50
  * subtitles.
51
51
  */
52
- export const ControlledVideo = ({ sources, tracks, subtitles, playBtnContent, pauseBtnContent, loudBtnContent, muteBtnContent, fullscreenBtnContent, play, fullscreen, mute, muted, volume = 1, playbackRate = 1, currentTimeMs: givenCurrentTimeMs, onPlayButtonClicked, onPauseButtonClicked, onLoudButtonClicked, onMuteButtonClicked, onVolumeRangeChanged, onRateRangeChanged, onFullscreenButtonClicked, onTimelineClicked, onIsPlayingChanged, onIsFullscreenChanged, onIsLoudChanged, onIsEndedChanged, onVolumeChanged, onPlaybackRateChanged, onCurrentTimeMsChanged, onFullscreenChange, children, className, ...intrinsicVideoAttributes }) => {
52
+ export const ControlledVideo = ({ sources, tracks, subtitles, playBtnContent, pauseBtnContent, loudBtnContent, muteBtnContent, fullscreenBtnContent, play, fullscreen, mute, muted, volume = 1, playbackRate = 1, currentTimeMs: givenCurrentTimeMs,
53
+ // Milliseconds by default, which is what this component has always rendered — a
54
+ // default that changes under a consumer is a change nobody asked for. An article
55
+ // usually wants `'{{mm}}:{{ss}}'` and says so.
56
+ timeFormat = '{{mm}}:{{ss}}:{{ms}}', onPlayButtonClicked, onPauseButtonClicked, onLoudButtonClicked, onMuteButtonClicked, onVolumeRangeChanged, onRateRangeChanged, onFullscreenButtonClicked, onTimelineClicked, onIsPlayingChanged, onIsFullscreenChanged, onIsLoudChanged, onIsEndedChanged, onVolumeChanged, onPlaybackRateChanged, onCurrentTimeMsChanged, onFullscreenChange, children, className, ...intrinsicVideoAttributes }) => {
53
57
  const videoRef = useRef(null);
54
58
  const [totalTime, setTotalTime] = useState(0);
55
59
  const totalTimeMs = useMemo(() => secondsToMs(totalTime), [totalTime]);
@@ -302,5 +306,5 @@ export const ControlledVideo = ({ sources, tracks, subtitles, playBtnContent, pa
302
306
  ? _jsx("source", { src: source }, index)
303
307
  : _jsx("source", { src: source.src, type: source.type }, index)), parsedTracks.map((track, index) => typeof track === 'string'
304
308
  ? _jsx("track", { src: track }, index)
305
- : _jsx("track", { src: track.src, kind: track.kind, srcLang: track.srclang, label: track.label, default: track.default }, index)), children] }), _jsxs("div", { className: videoControlsClss, children: [_jsx("button", { className: playBtnClss, onClick: handlePlayButtonClick, children: playBtnContent }), _jsx("button", { className: pauseBtnClss, onClick: handlePauseButtonClick, children: pauseBtnContent }), _jsx("button", { className: loudBtnClss, onClick: handleLoudButtonClick, children: loudBtnContent }), _jsx("button", { className: muteBtnClss, onClick: handleMuteButtonClick, children: muteBtnContent }), _jsx("input", { type: 'range', className: volumeRangeClss, value: volumePercent, onChange: handleVolumeRangeChange, min: 0, max: 100, step: 1 }), _jsx("span", { className: volumePcntClss, children: Math.round(volumePercent) }), _jsx("button", { className: fullscreenBtnClss, onClick: handleFullscreenButtonClick, children: fullscreenBtnContent }), _jsx("input", { type: 'range', className: playbackRateRangeClss, value: playbackRate, onChange: handleRateRangeChange, min: 0.25, max: 4, step: 0.25 }), _jsx("span", { className: playbackRateClss, children: playbackRate })] }), _jsxs("div", { className: timeControlsClss, children: [_jsx("span", { className: currentTimeClss, children: formatTime(currentTimeMs, 'mm:ss:ms') }), _jsx("span", { className: totalTimeClss, children: formatTime(totalTimeMs, 'mm:ss:ms') }), _jsx("div", { className: timelineClss, onClick: handleTimelineClick })] }), subtitles !== undefined && _jsx(Subtitles, { ...subtitles, timecodeMs: currentTimeMs, isEnded: isEnded })] });
309
+ : _jsx("track", { src: track.src, kind: track.kind, srcLang: track.srclang, label: track.label, default: track.default }, index)), children] }), _jsxs("div", { className: videoControlsClss, children: [_jsx("button", { className: playBtnClss, onClick: handlePlayButtonClick, children: playBtnContent }), _jsx("button", { className: pauseBtnClss, onClick: handlePauseButtonClick, children: pauseBtnContent }), _jsx("button", { className: loudBtnClss, onClick: handleLoudButtonClick, children: loudBtnContent }), _jsx("button", { className: muteBtnClss, onClick: handleMuteButtonClick, children: muteBtnContent }), _jsx("input", { type: 'range', className: volumeRangeClss, value: volumePercent, onChange: handleVolumeRangeChange, min: 0, max: 100, step: 1 }), _jsx("span", { className: volumePcntClss, children: Math.round(volumePercent) }), _jsx("button", { className: fullscreenBtnClss, onClick: handleFullscreenButtonClick, children: fullscreenBtnContent }), _jsx("input", { type: 'range', className: playbackRateRangeClss, value: playbackRate, onChange: handleRateRangeChange, min: 0.25, max: 4, step: 0.25 }), _jsx("span", { className: playbackRateClss, children: playbackRate })] }), _jsxs("div", { className: timeControlsClss, children: [_jsx("span", { className: currentTimeClss, children: formatTime(currentTimeMs, timeFormat) }), _jsx("span", { className: totalTimeClss, children: formatTime(totalTimeMs, timeFormat) }), _jsx("div", { className: timelineClss, onClick: handleTimelineClick })] }), subtitles !== undefined && _jsx(Subtitles, { ...subtitles, timecodeMs: currentTimeMs, isEnded: isEnded })] });
306
310
  };
@@ -20,33 +20,35 @@ export declare const forceFullscreen: (video: HTMLVideoElement | null) => Promis
20
20
  export declare const forceExitFullscreen: (video: HTMLVideoElement | null) => Promise<boolean>;
21
21
  export declare function secondsToMs(seconds: number): number;
22
22
  export declare function msToSeconds(ms: number): number;
23
+ /** The fields {@link formatTime} knows how to render. */
24
+ export type TimeToken = 'hh' | 'mm' | 'ss' | 'ms' | 'frame' | 'h' | 'm' | 's' | 'f';
23
25
  /**
24
26
  * Renders a duration into a caller-defined pattern.
25
27
  *
26
- * The pattern is a free-form string in which the following tokens are replaced,
27
- * longest first, so that `mm` is consumed before `m`:
28
+ * Tokens are wrapped in `{{…}}` and everything outside them is literal, so a pattern
29
+ * may carry words: `'{{m}} min {{ss}}'` renders as `'1 min 05'`.
28
30
  *
29
- * - `hh`, `mm`, `ss` — hours, minutes and seconds, zero-padded to two digits.
30
- * - `ms` — the remaining milliseconds, zero-padded to three digits.
31
- * - `frame` — the remaining milliseconds expressed in frames, zero-padded to two
32
- * digits.
33
- * - `h`, `m`, `s`, `f` — the same four values, unpadded.
31
+ * - `{{hh}}`, `{{mm}}`, `{{ss}}` — hours, minutes and seconds, zero-padded to two digits.
32
+ * - `{{ms}}` — the remaining milliseconds, zero-padded to three digits.
33
+ * - `{{frame}}` — those milliseconds expressed in frames, zero-padded to two digits.
34
+ * - `{{h}}`, `{{m}}`, `{{s}}`, `{{f}}` — the same four values, unpadded.
34
35
  *
35
36
  * @param ms - The duration, in milliseconds.
36
- * @param format - The pattern to fill, e.g. `'mm:ss:ms'`.
37
+ * @param format - The pattern to fill, e.g. `'{{mm}}:{{ss}}'`.
37
38
  * @param fps - Frame rate used to derive the `frame` and `f` tokens. Defaults to `25`.
38
- * @returns The formatted duration.
39
+ * @returns The formatted duration. An unknown token is left as written, braces
40
+ * included, rather than silently blanked — a typo has to be visible.
39
41
  *
40
42
  * @remarks
41
- * Every field is a remainder of the one above it, never a total: at one hour and
42
- * a half, `mm` is `30`, not `90`. A pattern that omits `hh` therefore loses the
43
- * hours rather than folding them into the minutes.
43
+ * Every field is a remainder of the one above it, never a total: at one hour and a half,
44
+ * `{{mm}}` is `30`, not `90`. A pattern that omits `{{hh}}` therefore loses the hours
45
+ * rather than folding them into the minutes.
44
46
  *
45
- * Since `h`, `m`, `s` and `f` are tokens on their own, **every** occurrence of
46
- * those letters is substituted, wherever it sits: `'mm min ss'` renders as
47
- * `'01 1in 01'`. Separate the fields with punctuation. This is what
48
- * `agnostic/time/dates/format-date` avoids by delimiting its tokens with
49
- * `{{…}}` — worth aligning on the day this one is made public.
47
+ * **The delimiters are what make the pattern free-form.** Until they existed, `h`, `m`,
48
+ * `s` and `f` were tokens on their own and every occurrence of those letters was
49
+ * substituted wherever it sat — `'mm min ss'` rendered as `'01 1in 01'`, so a pattern
50
+ * could only ever separate its fields with punctuation. That is why the format could not
51
+ * be exposed as a prop: doing so would have published the trap.
50
52
  */
51
53
  export declare function formatTime(ms: number, format: string, fps?: number): string;
52
54
  /**
@@ -107,33 +107,37 @@ export function secondsToMs(seconds) {
107
107
  export function msToSeconds(ms) {
108
108
  return ms / 1000;
109
109
  }
110
+ // Alternation is ordered and the first branch that fits wins, so the longest tokens
111
+ // come first — the same regexp shape, and the same reason, as
112
+ // `agnostic/time/dates/format-date`.
113
+ const timeTokenRegexp = /\{\{(frame|hh|mm|ss|ms|h|m|s|f)\}\}/gv;
110
114
  /**
111
115
  * Renders a duration into a caller-defined pattern.
112
116
  *
113
- * The pattern is a free-form string in which the following tokens are replaced,
114
- * longest first, so that `mm` is consumed before `m`:
117
+ * Tokens are wrapped in `{{…}}` and everything outside them is literal, so a pattern
118
+ * may carry words: `'{{m}} min {{ss}}'` renders as `'1 min 05'`.
115
119
  *
116
- * - `hh`, `mm`, `ss` — hours, minutes and seconds, zero-padded to two digits.
117
- * - `ms` — the remaining milliseconds, zero-padded to three digits.
118
- * - `frame` — the remaining milliseconds expressed in frames, zero-padded to two
119
- * digits.
120
- * - `h`, `m`, `s`, `f` — the same four values, unpadded.
120
+ * - `{{hh}}`, `{{mm}}`, `{{ss}}` — hours, minutes and seconds, zero-padded to two digits.
121
+ * - `{{ms}}` — the remaining milliseconds, zero-padded to three digits.
122
+ * - `{{frame}}` — those milliseconds expressed in frames, zero-padded to two digits.
123
+ * - `{{h}}`, `{{m}}`, `{{s}}`, `{{f}}` — the same four values, unpadded.
121
124
  *
122
125
  * @param ms - The duration, in milliseconds.
123
- * @param format - The pattern to fill, e.g. `'mm:ss:ms'`.
126
+ * @param format - The pattern to fill, e.g. `'{{mm}}:{{ss}}'`.
124
127
  * @param fps - Frame rate used to derive the `frame` and `f` tokens. Defaults to `25`.
125
- * @returns The formatted duration.
128
+ * @returns The formatted duration. An unknown token is left as written, braces
129
+ * included, rather than silently blanked — a typo has to be visible.
126
130
  *
127
131
  * @remarks
128
- * Every field is a remainder of the one above it, never a total: at one hour and
129
- * a half, `mm` is `30`, not `90`. A pattern that omits `hh` therefore loses the
130
- * hours rather than folding them into the minutes.
132
+ * Every field is a remainder of the one above it, never a total: at one hour and a half,
133
+ * `{{mm}}` is `30`, not `90`. A pattern that omits `{{hh}}` therefore loses the hours
134
+ * rather than folding them into the minutes.
131
135
  *
132
- * Since `h`, `m`, `s` and `f` are tokens on their own, **every** occurrence of
133
- * those letters is substituted, wherever it sits: `'mm min ss'` renders as
134
- * `'01 1in 01'`. Separate the fields with punctuation. This is what
135
- * `agnostic/time/dates/format-date` avoids by delimiting its tokens with
136
- * `{{…}}` — worth aligning on the day this one is made public.
136
+ * **The delimiters are what make the pattern free-form.** Until they existed, `h`, `m`,
137
+ * `s` and `f` were tokens on their own and every occurrence of those letters was
138
+ * substituted wherever it sat — `'mm min ss'` rendered as `'01 1in 01'`, so a pattern
139
+ * could only ever separate its fields with punctuation. That is why the format could not
140
+ * be exposed as a prop: doing so would have published the trap.
137
141
  */
138
142
  export function formatTime(ms, format, fps = 25) {
139
143
  const totalSeconds = Math.floor(ms / 1000);
@@ -142,21 +146,24 @@ export function formatTime(ms, format, fps = 25) {
142
146
  const seconds = Math.floor(totalSeconds % 60);
143
147
  const frames = Math.floor(((ms % 1000) / 1000) * fps);
144
148
  const msRest = Math.floor(ms % 1000);
149
+ // Typed by {@link TimeToken} so the table and the regexp above cannot fall out of step,
150
+ // then read through a widened view: the capture is a `string` as far as the compiler
151
+ // knows, and widening is what lets it be looked up without asserting it back.
145
152
  const tokens = {
146
153
  hh: String(hours).padStart(2, '0'),
147
154
  mm: String(minutes).padStart(2, '0'),
148
155
  ss: String(seconds).padStart(2, '0'),
149
156
  frame: String(frames).padStart(2, '0'),
150
157
  ms: String(msRest).padStart(3, '0'),
151
- h: hours,
152
- m: minutes,
153
- s: seconds,
154
- f: frames
158
+ h: String(hours),
159
+ m: String(minutes),
160
+ s: String(seconds),
161
+ f: String(frames)
155
162
  };
156
- return Object
157
- .keys(tokens)
158
- .sort((a, b) => b.length - a.length)
159
- .reduce((acc, t) => acc.replace(new RegExp(t, 'gv'), String(tokens[t])), format);
163
+ const byName = tokens;
164
+ // One pass, so a rendered value can never be re-read as a token by a later pass — the
165
+ // reason the old implementation had to sort its keys by length.
166
+ return format.replace(timeTokenRegexp, (whole, token) => byName[token] ?? whole);
160
167
  }
161
168
  /**
162
169
  * Where along the timeline a click landed.
@@ -10,12 +10,12 @@ export * as image from './Image/index.js'
10
10
  export * as input from './Input/index.js'
11
11
  export * as intersectionObserver from './IntersectionObserver/index.js'
12
12
  export * as jsonEditor from './JsonEditor/index.js'
13
- export * as listLoader from './ListLoader/index.js'
14
13
  export * as lightbox from './Lightbox/index.js'
14
+ export * as listLoader from './ListLoader/index.js'
15
15
  export * as overlayer from './Overlayer/index.js'
16
- export * as scrllgngn from './Scrllgngn/index.js'
17
16
  export * as paginator from './Paginator/index.js'
18
17
  export * as resizeObserver from './ResizeObserver/index.js'
18
+ export * as scrllgngn from './Scrllgngn/index.js'
19
19
  export * as scrollListener from './ScrollListener/index.js'
20
20
  export * as select from './Select/index.js'
21
21
  export * as sequencer from './Sequencer/index.js'
@@ -10,12 +10,12 @@ export * as image from './Image/index.js'
10
10
  export * as input from './Input/index.js'
11
11
  export * as intersectionObserver from './IntersectionObserver/index.js'
12
12
  export * as jsonEditor from './JsonEditor/index.js'
13
- export * as listLoader from './ListLoader/index.js'
14
13
  export * as lightbox from './Lightbox/index.js'
14
+ export * as listLoader from './ListLoader/index.js'
15
15
  export * as overlayer from './Overlayer/index.js'
16
- export * as scrllgngn from './Scrllgngn/index.js'
17
16
  export * as paginator from './Paginator/index.js'
18
17
  export * as resizeObserver from './ResizeObserver/index.js'
18
+ export * as scrllgngn from './Scrllgngn/index.js'
19
19
  export * as scrollListener from './ScrollListener/index.js'
20
20
  export * as select from './Select/index.js'
21
21
  export * as sequencer from './Sequencer/index.js'
@@ -1,7 +1,7 @@
1
1
  export * as copy from './copy/index.js'
2
2
  export * as download from './download/index.js'
3
3
  export * as exists from './exists/index.js'
4
- export * as move from './move/index.js'
5
4
  export * as remove from './remove/index.js'
5
+ export * as move from './move/index.js'
6
6
  export * as stat from './stat/index.js'
7
7
  export * as upload from './upload/index.js'
@@ -1,7 +1,7 @@
1
1
  export * as copy from './copy/index.js'
2
2
  export * as download from './download/index.js'
3
3
  export * as exists from './exists/index.js'
4
- export * as move from './move/index.js'
5
4
  export * as remove from './remove/index.js'
5
+ export * as move from './move/index.js'
6
6
  export * as stat from './stat/index.js'
7
7
  export * as upload from './upload/index.js'
@@ -1,4 +1,4 @@
1
- export * as list from './list/index.js'
2
1
  export * as copyDir from './copy-dir/index.js'
2
+ export * as list from './list/index.js'
3
3
  export * as moveDir from './move-dir/index.js'
4
4
  export * as removeDir from './remove-dir/index.js'
@@ -1,4 +1,4 @@
1
- export * as list from './list/index.js'
2
1
  export * as copyDir from './copy-dir/index.js'
2
+ export * as list from './list/index.js'
3
3
  export * as moveDir from './move-dir/index.js'
4
4
  export * as removeDir from './remove-dir/index.js'
@@ -2,11 +2,11 @@ export * as copy from './copy/index.js'
2
2
  export * as download from './download/index.js'
3
3
  export * as exists from './exists/index.js'
4
4
  export * as generateSignedUrl from './generate-signed-url/index.js'
5
- export * as getMetadata from './get-metadata/index.js'
6
5
  export * as getPermissions from './get-permissions/index.js'
7
- export * as move from './move/index.js'
6
+ export * as getMetadata from './get-metadata/index.js'
8
7
  export * as remove from './remove/index.js'
9
- export * as revokeSignedUrls from './revoke-signed-urls/index.js'
8
+ export * as move from './move/index.js'
10
9
  export * as stat from './stat/index.js'
11
- export * as updateMetadata from './update-metadata/index.js'
10
+ export * as revokeSignedUrls from './revoke-signed-urls/index.js'
12
11
  export * as upload from './upload/index.js'
12
+ export * as updateMetadata from './update-metadata/index.js'
@@ -2,11 +2,11 @@ export * as copy from './copy/index.js'
2
2
  export * as download from './download/index.js'
3
3
  export * as exists from './exists/index.js'
4
4
  export * as generateSignedUrl from './generate-signed-url/index.js'
5
- export * as getMetadata from './get-metadata/index.js'
6
5
  export * as getPermissions from './get-permissions/index.js'
7
- export * as move from './move/index.js'
6
+ export * as getMetadata from './get-metadata/index.js'
8
7
  export * as remove from './remove/index.js'
9
- export * as revokeSignedUrls from './revoke-signed-urls/index.js'
8
+ export * as move from './move/index.js'
10
9
  export * as stat from './stat/index.js'
11
- export * as updateMetadata from './update-metadata/index.js'
10
+ export * as revokeSignedUrls from './revoke-signed-urls/index.js'
12
11
  export * as upload from './upload/index.js'
12
+ export * as updateMetadata from './update-metadata/index.js'
@@ -1,5 +1,5 @@
1
- export * as copyDir from './copy-dir/index.js'
2
1
  export * as copyFile from './copy-file/index.js'
2
+ export * as copyDir from './copy-dir/index.js'
3
3
  export * as downloadFile from './download-file/index.js'
4
4
  export * as existsFile from './exists-file/index.js'
5
5
  export * as listDir from './list-dir/index.js'
@@ -1,5 +1,5 @@
1
- export * as copyDir from './copy-dir/index.js'
2
1
  export * as copyFile from './copy-file/index.js'
2
+ export * as copyDir from './copy-dir/index.js'
3
3
  export * as downloadFile from './download-file/index.js'
4
4
  export * as existsFile from './exists-file/index.js'
5
5
  export * as listDir from './list-dir/index.js'
@@ -1,2 +1,2 @@
1
- export * as buffer from './buffer/index.js'
2
1
  export * as uint8Array from './uint8-array/index.js'
2
+ export * as buffer from './buffer/index.js'
@@ -1,2 +1,2 @@
1
- export * as buffer from './buffer/index.js'
2
1
  export * as uint8Array from './uint8-array/index.js'
2
+ export * as buffer from './buffer/index.js'
@@ -1,3 +1,3 @@
1
- export * as onExit from './on-exit/index.js'
2
1
  export * as promptContinue from './prompt-continue/index.js'
2
+ export * as onExit from './on-exit/index.js'
3
3
  export * as spawner from './spawner/index.js'
@@ -1,3 +1,3 @@
1
- export * as onExit from './on-exit/index.js'
2
1
  export * as promptContinue from './prompt-continue/index.js'
2
+ export * as onExit from './on-exit/index.js'
3
3
  export * as spawner from './spawner/index.js'
@@ -5,9 +5,33 @@ type Output = {
5
5
  stderr: string;
6
6
  err: unknown;
7
7
  };
8
+ /**
9
+ * How much a spawned command says about itself.
10
+ *
11
+ * Three levels rather than a boolean, because three are genuinely useful in a
12
+ * deployment script:
13
+ *
14
+ * - `'full'` — the label, the echoed command line, and the child's own output as it
15
+ * streams. The default, and what to use for anything whose output is news: a build
16
+ * log, an rsync diff.
17
+ * - `'command'` — the label and the echoed command line, without the child's output.
18
+ * **The level for a probe** — `gcloud projects list`, `npm config get registry` —
19
+ * whose `stdout` is parsed rather than read, and whose two hundred lines of table
20
+ * would bury the narration around it. The echo stays: it is the audit trail, and
21
+ * the last thing worth losing.
22
+ * - `'silent'` — nothing at all. Only for a call already narrated by whatever step
23
+ * contains it.
24
+ *
25
+ * Nothing here is read from the environment on purpose. A deployment that can be run
26
+ * quietly is a deployment whose log you do not have when it breaks, so the choice is
27
+ * made per call, in the source, by whoever knows what that call prints.
28
+ */
29
+ export type Verbosity = 'full' | 'command' | 'silent';
8
30
  type ThisOptions = {
9
31
  argsPrintFormat?: (args: string[]) => string[];
10
32
  throwOnError?: boolean;
33
+ /** How much to print. Defaults to `'full'`. See {@link Verbosity}. */
34
+ verbosity?: Verbosity;
11
35
  };
12
36
  /**
13
37
  * Options for the asynchronous `spawner` function.
@@ -18,6 +42,7 @@ type ThisOptions = {
18
42
  * before they are printed to the console (does not affect execution).
19
43
  * - `throwOnError`: If `true`, the function throws when the spawned process exits
20
44
  * with a non-zero status instead of returning a failure outcome.
45
+ * - `verbosity`: How much to print — see {@link Verbosity}. Defaults to `'full'`.
21
46
  */
22
47
  export type Options = SpawnOptions & ThisOptions;
23
48
  /**
@@ -29,6 +54,7 @@ export type Options = SpawnOptions & ThisOptions;
29
54
  * before they are printed to the console (does not affect execution).
30
55
  * - `throwOnError`: If `true`, the function throws when the spawned process exits
31
56
  * with a non-zero status instead of returning a failure outcome.
57
+ * - `verbosity`: How much to print — see {@link Verbosity}. Defaults to `'full'`.
32
58
  */
33
59
  export type SyncOptions = SpawnSyncOptions & ThisOptions;
34
60
  /**
@@ -22,13 +22,17 @@ import { unknownToString } from '../../../agnostic/errors/unknown-to-string/inde
22
22
  * - failure: `{ stdout, stderr, err }` when the command exits with a non-zero code
23
23
  */
24
24
  export async function spawner(label, command, args, options) {
25
+ const verbosity = options?.verbosity ?? 'full';
26
+ const printsCommand = verbosity !== 'silent';
27
+ const printsOutput = verbosity === 'full';
25
28
  return await new Promise((resolve, reject) => {
26
- if (label !== null)
29
+ if (label !== null && printsCommand)
27
30
  console.log(`\n${styles.info(label)}\n`);
28
31
  const printableArgs = options?.argsPrintFormat !== undefined
29
32
  ? options.argsPrintFormat(args)
30
33
  : args;
31
- console.log(styles.light(`> ${command} ${printableArgs.join(' ')}\n`));
34
+ if (printsCommand)
35
+ console.log(styles.light(`> ${command} ${printableArgs.join(' ')}\n`));
32
36
  const prcss = spawn(command, args, { stdio: 'pipe', ...options });
33
37
  let stdout = '';
34
38
  let stderr = '';
@@ -36,13 +40,17 @@ export async function spawner(label, command, args, options) {
36
40
  prcss.stdout?.on('data', data => {
37
41
  const strData = unknownToString(data);
38
42
  stdout += strData;
39
- console.log(styles.light(strData.replace(ansiRegex(), '').trim()));
43
+ if (printsOutput)
44
+ console.log(styles.light(strData.replace(ansiRegex(), '').trim()));
40
45
  });
41
46
  prcss.stderr?.on('data', data => {
42
47
  const strData = unknownToString(data);
43
48
  stderr += strData;
44
- console.log(styles.warning(strData.replace(ansiRegex(), '').trim()));
49
+ if (printsOutput)
50
+ console.log(styles.warning(strData.replace(ansiRegex(), '').trim()));
45
51
  });
52
+ // An error is always printed, whatever the verbosity: a command that could not be
53
+ // spawned at all is never the noise the caller asked to be spared.
46
54
  prcss.on('error', e => {
47
55
  err = e;
48
56
  console.log(styles.error(unknownToString(err).replace(ansiRegex(), '').trim()));
@@ -75,27 +83,32 @@ export async function spawner(label, command, args, options) {
75
83
  * @throws Error if `throwOnError` is `true` and the process exits with a non-zero status
76
84
  */
77
85
  export function spawnerSync(label, command, args, options) {
78
- if (label !== null)
86
+ const verbosity = options?.verbosity ?? 'full';
87
+ const printsCommand = verbosity !== 'silent';
88
+ const printsOutput = verbosity === 'full';
89
+ if (label !== null && printsCommand)
79
90
  console.log(`\n${styles.info(label)}\n}`);
80
91
  const printableArgs = options?.argsPrintFormat !== undefined
81
92
  ? options.argsPrintFormat(args)
82
93
  : args;
83
- console.log(styles.light(`> ${command} ${printableArgs.join(' ')}\n`));
94
+ if (printsCommand)
95
+ console.log(styles.light(`> ${command} ${printableArgs.join(' ')}\n`));
84
96
  const result = spawnSync(command, args, { stdio: 'pipe', encoding: 'utf8', ...options });
85
97
  const stderr = result.stderr.toString().trim();
86
98
  const stdout = result.stdout.toString().trim();
87
99
  const err = result.error;
100
+ // Always printed, whatever the verbosity — see the async twin.
88
101
  if (err !== undefined) {
89
102
  console.log(styles.light(chalk.italic('err:\n')));
90
103
  console.log(styles.error(unknownToString(err).replace(ansiRegex(), '')));
91
104
  console.log('');
92
105
  }
93
- if (stderr !== '') {
106
+ if (stderr !== '' && printsOutput) {
94
107
  console.log(styles.light(chalk.italic('stderr:\n')));
95
108
  console.log(styles.warning(stderr.replace(ansiRegex(), '')));
96
109
  console.log('');
97
110
  }
98
- if (stdout !== '') {
111
+ if (stdout !== '' && printsOutput) {
99
112
  console.log(styles.light(chalk.italic('stdout:\n')));
100
113
  console.log(styles.light(stdout.replace(ansiRegex(), '')));
101
114
  console.log('');
@@ -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 move from './move/index.js'
4
3
  export * as exists from './exists/index.js'
4
+ export * as move from './move/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'
@@ -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 move from './move/index.js'
4
3
  export * as exists from './exists/index.js'
4
+ export * as move from './move/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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@design-edito/tools",
3
- "version": "0.5.12",
3
+ "version": "0.5.14",
4
4
  "description": "",
5
5
  "author": "Maxime Fabas",
6
6
  "license": "ISC",