@socketsecurity/lib 5.18.1 → 5.19.0
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/CHANGELOG.md +49 -0
- package/README.md +6 -5
- package/dist/abort.d.ts +3 -0
- package/dist/abort.js +1 -0
- package/dist/agent.d.ts +66 -49
- package/dist/agent.js +51 -50
- package/dist/ansi.d.ts +2 -5
- package/dist/ansi.js +3 -2
- package/dist/archives.d.ts +25 -21
- package/dist/archives.js +35 -34
- package/dist/argv/flags.d.ts +100 -91
- package/dist/argv/flags.js +88 -87
- package/dist/argv/parse.d.ts +30 -40
- package/dist/argv/parse.js +33 -32
- package/dist/arrays.d.ts +4 -8
- package/dist/arrays.js +1 -0
- package/dist/bin.d.ts +7 -5
- package/dist/bin.js +52 -29
- package/dist/cacache.d.ts +13 -12
- package/dist/cacache.js +9 -8
- package/dist/cache-with-ttl.d.ts +53 -35
- package/dist/cache-with-ttl.js +1 -0
- package/dist/colors.d.ts +5 -5
- package/dist/colors.js +1 -0
- package/dist/constants/agents.d.ts +5 -9
- package/dist/constants/agents.js +3 -2
- package/dist/constants/core.d.ts +5 -10
- package/dist/constants/core.js +2 -1
- package/dist/constants/encoding.d.ts +3 -3
- package/dist/constants/encoding.js +1 -0
- package/dist/constants/github.d.ts +3 -3
- package/dist/constants/github.js +1 -0
- package/dist/constants/licenses.d.ts +9 -2
- package/dist/constants/licenses.js +1 -0
- package/dist/constants/lifecycle-script-names.js +1 -0
- package/dist/constants/maintained-node-versions.d.ts +3 -0
- package/dist/constants/maintained-node-versions.js +1 -0
- package/dist/constants/node.d.ts +125 -16
- package/dist/constants/node.js +74 -73
- package/dist/constants/package-default-node-range.d.ts +3 -1
- package/dist/constants/package-default-node-range.js +2 -1
- package/dist/constants/package-default-socket-categories.d.ts +0 -1
- package/dist/constants/package-default-socket-categories.js +1 -0
- package/dist/constants/packages.d.ts +12 -17
- package/dist/constants/packages.js +31 -16
- package/dist/constants/platform.d.ts +1 -2
- package/dist/constants/platform.js +2 -1
- package/dist/constants/process.d.ts +18 -0
- package/dist/constants/process.js +1 -0
- package/dist/constants/socket.d.ts +4 -10
- package/dist/constants/socket.js +2 -1
- package/dist/constants/testing.d.ts +3 -3
- package/dist/constants/testing.js +1 -0
- package/dist/constants/time.d.ts +3 -4
- package/dist/constants/time.js +1 -0
- package/dist/constants/typescript.d.ts +10 -3
- package/dist/constants/typescript.js +5 -4
- package/dist/cover/code.d.ts +3 -0
- package/dist/cover/code.js +12 -12
- package/dist/cover/formatters.d.ts +12 -9
- package/dist/cover/formatters.js +19 -18
- package/dist/cover/type.d.ts +3 -0
- package/dist/cover/type.js +1 -0
- package/dist/cover/types.js +1 -0
- package/dist/debug.d.ts +32 -47
- package/dist/debug.js +97 -96
- package/dist/dlx/arborist.d.ts +134 -0
- package/dist/dlx/arborist.js +177 -0
- package/dist/dlx/binary.d.ts +25 -9
- package/dist/dlx/binary.js +34 -12
- package/dist/dlx/cache.d.ts +1 -0
- package/dist/dlx/cache.js +2 -1
- package/dist/dlx/detect.d.ts +15 -0
- package/dist/dlx/detect.js +28 -20
- package/dist/dlx/dir.d.ts +1 -11
- package/dist/dlx/dir.js +2 -12
- package/dist/dlx/integrity.d.ts +86 -0
- package/dist/dlx/integrity.js +112 -0
- package/dist/dlx/lockfile.d.ts +115 -0
- package/dist/dlx/lockfile.js +139 -0
- package/dist/dlx/manifest.d.ts +26 -1
- package/dist/dlx/manifest.js +9 -6
- package/dist/dlx/package.d.ts +58 -3
- package/dist/dlx/package.js +101 -74
- package/dist/dlx/packages.d.ts +1 -11
- package/dist/dlx/packages.js +3 -14
- package/dist/dlx/paths.d.ts +1 -0
- package/dist/dlx/paths.js +2 -1
- package/dist/effects/pulse-frames.js +1 -0
- package/dist/effects/text-shimmer.d.ts +13 -2
- package/dist/effects/text-shimmer.js +50 -46
- package/dist/effects/types.js +1 -0
- package/dist/effects/ultra.js +1 -0
- package/dist/env/ci.d.ts +6 -1
- package/dist/env/ci.js +1 -0
- package/dist/env/debug.d.ts +5 -1
- package/dist/env/debug.js +1 -0
- package/dist/env/github.d.ts +19 -23
- package/dist/env/github.js +5 -4
- package/dist/env/helpers.d.ts +21 -9
- package/dist/env/helpers.js +5 -11
- package/dist/env/home.d.ts +17 -4
- package/dist/env/home.js +2 -1
- package/dist/env/locale.d.ts +4 -3
- package/dist/env/locale.js +1 -0
- package/dist/env/node-auth-token.d.ts +5 -1
- package/dist/env/node-auth-token.js +1 -0
- package/dist/env/node-env.d.ts +5 -1
- package/dist/env/node-env.js +1 -0
- package/dist/env/npm.d.ts +4 -5
- package/dist/env/npm.js +1 -0
- package/dist/env/package-manager.d.ts +4 -3
- package/dist/env/package-manager.js +2 -1
- package/dist/env/path.d.ts +5 -1
- package/dist/env/path.js +1 -0
- package/dist/env/pre-commit.d.ts +5 -1
- package/dist/env/pre-commit.js +1 -0
- package/dist/env/rewire.d.ts +10 -0
- package/dist/env/rewire.js +7 -5
- package/dist/env/shell.d.ts +5 -1
- package/dist/env/shell.js +1 -0
- package/dist/env/socket-cli-shadow.d.ts +4 -5
- package/dist/env/socket-cli-shadow.js +1 -0
- package/dist/env/socket-cli.d.ts +4 -14
- package/dist/env/socket-cli.js +1 -0
- package/dist/env/socket.d.ts +6 -18
- package/dist/env/socket.js +4 -3
- package/dist/env/temp-dir.d.ts +4 -3
- package/dist/env/temp-dir.js +1 -0
- package/dist/env/term.d.ts +5 -1
- package/dist/env/term.js +1 -0
- package/dist/env/test.d.ts +4 -3
- package/dist/env/test.js +1 -0
- package/dist/env/windows.d.ts +4 -4
- package/dist/env/windows.js +1 -0
- package/dist/env/xdg.d.ts +4 -3
- package/dist/env/xdg.js +1 -0
- package/dist/env.d.ts +83 -23
- package/dist/env.js +112 -80
- package/dist/errors.js +1 -0
- package/dist/external/@npmcli/package-json.js +9 -3968
- package/dist/external/@socketregistry/packageurl-js.js +2 -2
- package/dist/external/debug.js +162 -328
- package/dist/external/external-pack.js +3 -2835
- package/dist/external/npm-pack.js +13939 -33342
- package/dist/external/zod.js +160 -7558
- package/dist/fs.d.ts +92 -113
- package/dist/fs.js +35 -35
- package/dist/git.d.ts +170 -164
- package/dist/git.js +113 -87
- package/dist/github.d.ts +249 -227
- package/dist/github.js +82 -81
- package/dist/globs.d.ts +31 -17
- package/dist/globs.js +51 -58
- package/dist/http-request.d.ts +99 -99
- package/dist/http-request.js +182 -156
- package/dist/ipc-cli.d.ts +28 -0
- package/dist/{utils/get-ipc.js → ipc-cli.js} +4 -3
- package/dist/ipc.d.ts +9 -299
- package/dist/ipc.js +18 -204
- package/dist/json/edit.d.ts +3 -1
- package/dist/json/edit.js +30 -30
- package/dist/json/format.d.ts +36 -36
- package/dist/json/format.js +22 -21
- package/dist/json/parse.d.ts +4 -2
- package/dist/json/parse.js +1 -0
- package/dist/json/types.js +1 -0
- package/dist/{links/index.d.ts → links.d.ts} +6 -2
- package/dist/{links/index.js → links.js} +5 -4
- package/dist/logger.d.ts +4 -6
- package/dist/logger.js +61 -53
- package/dist/memoization.d.ts +52 -49
- package/dist/memoization.js +55 -33
- package/dist/objects.d.ts +25 -44
- package/dist/objects.js +2 -1
- package/dist/package-extensions.d.ts +6 -0
- package/dist/package-extensions.js +2 -1
- package/dist/packages/edit.d.ts +3 -5
- package/dist/packages/edit.js +4 -3
- package/dist/packages/exports.d.ts +11 -14
- package/dist/packages/exports.js +11 -10
- package/dist/packages/isolation.d.ts +4 -0
- package/dist/packages/isolation.js +20 -19
- package/dist/packages/licenses.d.ts +3 -10
- package/dist/packages/licenses.js +2 -1
- package/dist/packages/manifest.d.ts +3 -3
- package/dist/packages/manifest.js +1 -0
- package/dist/packages/normalize.d.ts +3 -4
- package/dist/packages/normalize.js +1 -0
- package/dist/packages/operations.d.ts +3 -10
- package/dist/packages/operations.js +1 -0
- package/dist/packages/provenance.d.ts +10 -8
- package/dist/packages/provenance.js +55 -54
- package/dist/packages/specs.d.ts +3 -5
- package/dist/packages/specs.js +1 -0
- package/dist/packages/validation.d.ts +3 -3
- package/dist/packages/validation.js +1 -0
- package/dist/packages.d.ts +2 -17
- package/dist/packages.js +2 -1
- package/dist/paths/dirnames.d.ts +0 -2
- package/dist/paths/dirnames.js +1 -0
- package/dist/paths/exts.d.ts +0 -1
- package/dist/paths/exts.js +1 -0
- package/dist/paths/filenames.d.ts +0 -1
- package/dist/paths/filenames.js +1 -0
- package/dist/paths/globs.d.ts +0 -1
- package/dist/paths/globs.js +1 -0
- package/dist/paths/normalize.d.ts +115 -123
- package/dist/paths/normalize.js +128 -127
- package/dist/paths/packages.d.ts +3 -2
- package/dist/paths/packages.js +2 -1
- package/dist/paths/rewire.d.ts +9 -0
- package/dist/paths/rewire.js +5 -3
- package/dist/paths/socket.d.ts +37 -23
- package/dist/paths/socket.js +26 -25
- package/dist/performance.d.ts +87 -84
- package/dist/performance.js +97 -96
- package/dist/process-lock.d.ts +41 -1
- package/dist/process-lock.js +24 -17
- package/dist/promise-queue.d.ts +6 -0
- package/dist/promise-queue.js +1 -0
- package/dist/promises.d.ts +40 -55
- package/dist/promises.js +12 -11
- package/dist/regexps.d.ts +0 -5
- package/dist/regexps.js +1 -0
- package/dist/releases/github.d.ts +59 -63
- package/dist/releases/github.js +95 -100
- package/dist/releases/socket-btm.d.ts +9 -2
- package/dist/releases/socket-btm.js +32 -25
- package/dist/sea.d.ts +5 -0
- package/dist/sea.js +1 -0
- package/dist/shadow.d.ts +4 -0
- package/dist/shadow.js +1 -0
- package/dist/signal-exit.d.ts +7 -7
- package/dist/signal-exit.js +46 -45
- package/dist/sorts.d.ts +5 -7
- package/dist/sorts.js +11 -10
- package/dist/spawn.d.ts +96 -77
- package/dist/spawn.js +39 -38
- package/dist/spinner.d.ts +21 -22
- package/dist/spinner.js +15 -11
- package/dist/ssri.d.ts +31 -36
- package/dist/ssri.js +15 -14
- package/dist/stdio/_stream.d.ts +31 -0
- package/dist/stdio/_stream.js +57 -0
- package/dist/stdio/divider.d.ts +40 -36
- package/dist/stdio/divider.js +10 -9
- package/dist/stdio/footer.d.ts +20 -0
- package/dist/stdio/footer.js +12 -2
- package/dist/stdio/header.d.ts +4 -16
- package/dist/stdio/header.js +1 -9
- package/dist/stdio/stderr.d.ts +51 -39
- package/dist/stdio/stderr.js +19 -22
- package/dist/stdio/stdout.d.ts +54 -52
- package/dist/stdio/stdout.js +35 -33
- package/dist/streams.d.ts +4 -3
- package/dist/streams.js +1 -0
- package/dist/strings.d.ts +31 -85
- package/dist/strings.js +5 -49
- package/dist/suppress-warnings.d.ts +32 -15
- package/dist/suppress-warnings.js +14 -13
- package/dist/tables.d.ts +30 -26
- package/dist/tables.js +24 -23
- package/dist/temporary-executor.d.ts +4 -0
- package/dist/temporary-executor.js +1 -0
- package/dist/themes/context.d.ts +30 -26
- package/dist/themes/context.js +19 -18
- package/dist/themes/index.d.ts +0 -4
- package/dist/themes/index.js +1 -0
- package/dist/themes/themes.d.ts +1 -1
- package/dist/themes/themes.js +1 -0
- package/dist/themes/types.js +1 -0
- package/dist/themes/utils.d.ts +46 -43
- package/dist/themes/utils.js +45 -44
- package/dist/types.d.ts +48 -52
- package/dist/types.js +35 -35
- package/dist/url.d.ts +48 -53
- package/dist/url.js +38 -37
- package/dist/validation/json-parser.d.ts +19 -190
- package/dist/validation/json-parser.js +5 -69
- package/dist/validation/types.d.ts +9 -33
- package/dist/validation/types.js +1 -0
- package/dist/versions.d.ts +1 -0
- package/dist/versions.js +2 -1
- package/dist/words.d.ts +3 -6
- package/dist/words.js +1 -0
- package/dist/zod.js +1 -0
- package/package.json +34 -70
- package/dist/external/@inquirer/checkbox.js +0 -5
- package/dist/external/@inquirer/confirm.js +0 -5
- package/dist/external/@inquirer/input.js +0 -5
- package/dist/external/@inquirer/password.js +0 -5
- package/dist/external/@inquirer/search.js +0 -5
- package/dist/external/@inquirer/select.js +0 -5
- package/dist/functions.d.ts +0 -57
- package/dist/functions.js +0 -70
- package/dist/stdio/clear.d.ts +0 -140
- package/dist/stdio/clear.js +0 -95
- package/dist/stdio/mask.d.ts +0 -151
- package/dist/stdio/mask.js +0 -224
- package/dist/stdio/progress.d.ts +0 -148
- package/dist/stdio/progress.js +0 -212
- package/dist/stdio/prompts.d.ts +0 -195
- package/dist/stdio/prompts.js +0 -176
- package/dist/utils/get-ipc.d.ts +0 -15
package/dist/fs.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview File system utilities with cross-platform path handling.
|
|
3
|
+
* Provides enhanced fs operations, glob matching, and directory traversal functions.
|
|
4
|
+
*/
|
|
4
5
|
import { type Remap } from './objects';
|
|
6
|
+
import type { Abortable } from 'node:events';
|
|
7
|
+
import type { MakeDirectoryOptions, ObjectEncodingOptions, OpenMode, PathLike } from 'node:fs';
|
|
8
|
+
import type { JsonReviver } from './json/types';
|
|
5
9
|
/**
|
|
6
10
|
* Supported text encodings for Node.js Buffers.
|
|
7
11
|
* Includes ASCII, UTF-8/16, base64, binary, and hexadecimal encodings.
|
|
8
12
|
*/
|
|
9
13
|
export type BufferEncoding = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'base64url' | 'latin1' | 'binary' | 'hex';
|
|
10
|
-
/**
|
|
11
|
-
* Represents any valid JSON content type.
|
|
12
|
-
*/
|
|
13
|
-
export type JsonContent = unknown;
|
|
14
14
|
/**
|
|
15
15
|
* Options for asynchronous `findUp` operations.
|
|
16
16
|
*/
|
|
@@ -72,20 +72,9 @@ export interface IsDirEmptyOptions {
|
|
|
72
72
|
ignore?: string[] | readonly string[] | undefined;
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
75
|
+
* Represents any valid JSON content type.
|
|
76
76
|
*/
|
|
77
|
-
export
|
|
78
|
-
/**
|
|
79
|
-
* Character encoding to use for reading.
|
|
80
|
-
* @default 'utf8'
|
|
81
|
-
*/
|
|
82
|
-
encoding?: BufferEncoding | string | undefined;
|
|
83
|
-
/**
|
|
84
|
-
* File system flag for reading behavior.
|
|
85
|
-
* @default 'r'
|
|
86
|
-
*/
|
|
87
|
-
flag?: string | undefined;
|
|
88
|
-
}
|
|
77
|
+
export type JsonContent = unknown;
|
|
89
78
|
/**
|
|
90
79
|
* Options for reading directories with filtering and sorting.
|
|
91
80
|
*/
|
|
@@ -130,6 +119,21 @@ export type ReadJsonOptions = Remap<ReadFileOptions & {
|
|
|
130
119
|
*/
|
|
131
120
|
reviver?: Parameters<typeof JSON.parse>[1] | undefined;
|
|
132
121
|
}>;
|
|
122
|
+
/**
|
|
123
|
+
* Options for read operations with abort support.
|
|
124
|
+
*/
|
|
125
|
+
export interface ReadOptions extends Abortable {
|
|
126
|
+
/**
|
|
127
|
+
* Character encoding to use for reading.
|
|
128
|
+
* @default 'utf8'
|
|
129
|
+
*/
|
|
130
|
+
encoding?: BufferEncoding | string | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* File system flag for reading behavior.
|
|
133
|
+
* @default 'r'
|
|
134
|
+
*/
|
|
135
|
+
flag?: string | undefined;
|
|
136
|
+
}
|
|
133
137
|
/**
|
|
134
138
|
* Options for file/directory removal operations.
|
|
135
139
|
*/
|
|
@@ -171,25 +175,19 @@ export interface SafeReadOptions extends ReadOptions {
|
|
|
171
175
|
defaultValue?: unknown | undefined;
|
|
172
176
|
}
|
|
173
177
|
/**
|
|
174
|
-
*
|
|
178
|
+
* Result of file readability validation.
|
|
179
|
+
* Contains lists of valid and invalid file paths.
|
|
175
180
|
*/
|
|
176
|
-
export interface
|
|
177
|
-
/**
|
|
178
|
-
* Character encoding for writing.
|
|
179
|
-
* @default 'utf8'
|
|
180
|
-
*/
|
|
181
|
-
encoding?: BufferEncoding | string | undefined;
|
|
181
|
+
export interface ValidateFilesResult {
|
|
182
182
|
/**
|
|
183
|
-
* File
|
|
184
|
-
* Uses standard Unix permission bits (e.g., 0o644).
|
|
185
|
-
* @default 0o666 (read/write for all, respecting umask)
|
|
183
|
+
* File paths that passed validation and are readable.
|
|
186
184
|
*/
|
|
187
|
-
|
|
185
|
+
validPaths: string[];
|
|
188
186
|
/**
|
|
189
|
-
* File
|
|
190
|
-
*
|
|
187
|
+
* File paths that failed validation (unreadable, permission denied, or non-existent).
|
|
188
|
+
* Common with Yarn Berry PnP virtual filesystem, pnpm symlinks, or filesystem race conditions.
|
|
191
189
|
*/
|
|
192
|
-
|
|
190
|
+
invalidPaths: string[];
|
|
193
191
|
}
|
|
194
192
|
/**
|
|
195
193
|
* Options for writing JSON files with formatting control.
|
|
@@ -229,6 +227,27 @@ export interface WriteJsonOptions extends WriteOptions {
|
|
|
229
227
|
*/
|
|
230
228
|
spaces?: number | string | undefined;
|
|
231
229
|
}
|
|
230
|
+
/**
|
|
231
|
+
* Options for write operations with encoding and mode control.
|
|
232
|
+
*/
|
|
233
|
+
export interface WriteOptions extends Abortable {
|
|
234
|
+
/**
|
|
235
|
+
* Character encoding for writing.
|
|
236
|
+
* @default 'utf8'
|
|
237
|
+
*/
|
|
238
|
+
encoding?: BufferEncoding | string | undefined;
|
|
239
|
+
/**
|
|
240
|
+
* File mode (permissions) to set.
|
|
241
|
+
* Uses standard Unix permission bits (e.g., 0o644).
|
|
242
|
+
* @default 0o666 (read/write for all, respecting umask)
|
|
243
|
+
*/
|
|
244
|
+
mode?: number | undefined;
|
|
245
|
+
/**
|
|
246
|
+
* File system flag for write behavior.
|
|
247
|
+
* @default 'w' (create or truncate)
|
|
248
|
+
*/
|
|
249
|
+
flag?: string | undefined;
|
|
250
|
+
}
|
|
232
251
|
/**
|
|
233
252
|
* Find a file or directory by traversing up parent directories.
|
|
234
253
|
* Searches from the starting directory upward to the filesystem root.
|
|
@@ -250,7 +269,6 @@ export interface WriteJsonOptions extends WriteOptions {
|
|
|
250
269
|
* const nodeModules = await findUp('node_modules', { onlyDirectories: true })
|
|
251
270
|
* ```
|
|
252
271
|
*/
|
|
253
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
254
272
|
export declare function findUp(name: string | string[] | readonly string[], options?: FindUpOptions | undefined): Promise<string | undefined>;
|
|
255
273
|
/**
|
|
256
274
|
* Synchronously find a file or directory by traversing up parent directories.
|
|
@@ -276,8 +294,7 @@ export declare function findUp(name: string | string[] | readonly string[], opti
|
|
|
276
294
|
* const configPath = findUpSync(['.eslintrc.js', '.eslintrc.json'])
|
|
277
295
|
* ```
|
|
278
296
|
*/
|
|
279
|
-
|
|
280
|
-
export declare function findUpSync(name: string | string[] | readonly string[], options?: FindUpSyncOptions | undefined): string;
|
|
297
|
+
export declare function findUpSync(name: string | string[] | readonly string[], options?: FindUpSyncOptions | undefined): string | undefined;
|
|
281
298
|
/**
|
|
282
299
|
* Invalidate the cached allowed directories.
|
|
283
300
|
* Called automatically by the paths/rewire module when paths are overridden in tests.
|
|
@@ -305,24 +322,7 @@ export declare function invalidatePathCache(): void;
|
|
|
305
322
|
* }
|
|
306
323
|
* ```
|
|
307
324
|
*/
|
|
308
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
309
325
|
export declare function isDir(filepath: PathLike): Promise<boolean>;
|
|
310
|
-
/**
|
|
311
|
-
* Check if a path is a directory synchronously.
|
|
312
|
-
* Returns `true` for directories, `false` for files or non-existent paths.
|
|
313
|
-
*
|
|
314
|
-
* @param filepath - Path to check
|
|
315
|
-
* @returns `true` if path is a directory, `false` otherwise
|
|
316
|
-
*
|
|
317
|
-
* @example
|
|
318
|
-
* ```ts
|
|
319
|
-
* if (isDirSync('./src')) {
|
|
320
|
-
* console.log('src is a directory')
|
|
321
|
-
* }
|
|
322
|
-
* ```
|
|
323
|
-
*/
|
|
324
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
325
|
-
export declare function isDirSync(filepath: PathLike): boolean;
|
|
326
326
|
/**
|
|
327
327
|
* Check if a directory is empty synchronously.
|
|
328
328
|
* A directory is considered empty if it contains no files after applying ignore patterns.
|
|
@@ -341,8 +341,22 @@ export declare function isDirSync(filepath: PathLike): boolean;
|
|
|
341
341
|
* isDirEmptySync('./cache', { ignore: ['.DS_Store'] })
|
|
342
342
|
* ```
|
|
343
343
|
*/
|
|
344
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
345
344
|
export declare function isDirEmptySync(dirname: PathLike, options?: IsDirEmptyOptions | undefined): boolean;
|
|
345
|
+
/**
|
|
346
|
+
* Check if a path is a directory synchronously.
|
|
347
|
+
* Returns `true` for directories, `false` for files or non-existent paths.
|
|
348
|
+
*
|
|
349
|
+
* @param filepath - Path to check
|
|
350
|
+
* @returns `true` if path is a directory, `false` otherwise
|
|
351
|
+
*
|
|
352
|
+
* @example
|
|
353
|
+
* ```ts
|
|
354
|
+
* if (isDirSync('./src')) {
|
|
355
|
+
* console.log('src is a directory')
|
|
356
|
+
* }
|
|
357
|
+
* ```
|
|
358
|
+
*/
|
|
359
|
+
export declare function isDirSync(filepath: PathLike): boolean;
|
|
346
360
|
/**
|
|
347
361
|
* Check if a path is a symbolic link synchronously.
|
|
348
362
|
* Uses `lstat` to check the link itself, not the target.
|
|
@@ -357,7 +371,6 @@ export declare function isDirEmptySync(dirname: PathLike, options?: IsDirEmptyOp
|
|
|
357
371
|
* }
|
|
358
372
|
* ```
|
|
359
373
|
*/
|
|
360
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
361
374
|
export declare function isSymLinkSync(filepath: PathLike): boolean;
|
|
362
375
|
/**
|
|
363
376
|
* Normalize encoding string to canonical form.
|
|
@@ -377,7 +390,6 @@ export declare function isSymLinkSync(filepath: PathLike): boolean;
|
|
|
377
390
|
* normalizeEncoding(null) // Returns 'utf8'
|
|
378
391
|
* ```
|
|
379
392
|
*/
|
|
380
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
381
393
|
export declare function normalizeEncoding(enc: BufferEncoding | string | null | undefined): BufferEncoding;
|
|
382
394
|
/**
|
|
383
395
|
* Move the "slow cases" to a separate function to make sure this function gets
|
|
@@ -396,7 +408,6 @@ export declare function normalizeEncoding(enc: BufferEncoding | string | null |
|
|
|
396
408
|
* normalizeEncodingSlow('binary') // 'latin1'
|
|
397
409
|
* ```
|
|
398
410
|
*/
|
|
399
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
400
411
|
export declare function normalizeEncodingSlow(enc: string): BufferEncoding;
|
|
401
412
|
/**
|
|
402
413
|
* Read directory names asynchronously with filtering and sorting.
|
|
@@ -419,7 +430,6 @@ export declare function normalizeEncodingSlow(enc: string): BufferEncoding;
|
|
|
419
430
|
* const unsorted = await readDirNames('./src', { sort: false })
|
|
420
431
|
* ```
|
|
421
432
|
*/
|
|
422
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
423
433
|
export declare function readDirNames(dirname: PathLike, options?: ReadDirOptions | undefined): Promise<string[]>;
|
|
424
434
|
/**
|
|
425
435
|
* Read directory names synchronously with filtering and sorting.
|
|
@@ -442,7 +452,6 @@ export declare function readDirNames(dirname: PathLike, options?: ReadDirOptions
|
|
|
442
452
|
* })
|
|
443
453
|
* ```
|
|
444
454
|
*/
|
|
445
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
446
455
|
export declare function readDirNamesSync(dirname: PathLike, options?: ReadDirOptions): string[];
|
|
447
456
|
/**
|
|
448
457
|
* Read a file as binary data asynchronously.
|
|
@@ -462,28 +471,7 @@ export declare function readDirNamesSync(dirname: PathLike, options?: ReadDirOpt
|
|
|
462
471
|
* const buffer = await readFileBinary('./data.bin', { signal: abortSignal })
|
|
463
472
|
* ```
|
|
464
473
|
*/
|
|
465
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
466
474
|
export declare function readFileBinary(filepath: PathLike, options?: ReadFileOptions | undefined): Promise<NonSharedBuffer>;
|
|
467
|
-
/**
|
|
468
|
-
* Read a file as UTF-8 text asynchronously.
|
|
469
|
-
* Returns a string with the file contents decoded as UTF-8.
|
|
470
|
-
* This is the most common way to read text files.
|
|
471
|
-
*
|
|
472
|
-
* @param filepath - Path to file
|
|
473
|
-
* @param options - Read options including encoding and abort signal
|
|
474
|
-
* @returns Promise resolving to string containing file contents
|
|
475
|
-
*
|
|
476
|
-
* @example
|
|
477
|
-
* ```ts
|
|
478
|
-
* // Read a text file
|
|
479
|
-
* const content = await readFileUtf8('./README.md')
|
|
480
|
-
*
|
|
481
|
-
* // Read with custom encoding
|
|
482
|
-
* const content = await readFileUtf8('./data.txt', { encoding: 'utf-8' })
|
|
483
|
-
* ```
|
|
484
|
-
*/
|
|
485
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
486
|
-
export declare function readFileUtf8(filepath: PathLike, options?: ReadFileOptions | undefined): Promise<string>;
|
|
487
475
|
/**
|
|
488
476
|
* Read a file as binary data synchronously.
|
|
489
477
|
* Returns a Buffer without encoding the contents.
|
|
@@ -502,8 +490,26 @@ export declare function readFileUtf8(filepath: PathLike, options?: ReadFileOptio
|
|
|
502
490
|
* const gzipData = readFileBinarySync('./archive.gz')
|
|
503
491
|
* ```
|
|
504
492
|
*/
|
|
505
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
506
493
|
export declare function readFileBinarySync(filepath: PathLike, options?: ReadFileOptions | undefined): string | NonSharedBuffer;
|
|
494
|
+
/**
|
|
495
|
+
* Read a file as UTF-8 text asynchronously.
|
|
496
|
+
* Returns a string with the file contents decoded as UTF-8.
|
|
497
|
+
* This is the most common way to read text files.
|
|
498
|
+
*
|
|
499
|
+
* @param filepath - Path to file
|
|
500
|
+
* @param options - Read options including encoding and abort signal
|
|
501
|
+
* @returns Promise resolving to string containing file contents
|
|
502
|
+
*
|
|
503
|
+
* @example
|
|
504
|
+
* ```ts
|
|
505
|
+
* // Read a text file
|
|
506
|
+
* const content = await readFileUtf8('./README.md')
|
|
507
|
+
*
|
|
508
|
+
* // Read with custom encoding
|
|
509
|
+
* const content = await readFileUtf8('./data.txt', { encoding: 'utf-8' })
|
|
510
|
+
* ```
|
|
511
|
+
*/
|
|
512
|
+
export declare function readFileUtf8(filepath: PathLike, options?: ReadFileOptions | undefined): Promise<string>;
|
|
507
513
|
/**
|
|
508
514
|
* Read a file as UTF-8 text synchronously.
|
|
509
515
|
* Returns a string with the file contents decoded as UTF-8.
|
|
@@ -522,7 +528,6 @@ export declare function readFileBinarySync(filepath: PathLike, options?: ReadFil
|
|
|
522
528
|
* const data = readFileUtf8Sync('./data.txt', { encoding: 'utf8' })
|
|
523
529
|
* ```
|
|
524
530
|
*/
|
|
525
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
526
531
|
export declare function readFileUtf8Sync(filepath: PathLike, options?: ReadFileOptions | undefined): string | NonSharedBuffer;
|
|
527
532
|
/**
|
|
528
533
|
* Read and parse a JSON file asynchronously.
|
|
@@ -553,8 +558,7 @@ export declare function readFileUtf8Sync(filepath: PathLike, options?: ReadFileO
|
|
|
553
558
|
* }
|
|
554
559
|
* ```
|
|
555
560
|
*/
|
|
556
|
-
|
|
557
|
-
export declare function readJson(filepath: PathLike, options?: ReadJsonOptions | string | undefined): Promise<import("./json/types").JsonValue>;
|
|
561
|
+
export declare function readJson(filepath: PathLike, options?: ReadJsonOptions | string | undefined): Promise<import("./json/types").JsonValue | undefined>;
|
|
558
562
|
/**
|
|
559
563
|
* Read and parse a JSON file synchronously.
|
|
560
564
|
* Reads the file as UTF-8 text and parses it as JSON.
|
|
@@ -583,8 +587,7 @@ export declare function readJson(filepath: PathLike, options?: ReadJsonOptions |
|
|
|
583
587
|
* const config = readJsonSync('./config.json', { throws: false })
|
|
584
588
|
* ```
|
|
585
589
|
*/
|
|
586
|
-
|
|
587
|
-
export declare function readJsonSync(filepath: PathLike, options?: ReadJsonOptions | string | undefined): import("./json/types").JsonValue;
|
|
590
|
+
export declare function readJsonSync(filepath: PathLike, options?: ReadJsonOptions | string | undefined): import("./json/types").JsonValue | undefined;
|
|
588
591
|
/**
|
|
589
592
|
* Safely delete a file or directory asynchronously with built-in protections.
|
|
590
593
|
*
|
|
@@ -733,11 +736,9 @@ export declare function safeMkdirSync(path: PathLike, options?: MakeDirectoryOpt
|
|
|
733
736
|
* const buffer = await safeReadFile('./binary.dat', { encoding: null })
|
|
734
737
|
* ```
|
|
735
738
|
*/
|
|
736
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
737
739
|
export declare function safeReadFile(filepath: PathLike, options: SafeReadOptions & {
|
|
738
740
|
encoding: null;
|
|
739
741
|
}): Promise<Buffer | undefined>;
|
|
740
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
741
742
|
export declare function safeReadFile(filepath: PathLike, options?: SafeReadOptions | undefined): Promise<string | undefined>;
|
|
742
743
|
/**
|
|
743
744
|
* Safely read a file synchronously, returning undefined on error.
|
|
@@ -764,11 +765,9 @@ export declare function safeReadFile(filepath: PathLike, options?: SafeReadOptio
|
|
|
764
765
|
* const buffer = safeReadFileSync('./image.png', { encoding: null })
|
|
765
766
|
* ```
|
|
766
767
|
*/
|
|
767
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
768
768
|
export declare function safeReadFileSync(filepath: PathLike, options: SafeReadOptions & {
|
|
769
769
|
encoding: null;
|
|
770
770
|
}): Buffer | undefined;
|
|
771
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
772
771
|
export declare function safeReadFileSync(filepath: PathLike, options?: SafeReadOptions | undefined): string | undefined;
|
|
773
772
|
/**
|
|
774
773
|
* Safely get file stats asynchronously, returning undefined on error.
|
|
@@ -788,15 +787,13 @@ export declare function safeReadFileSync(filepath: PathLike, options?: SafeReadO
|
|
|
788
787
|
* }
|
|
789
788
|
* ```
|
|
790
789
|
*/
|
|
791
|
-
|
|
792
|
-
export declare function safeStats(filepath: PathLike): Promise<import("fs").Stats>;
|
|
790
|
+
export declare function safeStats(filepath: PathLike): Promise<import("fs").Stats | undefined>;
|
|
793
791
|
/**
|
|
794
792
|
* Safely get file stats synchronously, returning undefined on error.
|
|
795
793
|
* Useful for checking file existence and properties without error handling.
|
|
796
794
|
* Returns undefined for any error (file not found, permission denied, etc.).
|
|
797
795
|
*
|
|
798
796
|
* @param filepath - Path to check
|
|
799
|
-
* @param options - Read options (currently unused but kept for API consistency)
|
|
800
797
|
* @returns Stats object, or undefined on error
|
|
801
798
|
*
|
|
802
799
|
* @example
|
|
@@ -809,8 +806,7 @@ export declare function safeStats(filepath: PathLike): Promise<import("fs").Stat
|
|
|
809
806
|
* }
|
|
810
807
|
* ```
|
|
811
808
|
*/
|
|
812
|
-
|
|
813
|
-
export declare function safeStatsSync(filepath: PathLike, options?: ReadFileOptions | undefined): import("fs").BigIntStats | import("fs").Stats;
|
|
809
|
+
export declare function safeStatsSync(filepath: PathLike): import("fs").BigIntStats | import("fs").Stats | undefined;
|
|
814
810
|
/**
|
|
815
811
|
* Generate a unique filepath by adding number suffix if the path exists.
|
|
816
812
|
* Appends `-1`, `-2`, etc. before the file extension until a non-existent path is found.
|
|
@@ -831,23 +827,7 @@ export declare function safeStatsSync(filepath: PathLike, options?: ReadFileOpti
|
|
|
831
827
|
* const backupPath = uniqueSync('./backup')
|
|
832
828
|
* ```
|
|
833
829
|
*/
|
|
834
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
835
830
|
export declare function uniqueSync(filepath: PathLike): string;
|
|
836
|
-
/**
|
|
837
|
-
* Result of file readability validation.
|
|
838
|
-
* Contains lists of valid and invalid file paths.
|
|
839
|
-
*/
|
|
840
|
-
export interface ValidateFilesResult {
|
|
841
|
-
/**
|
|
842
|
-
* File paths that passed validation and are readable.
|
|
843
|
-
*/
|
|
844
|
-
validPaths: string[];
|
|
845
|
-
/**
|
|
846
|
-
* File paths that failed validation (unreadable, permission denied, or non-existent).
|
|
847
|
-
* Common with Yarn Berry PnP virtual filesystem, pnpm symlinks, or filesystem race conditions.
|
|
848
|
-
*/
|
|
849
|
-
invalidPaths: string[];
|
|
850
|
-
}
|
|
851
831
|
/**
|
|
852
832
|
* Validate that file paths are readable before processing.
|
|
853
833
|
* Filters out files from glob results that cannot be accessed (common with
|
|
@@ -879,7 +859,6 @@ export interface ValidateFilesResult {
|
|
|
879
859
|
* await sdk.uploadManifestFiles(orgSlug, validPaths)
|
|
880
860
|
* ```
|
|
881
861
|
*/
|
|
882
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
883
862
|
export declare function validateFiles(filepaths: string[] | readonly string[]): ValidateFilesResult;
|
|
884
863
|
/**
|
|
885
864
|
* Write JSON content to a file asynchronously with formatting.
|
package/dist/fs.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/* Socket Lib - Built with esbuild */
|
|
3
|
+
"use strict";
|
|
3
4
|
var __create = Object.create;
|
|
4
5
|
var __defProp = Object.defineProperty;
|
|
5
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -61,25 +62,18 @@ __export(fs_exports, {
|
|
|
61
62
|
});
|
|
62
63
|
module.exports = __toCommonJS(fs_exports);
|
|
63
64
|
var import_node_process = __toESM(require("node:process"));
|
|
64
|
-
var import_process = require("./constants/process");
|
|
65
65
|
var import_arrays = require("./arrays");
|
|
66
|
-
var
|
|
66
|
+
var import_process = require("./constants/process");
|
|
67
67
|
var import_globs = require("./globs");
|
|
68
68
|
var import_parse = require("./json/parse");
|
|
69
69
|
var import_objects = require("./objects");
|
|
70
70
|
var import_normalize = require("./paths/normalize");
|
|
71
71
|
var import_rewire = require("./paths/rewire");
|
|
72
72
|
var import_socket = require("./paths/socket");
|
|
73
|
+
var import_promises = require("./promises");
|
|
73
74
|
var import_sorts = require("./sorts");
|
|
74
|
-
let _del;
|
|
75
|
-
// @__NO_SIDE_EFFECTS__
|
|
76
|
-
function getDel() {
|
|
77
|
-
if (_del === void 0) {
|
|
78
|
-
_del = require("./external/del");
|
|
79
|
-
}
|
|
80
|
-
return _del;
|
|
81
|
-
}
|
|
82
75
|
const abortSignal = (0, import_process.getAbortSignal)();
|
|
76
|
+
const NEWLINE_REGEX = /\n/g;
|
|
83
77
|
const defaultRemoveOptions = (0, import_objects.objectFreeze)({
|
|
84
78
|
__proto__: null,
|
|
85
79
|
force: true,
|
|
@@ -87,7 +81,11 @@ const defaultRemoveOptions = (0, import_objects.objectFreeze)({
|
|
|
87
81
|
recursive: true,
|
|
88
82
|
retryDelay: 200
|
|
89
83
|
});
|
|
84
|
+
let _del;
|
|
90
85
|
let _cachedAllowedDirs;
|
|
86
|
+
let _buffer;
|
|
87
|
+
let _fs;
|
|
88
|
+
let _path;
|
|
91
89
|
function getAllowedDirectories() {
|
|
92
90
|
if (_cachedAllowedDirs === void 0) {
|
|
93
91
|
const path = /* @__PURE__ */ getPath();
|
|
@@ -99,27 +97,31 @@ function getAllowedDirectories() {
|
|
|
99
97
|
}
|
|
100
98
|
return _cachedAllowedDirs;
|
|
101
99
|
}
|
|
102
|
-
let _buffer;
|
|
103
100
|
// @__NO_SIDE_EFFECTS__
|
|
104
101
|
function getBuffer() {
|
|
105
102
|
if (_buffer === void 0) {
|
|
106
|
-
_buffer = require("buffer");
|
|
103
|
+
_buffer = require("node:buffer");
|
|
107
104
|
}
|
|
108
105
|
return _buffer;
|
|
109
106
|
}
|
|
110
|
-
|
|
107
|
+
// @__NO_SIDE_EFFECTS__
|
|
108
|
+
function getDel() {
|
|
109
|
+
if (_del === void 0) {
|
|
110
|
+
_del = require("./external/del");
|
|
111
|
+
}
|
|
112
|
+
return _del;
|
|
113
|
+
}
|
|
111
114
|
// @__NO_SIDE_EFFECTS__
|
|
112
115
|
function getFs() {
|
|
113
116
|
if (_fs === void 0) {
|
|
114
|
-
_fs = require("fs");
|
|
117
|
+
_fs = require("node:fs");
|
|
115
118
|
}
|
|
116
119
|
return _fs;
|
|
117
120
|
}
|
|
118
|
-
let _path;
|
|
119
121
|
// @__NO_SIDE_EFFECTS__
|
|
120
122
|
function getPath() {
|
|
121
123
|
if (_path === void 0) {
|
|
122
|
-
_path = require("path");
|
|
124
|
+
_path = require("node:path");
|
|
123
125
|
}
|
|
124
126
|
return _path;
|
|
125
127
|
}
|
|
@@ -142,7 +144,7 @@ function innerReadDirNames(dirents, dirname, options) {
|
|
|
142
144
|
function stringify(json, EOL, finalEOL, replacer, spaces = 2) {
|
|
143
145
|
const EOF = finalEOL ? EOL : "";
|
|
144
146
|
const str = JSON.stringify(json, replacer, spaces);
|
|
145
|
-
return `${str.replace(
|
|
147
|
+
return `${str.replace(NEWLINE_REGEX, EOL)}${EOF}`;
|
|
146
148
|
}
|
|
147
149
|
// @__NO_SIDE_EFFECTS__
|
|
148
150
|
async function findUp(name, options) {
|
|
@@ -245,16 +247,11 @@ function findUpSync(name, options) {
|
|
|
245
247
|
function invalidatePathCache() {
|
|
246
248
|
_cachedAllowedDirs = void 0;
|
|
247
249
|
}
|
|
248
|
-
(0, import_rewire.registerCacheInvalidation)(invalidatePathCache);
|
|
249
250
|
// @__NO_SIDE_EFFECTS__
|
|
250
251
|
async function isDir(filepath) {
|
|
251
252
|
return !!(await /* @__PURE__ */ safeStats(filepath))?.isDirectory();
|
|
252
253
|
}
|
|
253
254
|
// @__NO_SIDE_EFFECTS__
|
|
254
|
-
function isDirSync(filepath) {
|
|
255
|
-
return !!(/* @__PURE__ */ safeStatsSync(filepath))?.isDirectory();
|
|
256
|
-
}
|
|
257
|
-
// @__NO_SIDE_EFFECTS__
|
|
258
255
|
function isDirEmptySync(dirname, options) {
|
|
259
256
|
const { ignore = import_globs.defaultIgnore } = {
|
|
260
257
|
__proto__: null,
|
|
@@ -286,6 +283,10 @@ function isDirEmptySync(dirname, options) {
|
|
|
286
283
|
}
|
|
287
284
|
}
|
|
288
285
|
// @__NO_SIDE_EFFECTS__
|
|
286
|
+
function isDirSync(filepath) {
|
|
287
|
+
return !!(/* @__PURE__ */ safeStatsSync(filepath))?.isDirectory();
|
|
288
|
+
}
|
|
289
|
+
// @__NO_SIDE_EFFECTS__
|
|
289
290
|
function isSymLinkSync(filepath) {
|
|
290
291
|
const fs = /* @__PURE__ */ getFs();
|
|
291
292
|
try {
|
|
@@ -410,22 +411,22 @@ async function readFileBinary(filepath, options) {
|
|
|
410
411
|
});
|
|
411
412
|
}
|
|
412
413
|
// @__NO_SIDE_EFFECTS__
|
|
413
|
-
|
|
414
|
+
function readFileBinarySync(filepath, options) {
|
|
414
415
|
const opts = typeof options === "string" ? { encoding: options } : options;
|
|
415
416
|
const fs = /* @__PURE__ */ getFs();
|
|
416
|
-
return
|
|
417
|
-
signal: abortSignal,
|
|
417
|
+
return fs.readFileSync(filepath, {
|
|
418
418
|
...opts,
|
|
419
|
-
encoding:
|
|
419
|
+
encoding: null
|
|
420
420
|
});
|
|
421
421
|
}
|
|
422
422
|
// @__NO_SIDE_EFFECTS__
|
|
423
|
-
function
|
|
423
|
+
async function readFileUtf8(filepath, options) {
|
|
424
424
|
const opts = typeof options === "string" ? { encoding: options } : options;
|
|
425
425
|
const fs = /* @__PURE__ */ getFs();
|
|
426
|
-
return fs.
|
|
426
|
+
return await fs.promises.readFile(filepath, {
|
|
427
|
+
signal: abortSignal,
|
|
427
428
|
...opts,
|
|
428
|
-
encoding:
|
|
429
|
+
encoding: "utf8"
|
|
429
430
|
});
|
|
430
431
|
}
|
|
431
432
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -620,7 +621,7 @@ async function safeMkdir(path, options) {
|
|
|
620
621
|
try {
|
|
621
622
|
await fs.promises.mkdir(path, opts);
|
|
622
623
|
} catch (e) {
|
|
623
|
-
if (typeof e
|
|
624
|
+
if (typeof e !== "object" || e === null || !("code" in e) || e.code !== "EEXIST") {
|
|
624
625
|
throw e;
|
|
625
626
|
}
|
|
626
627
|
}
|
|
@@ -631,7 +632,7 @@ function safeMkdirSync(path, options) {
|
|
|
631
632
|
try {
|
|
632
633
|
fs.mkdirSync(path, opts);
|
|
633
634
|
} catch (e) {
|
|
634
|
-
if (typeof e
|
|
635
|
+
if (typeof e !== "object" || e === null || !("code" in e) || e.code !== "EEXIST") {
|
|
635
636
|
throw e;
|
|
636
637
|
}
|
|
637
638
|
}
|
|
@@ -697,14 +698,12 @@ async function safeStats(filepath) {
|
|
|
697
698
|
return void 0;
|
|
698
699
|
}
|
|
699
700
|
// @__NO_SIDE_EFFECTS__
|
|
700
|
-
function safeStatsSync(filepath
|
|
701
|
-
const opts = typeof options === "string" ? { encoding: options } : options;
|
|
701
|
+
function safeStatsSync(filepath) {
|
|
702
702
|
const fs = /* @__PURE__ */ getFs();
|
|
703
703
|
try {
|
|
704
704
|
return fs.statSync(filepath, {
|
|
705
705
|
__proto__: null,
|
|
706
|
-
throwIfNoEntry: false
|
|
707
|
-
...opts
|
|
706
|
+
throwIfNoEntry: false
|
|
708
707
|
});
|
|
709
708
|
} catch {
|
|
710
709
|
}
|
|
@@ -785,6 +784,7 @@ function writeJsonSync(filepath, jsonContent, options) {
|
|
|
785
784
|
__proto__: null
|
|
786
785
|
});
|
|
787
786
|
}
|
|
787
|
+
(0, import_rewire.registerCacheInvalidation)(invalidatePathCache);
|
|
788
788
|
// Annotate the CommonJS export names for ESM import in node:
|
|
789
789
|
0 && (module.exports = {
|
|
790
790
|
findUp,
|