@adecore/utils 0.54.1 → 0.54.3
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/README.md +1 -1
- package/dist/errors.js +2 -3
- package/dist/fs.js +1 -1
- package/package.json +1 -1
- package/src/errors.ts +2 -3
- package/src/fs.ts +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @adecore/utils
|
|
2
2
|
|
|
3
|
-
Small helpers without dependencies: atomic file writes, path containment, the order of async work and reading a thrown value. Each lives at its own subpath
|
|
3
|
+
Small helpers without dependencies: atomic file writes, path containment, the order of async work and reading a thrown value. Each lives at its own subpath. `async`, `errors`, `record` and `text` run in a page; `fs` and `path` need Node or Bun.
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
6
|
bun add @adecore/utils
|
package/dist/errors.js
CHANGED
|
@@ -10,9 +10,8 @@ export function isNotFound(e) {
|
|
|
10
10
|
return hasErrorCode(e, 'ENOENT');
|
|
11
11
|
}
|
|
12
12
|
/*
|
|
13
|
-
* The message of an error, or its whole stack with `debug` set. Bun prints an Error object
|
|
14
|
-
*
|
|
15
|
-
* minified source, so an error is turned into a string first.
|
|
13
|
+
* The message of an error, or its whole stack with `debug` set. Bun prints an Error object with a code
|
|
14
|
+
* frame of its bundle, which in a compiled binary is a few lines of minified source. A string avoids that.
|
|
16
15
|
*/
|
|
17
16
|
export function describeError(error, debug) {
|
|
18
17
|
if (!(error instanceof Error)) {
|
package/dist/fs.js
CHANGED
|
@@ -129,7 +129,7 @@ export function writeAtomicSync(target, content, mode = 0o600) {
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
// Bun on Windows fails a forced rm with EFAULT while another delete of the same file is pending
|
|
132
|
+
// Bun on Windows fails a forced rm with EFAULT while another delete of the same file is pending. That delete removes it anyway.
|
|
133
133
|
export async function removeFile(path, remove = rm) {
|
|
134
134
|
try {
|
|
135
135
|
await remove(path, { force: true });
|
package/package.json
CHANGED
package/src/errors.ts
CHANGED
|
@@ -13,9 +13,8 @@ export function isNotFound(e: unknown): boolean {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/*
|
|
16
|
-
* The message of an error, or its whole stack with `debug` set. Bun prints an Error object
|
|
17
|
-
*
|
|
18
|
-
* minified source, so an error is turned into a string first.
|
|
16
|
+
* The message of an error, or its whole stack with `debug` set. Bun prints an Error object with a code
|
|
17
|
+
* frame of its bundle, which in a compiled binary is a few lines of minified source. A string avoids that.
|
|
19
18
|
*/
|
|
20
19
|
export function describeError(error: unknown, debug: boolean): string {
|
|
21
20
|
if (!(error instanceof Error)) {
|
package/src/fs.ts
CHANGED
|
@@ -151,7 +151,7 @@ export function writeAtomicSync(target: string, content: string | Uint8Array, mo
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
// Bun on Windows fails a forced rm with EFAULT while another delete of the same file is pending
|
|
154
|
+
// Bun on Windows fails a forced rm with EFAULT while another delete of the same file is pending. That delete removes it anyway.
|
|
155
155
|
export async function removeFile(path: string, remove: (path: string, options: { force: true }) => Promise<void> = rm): Promise<void> {
|
|
156
156
|
try {
|
|
157
157
|
await remove(path, { force: true });
|