@dotpi/tools 2.9.2 → 2.9.5

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 (110) hide show
  1. package/dotpi_root/bin/dotpi_prepare_system +8 -0
  2. package/dotpi_root/dist/@dotpi/avahi-monitor-module/package.json +1 -1
  3. package/dotpi_root/dist/@dotpi/javascript/package.json +1 -1
  4. package/dotpi_root/dist/@dotpi/module/package.json +2 -2
  5. package/dotpi_root/dist/@dotpi/module-module/package.json +3 -3
  6. package/package.json +5 -5
  7. package/dotpi_root/dist/@dotpi/javascript/node_modules/figures/index.d.ts +0 -279
  8. package/dotpi_root/dist/@dotpi/javascript/node_modules/figures/index.js +0 -292
  9. package/dotpi_root/dist/@dotpi/javascript/node_modules/figures/license +0 -9
  10. package/dotpi_root/dist/@dotpi/javascript/node_modules/figures/package.json +0 -49
  11. package/dotpi_root/dist/@dotpi/javascript/node_modules/figures/readme.md +0 -337
  12. package/dotpi_root/dist/@dotpi/javascript/node_modules/human-signals/LICENSE +0 -201
  13. package/dotpi_root/dist/@dotpi/javascript/node_modules/human-signals/README.md +0 -180
  14. package/dotpi_root/dist/@dotpi/javascript/node_modules/human-signals/build/src/core.js +0 -273
  15. package/dotpi_root/dist/@dotpi/javascript/node_modules/human-signals/build/src/main.d.ts +0 -206
  16. package/dotpi_root/dist/@dotpi/javascript/node_modules/human-signals/build/src/main.js +0 -70
  17. package/dotpi_root/dist/@dotpi/javascript/node_modules/human-signals/build/src/realtime.js +0 -16
  18. package/dotpi_root/dist/@dotpi/javascript/node_modules/human-signals/build/src/signals.js +0 -34
  19. package/dotpi_root/dist/@dotpi/javascript/node_modules/human-signals/package.json +0 -64
  20. package/dotpi_root/dist/@dotpi/javascript/node_modules/is-plain-obj/index.d.ts +0 -35
  21. package/dotpi_root/dist/@dotpi/javascript/node_modules/is-plain-obj/index.js +0 -8
  22. package/dotpi_root/dist/@dotpi/javascript/node_modules/is-plain-obj/license +0 -9
  23. package/dotpi_root/dist/@dotpi/javascript/node_modules/is-plain-obj/package.json +0 -41
  24. package/dotpi_root/dist/@dotpi/javascript/node_modules/is-plain-obj/readme.md +0 -58
  25. package/dotpi_root/dist/@dotpi/javascript/node_modules/is-unicode-supported/index.d.ts +0 -12
  26. package/dotpi_root/dist/@dotpi/javascript/node_modules/is-unicode-supported/index.js +0 -21
  27. package/dotpi_root/dist/@dotpi/javascript/node_modules/is-unicode-supported/license +0 -9
  28. package/dotpi_root/dist/@dotpi/javascript/node_modules/is-unicode-supported/package.json +0 -47
  29. package/dotpi_root/dist/@dotpi/javascript/node_modules/is-unicode-supported/readme.md +0 -35
  30. package/dotpi_root/dist/@dotpi/javascript/node_modules/npm-run-path/index.d.ts +0 -90
  31. package/dotpi_root/dist/@dotpi/javascript/node_modules/npm-run-path/index.js +0 -55
  32. package/dotpi_root/dist/@dotpi/javascript/node_modules/npm-run-path/license +0 -9
  33. package/dotpi_root/dist/@dotpi/javascript/node_modules/npm-run-path/package.json +0 -52
  34. package/dotpi_root/dist/@dotpi/javascript/node_modules/npm-run-path/readme.md +0 -104
  35. package/dotpi_root/dist/@dotpi/javascript/node_modules/path-key/index.d.ts +0 -31
  36. package/dotpi_root/dist/@dotpi/javascript/node_modules/path-key/index.js +0 -12
  37. package/dotpi_root/dist/@dotpi/javascript/node_modules/path-key/license +0 -9
  38. package/dotpi_root/dist/@dotpi/javascript/node_modules/path-key/package.json +0 -41
  39. package/dotpi_root/dist/@dotpi/javascript/node_modules/path-key/readme.md +0 -57
  40. package/dotpi_root/dist/@dotpi/javascript/node_modules/strip-final-newline/index.d.ts +0 -18
  41. package/dotpi_root/dist/@dotpi/javascript/node_modules/strip-final-newline/index.js +0 -26
  42. package/dotpi_root/dist/@dotpi/javascript/node_modules/strip-final-newline/license +0 -9
  43. package/dotpi_root/dist/@dotpi/javascript/node_modules/strip-final-newline/package.json +0 -49
  44. package/dotpi_root/dist/@dotpi/javascript/node_modules/strip-final-newline/readme.md +0 -34
  45. package/dotpi_root/dist/@dotpi/module/node_modules/figures/index.d.ts +0 -279
  46. package/dotpi_root/dist/@dotpi/module/node_modules/figures/index.js +0 -292
  47. package/dotpi_root/dist/@dotpi/module/node_modules/figures/license +0 -9
  48. package/dotpi_root/dist/@dotpi/module/node_modules/figures/package.json +0 -49
  49. package/dotpi_root/dist/@dotpi/module/node_modules/figures/readme.md +0 -337
  50. package/dotpi_root/dist/@dotpi/module/node_modules/globby/ignore.js +0 -109
  51. package/dotpi_root/dist/@dotpi/module/node_modules/globby/index.d.ts +0 -207
  52. package/dotpi_root/dist/@dotpi/module/node_modules/globby/index.js +0 -264
  53. package/dotpi_root/dist/@dotpi/module/node_modules/globby/license +0 -9
  54. package/dotpi_root/dist/@dotpi/module/node_modules/globby/node_modules/@sindresorhus/merge-streams/index.d.ts +0 -44
  55. package/dotpi_root/dist/@dotpi/module/node_modules/globby/node_modules/@sindresorhus/merge-streams/index.js +0 -223
  56. package/dotpi_root/dist/@dotpi/module/node_modules/globby/node_modules/@sindresorhus/merge-streams/license +0 -9
  57. package/dotpi_root/dist/@dotpi/module/node_modules/globby/node_modules/@sindresorhus/merge-streams/package.json +0 -49
  58. package/dotpi_root/dist/@dotpi/module/node_modules/globby/node_modules/@sindresorhus/merge-streams/readme.md +0 -53
  59. package/dotpi_root/dist/@dotpi/module/node_modules/globby/node_modules/unicorn-magic/default.js +0 -14
  60. package/dotpi_root/dist/@dotpi/module/node_modules/globby/node_modules/unicorn-magic/index.d.ts +0 -29
  61. package/dotpi_root/dist/@dotpi/module/node_modules/globby/node_modules/unicorn-magic/license +0 -9
  62. package/dotpi_root/dist/@dotpi/module/node_modules/globby/node_modules/unicorn-magic/node.js +0 -7
  63. package/dotpi_root/dist/@dotpi/module/node_modules/globby/node_modules/unicorn-magic/package.json +0 -49
  64. package/dotpi_root/dist/@dotpi/module/node_modules/globby/node_modules/unicorn-magic/readme.md +0 -25
  65. package/dotpi_root/dist/@dotpi/module/node_modules/globby/package.json +0 -94
  66. package/dotpi_root/dist/@dotpi/module/node_modules/globby/readme.md +0 -177
  67. package/dotpi_root/dist/@dotpi/module/node_modules/globby/utilities.js +0 -1
  68. package/dotpi_root/dist/@dotpi/module/node_modules/human-signals/LICENSE +0 -201
  69. package/dotpi_root/dist/@dotpi/module/node_modules/human-signals/README.md +0 -180
  70. package/dotpi_root/dist/@dotpi/module/node_modules/human-signals/build/src/core.js +0 -273
  71. package/dotpi_root/dist/@dotpi/module/node_modules/human-signals/build/src/main.d.ts +0 -206
  72. package/dotpi_root/dist/@dotpi/module/node_modules/human-signals/build/src/main.js +0 -70
  73. package/dotpi_root/dist/@dotpi/module/node_modules/human-signals/build/src/realtime.js +0 -16
  74. package/dotpi_root/dist/@dotpi/module/node_modules/human-signals/build/src/signals.js +0 -34
  75. package/dotpi_root/dist/@dotpi/module/node_modules/human-signals/package.json +0 -64
  76. package/dotpi_root/dist/@dotpi/module/node_modules/is-plain-obj/index.d.ts +0 -35
  77. package/dotpi_root/dist/@dotpi/module/node_modules/is-plain-obj/index.js +0 -8
  78. package/dotpi_root/dist/@dotpi/module/node_modules/is-plain-obj/license +0 -9
  79. package/dotpi_root/dist/@dotpi/module/node_modules/is-plain-obj/package.json +0 -41
  80. package/dotpi_root/dist/@dotpi/module/node_modules/is-plain-obj/readme.md +0 -58
  81. package/dotpi_root/dist/@dotpi/module/node_modules/is-unicode-supported/index.d.ts +0 -12
  82. package/dotpi_root/dist/@dotpi/module/node_modules/is-unicode-supported/index.js +0 -21
  83. package/dotpi_root/dist/@dotpi/module/node_modules/is-unicode-supported/license +0 -9
  84. package/dotpi_root/dist/@dotpi/module/node_modules/is-unicode-supported/package.json +0 -47
  85. package/dotpi_root/dist/@dotpi/module/node_modules/is-unicode-supported/readme.md +0 -35
  86. package/dotpi_root/dist/@dotpi/module/node_modules/npm-run-path/index.d.ts +0 -90
  87. package/dotpi_root/dist/@dotpi/module/node_modules/npm-run-path/index.js +0 -55
  88. package/dotpi_root/dist/@dotpi/module/node_modules/npm-run-path/license +0 -9
  89. package/dotpi_root/dist/@dotpi/module/node_modules/npm-run-path/package.json +0 -52
  90. package/dotpi_root/dist/@dotpi/module/node_modules/npm-run-path/readme.md +0 -104
  91. package/dotpi_root/dist/@dotpi/module/node_modules/path-key/index.d.ts +0 -31
  92. package/dotpi_root/dist/@dotpi/module/node_modules/path-key/index.js +0 -12
  93. package/dotpi_root/dist/@dotpi/module/node_modules/path-key/license +0 -9
  94. package/dotpi_root/dist/@dotpi/module/node_modules/path-key/package.json +0 -41
  95. package/dotpi_root/dist/@dotpi/module/node_modules/path-key/readme.md +0 -57
  96. package/dotpi_root/dist/@dotpi/module/node_modules/path-type/index.d.ts +0 -51
  97. package/dotpi_root/dist/@dotpi/module/node_modules/path-type/index.js +0 -41
  98. package/dotpi_root/dist/@dotpi/module/node_modules/path-type/license +0 -9
  99. package/dotpi_root/dist/@dotpi/module/node_modules/path-type/package.json +0 -47
  100. package/dotpi_root/dist/@dotpi/module/node_modules/path-type/readme.md +0 -74
  101. package/dotpi_root/dist/@dotpi/module/node_modules/slash/index.d.ts +0 -23
  102. package/dotpi_root/dist/@dotpi/module/node_modules/slash/index.js +0 -9
  103. package/dotpi_root/dist/@dotpi/module/node_modules/slash/license +0 -9
  104. package/dotpi_root/dist/@dotpi/module/node_modules/slash/package.json +0 -39
  105. package/dotpi_root/dist/@dotpi/module/node_modules/slash/readme.md +0 -36
  106. package/dotpi_root/dist/@dotpi/module/node_modules/strip-final-newline/index.d.ts +0 -18
  107. package/dotpi_root/dist/@dotpi/module/node_modules/strip-final-newline/index.js +0 -26
  108. package/dotpi_root/dist/@dotpi/module/node_modules/strip-final-newline/license +0 -9
  109. package/dotpi_root/dist/@dotpi/module/node_modules/strip-final-newline/package.json +0 -49
  110. package/dotpi_root/dist/@dotpi/module/node_modules/strip-final-newline/readme.md +0 -34
@@ -1,223 +0,0 @@
1
- import {on, once} from 'node:events';
2
- import {PassThrough as PassThroughStream} from 'node:stream';
3
- import {finished} from 'node:stream/promises';
4
-
5
- export default function mergeStreams(streams) {
6
- if (!Array.isArray(streams)) {
7
- throw new TypeError(`Expected an array, got \`${typeof streams}\`.`);
8
- }
9
-
10
- for (const stream of streams) {
11
- validateStream(stream);
12
- }
13
-
14
- const objectMode = streams.some(({readableObjectMode}) => readableObjectMode);
15
- const highWaterMark = getHighWaterMark(streams, objectMode);
16
- const passThroughStream = new MergedStream({
17
- objectMode,
18
- writableHighWaterMark: highWaterMark,
19
- readableHighWaterMark: highWaterMark,
20
- });
21
-
22
- for (const stream of streams) {
23
- passThroughStream.add(stream);
24
- }
25
-
26
- if (streams.length === 0) {
27
- endStream(passThroughStream);
28
- }
29
-
30
- return passThroughStream;
31
- }
32
-
33
- const getHighWaterMark = (streams, objectMode) => {
34
- if (streams.length === 0) {
35
- // @todo Use `node:stream` `getDefaultHighWaterMark(objectMode)` in next major release
36
- return 16_384;
37
- }
38
-
39
- const highWaterMarks = streams
40
- .filter(({readableObjectMode}) => readableObjectMode === objectMode)
41
- .map(({readableHighWaterMark}) => readableHighWaterMark);
42
- return Math.max(...highWaterMarks);
43
- };
44
-
45
- class MergedStream extends PassThroughStream {
46
- #streams = new Set([]);
47
- #ended = new Set([]);
48
- #aborted = new Set([]);
49
- #onFinished;
50
-
51
- add(stream) {
52
- validateStream(stream);
53
-
54
- if (this.#streams.has(stream)) {
55
- return;
56
- }
57
-
58
- this.#streams.add(stream);
59
-
60
- this.#onFinished ??= onMergedStreamFinished(this, this.#streams);
61
- endWhenStreamsDone({
62
- passThroughStream: this,
63
- stream,
64
- streams: this.#streams,
65
- ended: this.#ended,
66
- aborted: this.#aborted,
67
- onFinished: this.#onFinished,
68
- });
69
-
70
- stream.pipe(this, {end: false});
71
- }
72
-
73
- remove(stream) {
74
- validateStream(stream);
75
-
76
- if (!this.#streams.has(stream)) {
77
- return false;
78
- }
79
-
80
- stream.unpipe(this);
81
- return true;
82
- }
83
- }
84
-
85
- const onMergedStreamFinished = async (passThroughStream, streams) => {
86
- updateMaxListeners(passThroughStream, PASSTHROUGH_LISTENERS_COUNT);
87
- const controller = new AbortController();
88
-
89
- try {
90
- await Promise.race([
91
- onMergedStreamEnd(passThroughStream, controller),
92
- onInputStreamsUnpipe(passThroughStream, streams, controller),
93
- ]);
94
- } finally {
95
- controller.abort();
96
- updateMaxListeners(passThroughStream, -PASSTHROUGH_LISTENERS_COUNT);
97
- }
98
- };
99
-
100
- const onMergedStreamEnd = async (passThroughStream, {signal}) => {
101
- await finished(passThroughStream, {signal, cleanup: true});
102
- };
103
-
104
- const onInputStreamsUnpipe = async (passThroughStream, streams, {signal}) => {
105
- for await (const [unpipedStream] of on(passThroughStream, 'unpipe', {signal})) {
106
- if (streams.has(unpipedStream)) {
107
- unpipedStream.emit(unpipeEvent);
108
- }
109
- }
110
- };
111
-
112
- const validateStream = stream => {
113
- if (typeof stream?.pipe !== 'function') {
114
- throw new TypeError(`Expected a readable stream, got: \`${typeof stream}\`.`);
115
- }
116
- };
117
-
118
- const endWhenStreamsDone = async ({passThroughStream, stream, streams, ended, aborted, onFinished}) => {
119
- updateMaxListeners(passThroughStream, PASSTHROUGH_LISTENERS_PER_STREAM);
120
- const controller = new AbortController();
121
-
122
- try {
123
- await Promise.race([
124
- afterMergedStreamFinished(onFinished, stream),
125
- onInputStreamEnd({passThroughStream, stream, streams, ended, aborted, controller}),
126
- onInputStreamUnpipe({stream, streams, ended, aborted, controller}),
127
- ]);
128
- } finally {
129
- controller.abort();
130
- updateMaxListeners(passThroughStream, -PASSTHROUGH_LISTENERS_PER_STREAM);
131
- }
132
-
133
- if (streams.size === ended.size + aborted.size) {
134
- if (ended.size === 0 && aborted.size > 0) {
135
- abortStream(passThroughStream);
136
- } else {
137
- endStream(passThroughStream);
138
- }
139
- }
140
- };
141
-
142
- // This is the error thrown by `finished()` on `stream.destroy()`
143
- const isAbortError = error => error?.code === 'ERR_STREAM_PREMATURE_CLOSE';
144
-
145
- const afterMergedStreamFinished = async (onFinished, stream) => {
146
- try {
147
- await onFinished;
148
- abortStream(stream);
149
- } catch (error) {
150
- if (isAbortError(error)) {
151
- abortStream(stream);
152
- } else {
153
- errorStream(stream, error);
154
- }
155
- }
156
- };
157
-
158
- const onInputStreamEnd = async ({passThroughStream, stream, streams, ended, aborted, controller: {signal}}) => {
159
- try {
160
- await finished(stream, {signal, cleanup: true, readable: true, writable: false});
161
- if (streams.has(stream)) {
162
- ended.add(stream);
163
- }
164
- } catch (error) {
165
- if (signal.aborted || !streams.has(stream)) {
166
- return;
167
- }
168
-
169
- if (isAbortError(error)) {
170
- aborted.add(stream);
171
- } else {
172
- errorStream(passThroughStream, error);
173
- }
174
- }
175
- };
176
-
177
- const onInputStreamUnpipe = async ({stream, streams, ended, aborted, controller: {signal}}) => {
178
- await once(stream, unpipeEvent, {signal});
179
- streams.delete(stream);
180
- ended.delete(stream);
181
- aborted.delete(stream);
182
- };
183
-
184
- const unpipeEvent = Symbol('unpipe');
185
-
186
- const endStream = stream => {
187
- if (stream.writable) {
188
- stream.end();
189
- }
190
- };
191
-
192
- const abortStream = stream => {
193
- if (stream.readable || stream.writable) {
194
- stream.destroy();
195
- }
196
- };
197
-
198
- // `stream.destroy(error)` crashes the process with `uncaughtException` if no `error` event listener exists on `stream`.
199
- // We take care of error handling on user behalf, so we do not want this to happen.
200
- const errorStream = (stream, error) => {
201
- if (!stream.destroyed) {
202
- stream.once('error', noop);
203
- stream.destroy(error);
204
- }
205
- };
206
-
207
- const noop = () => {};
208
-
209
- const updateMaxListeners = (passThroughStream, increment) => {
210
- const maxListeners = passThroughStream.getMaxListeners();
211
- if (maxListeners !== 0 && maxListeners !== Number.POSITIVE_INFINITY) {
212
- passThroughStream.setMaxListeners(maxListeners + increment);
213
- }
214
- };
215
-
216
- // Number of times `passThroughStream.on()` is called regardless of streams:
217
- // - once due to `finished(passThroughStream)`
218
- // - once due to `on(passThroughStream)`
219
- const PASSTHROUGH_LISTENERS_COUNT = 2;
220
-
221
- // Number of times `passThroughStream.on()` is called per stream:
222
- // - once due to `stream.pipe(passThroughStream)`
223
- const PASSTHROUGH_LISTENERS_PER_STREAM = 1;
@@ -1,9 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,49 +0,0 @@
1
- {
2
- "name": "@sindresorhus/merge-streams",
3
- "version": "2.3.0",
4
- "description": "Merge multiple streams into a unified stream",
5
- "license": "MIT",
6
- "repository": "sindresorhus/merge-streams",
7
- "funding": "https://github.com/sponsors/sindresorhus",
8
- "author": {
9
- "name": "Sindre Sorhus",
10
- "email": "sindresorhus@gmail.com",
11
- "url": "https://sindresorhus.com"
12
- },
13
- "type": "module",
14
- "exports": {
15
- "types": "./index.d.ts",
16
- "default": "./index.js"
17
- },
18
- "sideEffects": false,
19
- "engines": {
20
- "node": ">=18"
21
- },
22
- "scripts": {
23
- "test": "xo && c8 ava && tsd"
24
- },
25
- "files": [
26
- "index.js",
27
- "index.d.ts"
28
- ],
29
- "keywords": [
30
- "merge",
31
- "stream",
32
- "streams",
33
- "readable",
34
- "passthrough",
35
- "interleave",
36
- "interleaved",
37
- "unify",
38
- "unified"
39
- ],
40
- "devDependencies": {
41
- "@types/node": "^20.8.9",
42
- "ava": "^6.1.0",
43
- "c8": "^9.1.0",
44
- "tempfile": "^5.0.0",
45
- "tsd": "^0.30.4",
46
- "typescript": "^5.2.2",
47
- "xo": "^0.56.0"
48
- }
49
- }
@@ -1,53 +0,0 @@
1
- # merge-streams
2
-
3
- > Merge multiple streams into a unified stream
4
-
5
- ## Install
6
-
7
- ```sh
8
- npm install @sindresorhus/merge-streams
9
- ```
10
-
11
- ## Usage
12
-
13
- ```js
14
- import mergeStreams from '@sindresorhus/merge-streams';
15
-
16
- const stream = mergeStreams([streamA, streamB]);
17
-
18
- for await (const chunk of stream) {
19
- console.log(chunk);
20
- //=> 'A1'
21
- //=> 'B1'
22
- //=> 'A2'
23
- //=> 'B2'
24
- }
25
- ```
26
-
27
- ## API
28
-
29
- ### `mergeStreams(streams: stream.Readable[]): MergedStream`
30
-
31
- Merges an array of [readable streams](https://nodejs.org/api/stream.html#readable-streams) and returns a new readable stream that emits data from the individual streams as it arrives.
32
-
33
- If you provide an empty array, it returns an already-ended stream.
34
-
35
- #### `MergedStream`
36
-
37
- _Type_: `stream.Readable`
38
-
39
- A single stream combining the output of multiple streams.
40
-
41
- ##### `MergedStream.add(stream: stream.Readable): void`
42
-
43
- Pipe a new readable stream.
44
-
45
- Throws if `MergedStream` has already ended.
46
-
47
- ##### `MergedStream.remove(stream: stream.Readable): boolean`
48
-
49
- Unpipe a stream previously added using either [`mergeStreams(streams)`](#mergestreamsstreams-streamreadable-mergedstream) or [`MergedStream.add(stream)`](#mergedstreamaddstream-streamreadable-void).
50
-
51
- Returns `false` if the stream was not previously added, or if it was already removed by `MergedStream.remove(stream)`.
52
-
53
- The removed stream is not automatically ended.
@@ -1,14 +0,0 @@
1
- export async function delay({seconds, milliseconds} = {}) {
2
- let duration;
3
- if (typeof seconds === 'number') {
4
- duration = seconds * 1000;
5
- } else if (typeof milliseconds === 'number') {
6
- duration = milliseconds;
7
- } else {
8
- throw new TypeError('Expected an object with either `seconds` or `milliseconds`.');
9
- }
10
-
11
- return new Promise(resolve => {
12
- setTimeout(resolve, duration);
13
- });
14
- }
@@ -1,29 +0,0 @@
1
- /**
2
- Delay the promise for the given duration.
3
-
4
- @example
5
- ```
6
- import {delay} from 'unicorn-magic';
7
-
8
- await delay({seconds: 1});
9
-
10
- console.log('1 second later');
11
- ```
12
- */
13
- export function delay(duration: {seconds: number} | {milliseconds: number}): Promise<void>;
14
-
15
- /**
16
- Convert a `URL` or path to a path.
17
-
18
- **Not available in browsers.**
19
-
20
- @example
21
- ```
22
- import path from 'node:path';
23
- import {toPath} from 'unicorn-magic';
24
-
25
- // `cwd` can be `URL` or a path string.
26
- const getUnicornPath = cwd => path.join(toPath(cwd), 'unicorn');
27
- ```
28
- */
29
- export function toPath(urlOrPath: URL | string): string;
@@ -1,9 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,7 +0,0 @@
1
- import {fileURLToPath} from 'node:url';
2
-
3
- export function toPath(urlOrPath) {
4
- return urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
5
- }
6
-
7
- export * from './default.js';
@@ -1,49 +0,0 @@
1
- {
2
- "name": "unicorn-magic",
3
- "version": "0.1.0",
4
- "description": "Some useful utilities I often need",
5
- "license": "MIT",
6
- "repository": "sindresorhus/unicorn-magic",
7
- "funding": "https://github.com/sponsors/sindresorhus",
8
- "author": {
9
- "name": "Sindre Sorhus",
10
- "email": "sindresorhus@gmail.com",
11
- "url": "https://sindresorhus.com"
12
- },
13
- "type": "module",
14
- "exports": {
15
- "types": "./index.d.ts",
16
- "node": "./node.js",
17
- "default": "./default.js"
18
- },
19
- "sideEffects": false,
20
- "engines": {
21
- "node": ">=18"
22
- },
23
- "scripts": {
24
- "test": "xo && ava && tsc index.d.ts"
25
- },
26
- "files": [
27
- "node.js",
28
- "default.js",
29
- "index.d.ts"
30
- ],
31
- "keywords": [
32
- "utilities",
33
- "util",
34
- "extras",
35
- "url",
36
- "path",
37
- "delay",
38
- "wait",
39
- "settimeout",
40
- "sleep"
41
- ],
42
- "devDependencies": {
43
- "ava": "^5.3.1",
44
- "in-range": "^3.0.0",
45
- "time-span": "^5.1.0",
46
- "typescript": "^5.2.2",
47
- "xo": "^0.56.0"
48
- }
49
- }
@@ -1,25 +0,0 @@
1
- # unicorn-magic
2
-
3
- > Some useful utilities I often need
4
-
5
- *I'm not accepting requests.*
6
-
7
- ## Install
8
-
9
- ```sh
10
- npm install unicorn-magic
11
- ```
12
-
13
- ## Usage
14
-
15
- ```js
16
- import {delay} from 'unicorn-magic';
17
-
18
- await delay({seconds: 1});
19
-
20
- console.log('1 second later');
21
- ```
22
-
23
- ## API
24
-
25
- See [the types](index.d.ts).
@@ -1,94 +0,0 @@
1
- {
2
- "name": "globby",
3
- "version": "14.0.2",
4
- "description": "User-friendly glob matching",
5
- "license": "MIT",
6
- "repository": "sindresorhus/globby",
7
- "funding": "https://github.com/sponsors/sindresorhus",
8
- "author": {
9
- "email": "sindresorhus@gmail.com",
10
- "name": "Sindre Sorhus",
11
- "url": "https://sindresorhus.com"
12
- },
13
- "type": "module",
14
- "exports": {
15
- "types": "./index.d.ts",
16
- "default": "./index.js"
17
- },
18
- "sideEffects": false,
19
- "engines": {
20
- "node": ">=18"
21
- },
22
- "scripts": {
23
- "bench": "npm update @globby/main-branch glob-stream fast-glob && node bench.js",
24
- "test": "xo && ava && tsd"
25
- },
26
- "files": [
27
- "index.js",
28
- "index.d.ts",
29
- "ignore.js",
30
- "utilities.js"
31
- ],
32
- "keywords": [
33
- "all",
34
- "array",
35
- "directories",
36
- "expand",
37
- "files",
38
- "filesystem",
39
- "filter",
40
- "find",
41
- "fnmatch",
42
- "folders",
43
- "fs",
44
- "glob",
45
- "globbing",
46
- "globs",
47
- "gulpfriendly",
48
- "match",
49
- "matcher",
50
- "minimatch",
51
- "multi",
52
- "multiple",
53
- "paths",
54
- "pattern",
55
- "patterns",
56
- "traverse",
57
- "util",
58
- "utility",
59
- "wildcard",
60
- "wildcards",
61
- "promise",
62
- "gitignore",
63
- "git"
64
- ],
65
- "dependencies": {
66
- "@sindresorhus/merge-streams": "^2.1.0",
67
- "fast-glob": "^3.3.2",
68
- "ignore": "^5.2.4",
69
- "path-type": "^5.0.0",
70
- "slash": "^5.1.0",
71
- "unicorn-magic": "^0.1.0"
72
- },
73
- "devDependencies": {
74
- "@globby/main-branch": "sindresorhus/globby#main",
75
- "@types/node": "^20.9.0",
76
- "ava": "^5.3.1",
77
- "benchmark": "2.1.4",
78
- "glob-stream": "^8.0.0",
79
- "tempy": "^3.1.0",
80
- "tsd": "^0.30.4",
81
- "xo": "^0.57.0"
82
- },
83
- "xo": {
84
- "ignores": [
85
- "fixtures"
86
- ]
87
- },
88
- "ava": {
89
- "files": [
90
- "!tests/utilities.js"
91
- ],
92
- "workerThreads": false
93
- }
94
- }