@visulima/fs 4.0.3 → 4.0.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.
- package/CHANGELOG.md +35 -0
- package/LICENSE.md +4 -1
- package/dist/constants.d.ts +42 -0
- package/dist/ensure/ensure-dir-sync.d.ts +14 -0
- package/dist/ensure/ensure-dir.d.ts +14 -0
- package/dist/ensure/ensure-file-sync.d.ts +15 -0
- package/dist/ensure/ensure-file.d.ts +27 -0
- package/dist/ensure/ensure-link-sync.d.ts +16 -0
- package/dist/ensure/ensure-link.d.ts +16 -0
- package/dist/ensure/ensure-symlink-sync.d.ts +23 -0
- package/dist/ensure/ensure-symlink.d.ts +23 -0
- package/dist/ensure/utils/get-file-info-type.d.ts +7 -0
- package/dist/ensure/utils/is-stats-identical.d.ts +3 -0
- package/dist/ensure/utils/resolve-symlink-target.d.ts +2 -0
- package/dist/eol.d.ts +35 -7
- package/dist/eol.js +26 -3
- package/dist/error/already-exists-error.d.ts +39 -0
- package/dist/error/directory-error.d.ts +47 -0
- package/dist/error/json-error.d.ts +52 -0
- package/dist/error/not-empty-error.d.ts +51 -0
- package/dist/error/not-found-error.d.ts +44 -0
- package/dist/error/permission-error.d.ts +45 -0
- package/dist/error/walk-error.d.ts +51 -0
- package/dist/error.d.ts +7 -50
- package/dist/error.js +7 -1
- package/dist/find/collect-sync.d.ts +31 -0
- package/dist/find/collect.d.ts +35 -0
- package/dist/find/find-up-sync.d.ts +42 -0
- package/dist/find/find-up.d.ts +46 -0
- package/dist/find/utils/glob-to-regex.d.ts +2 -0
- package/dist/find/utils/walk-include.d.ts +2 -0
- package/dist/find/walk-sync.d.ts +26 -0
- package/dist/find/walk.d.ts +29 -0
- package/dist/index.d.ts +34 -136
- package/dist/index.js +32 -1
- package/dist/is-accessible-sync.d.ts +3 -0
- package/dist/is-accessible.d.ts +29 -0
- package/dist/move/index.d.ts +70 -0
- package/dist/move/types.d.ts +38 -0
- package/dist/move/utils/internal-move-file-sync.d.ts +3 -0
- package/dist/move/utils/internal-move-file.d.ts +3 -0
- package/dist/move/utils/validate-same-directory.d.ts +2 -0
- package/dist/packem_shared/AlreadyExistsError-D5BGeeNR.js +27 -0
- package/dist/packem_shared/DirectoryError-CaUV2Pbk.js +27 -0
- package/dist/packem_shared/F_OK-BalxCn9n.js +8 -0
- package/dist/packem_shared/JSONError-BkHRnInH.js +26 -0
- package/dist/packem_shared/NotEmptyError-mOHWXE0m.js +27 -0
- package/dist/packem_shared/NotFoundError-D4llRgRs.js +27 -0
- package/dist/packem_shared/PermissionError-1qs0skfo.js +27 -0
- package/dist/packem_shared/WalkError-DUdQd6FT.js +24 -0
- package/dist/packem_shared/assertValidFileContents-BmcLtsGd.js +7 -0
- package/dist/packem_shared/assertValidFileOrDirectoryPath-8HANmVjk.js +7 -0
- package/dist/packem_shared/collect-DcBwsYYd.js +14 -0
- package/dist/packem_shared/collectSync-Bkjf9Dbm.js +14 -0
- package/dist/packem_shared/emptyDir-CYB5Tict.js +43 -0
- package/dist/packem_shared/emptyDirSync-BD8-1Ytl.js +41 -0
- package/dist/packem_shared/ensureDir-C_kuQ5Ik.js +53 -0
- package/dist/packem_shared/ensureDirSync-CI5g-uBI.js +53 -0
- package/dist/packem_shared/ensureFile-BUtXGlGT.js +47 -0
- package/dist/packem_shared/ensureFileSync-C8hASR-1.js +47 -0
- package/dist/packem_shared/ensureLink-BPnAG5-P.js +54 -0
- package/dist/packem_shared/ensureLinkSync-B-Z7X0ub.js +54 -0
- package/dist/packem_shared/ensureSymlink-BGz6W-Wa.js +73 -0
- package/dist/packem_shared/ensureSymlinkSync-C5Gk8QYi.js +74 -0
- package/dist/packem_shared/findUp-Lv9mZCIQ.js +85 -0
- package/dist/packem_shared/findUpSync-BsK4Nrrq.js +85 -0
- package/dist/packem_shared/get-file-info-type-FD4-jsyg.js +14 -0
- package/dist/packem_shared/index-CHM-in-V.js +100 -0
- package/dist/packem_shared/is-stats-identical-D8FxpvQU.js +3 -0
- package/dist/packem_shared/isAccessible-iOp0Bou6.js +38 -0
- package/dist/packem_shared/isAccessibleSync-38BmiIcx.js +38 -0
- package/dist/packem_shared/isFsCaseSensitive-D-ayleCy.js +62 -0
- package/dist/packem_shared/move-BD6JbYSu.js +134 -0
- package/dist/packem_shared/parseJson-CqUuRguZ.js +231 -0
- package/dist/packem_shared/readFile-XVOjAw8r.js +65 -0
- package/dist/packem_shared/readFileSync-B9Zg5PSF.js +53 -0
- package/dist/packem_shared/readJson-Dra2m6s-.js +22 -0
- package/dist/packem_shared/readJsonSync-B6Dl1I_6.js +22 -0
- package/dist/packem_shared/readYaml-Bu1nsexB.js +10 -0
- package/dist/packem_shared/readYamlSync-Di88aMME.js +10 -0
- package/dist/packem_shared/remove-_oDY3uKo.js +38 -0
- package/dist/packem_shared/removeSync-DETRj7Qn.js +38 -0
- package/dist/packem_shared/resolve-symlink-target-Kh4GovFf.js +16 -0
- package/dist/packem_shared/stripJsonComments-21XWVDwP.js +19 -0
- package/dist/packem_shared/to-uint-8-array-Dz2nF1y1.js +19 -0
- package/dist/packem_shared/walk-BhTbpr3y.js +115 -0
- package/dist/packem_shared/walk-include-CZco7BvN.js +16 -0
- package/dist/packem_shared/walkSync-DDBq95s8.js +114 -0
- package/dist/packem_shared/writeFile-NT1fLEEe.js +83 -0
- package/dist/packem_shared/writeFileSync-Bj5UDSf0.js +83 -0
- package/dist/packem_shared/writeJson-DQLdAi0d.js +50 -0
- package/dist/packem_shared/writeJsonSync-DvTCjVUi.js +50 -0
- package/dist/packem_shared/writeYaml-BMY0kOPf.js +24 -0
- package/dist/packem_shared/writeYamlSync-DqPu8cCd.js +24 -0
- package/dist/read/read-file-sync.d.ts +37 -0
- package/dist/read/read-file.d.ts +41 -0
- package/dist/read/read-json-sync.d.ts +5 -0
- package/dist/read/read-json.d.ts +5 -0
- package/dist/read/read-yaml-sync.d.ts +4 -0
- package/dist/read/read-yaml.d.ts +4 -0
- package/dist/remove/empty-dir-sync.d.ts +24 -0
- package/dist/remove/empty-dir.d.ts +28 -0
- package/dist/remove/remove-sync.d.ts +28 -0
- package/dist/remove/remove.d.ts +32 -0
- package/dist/size.d.ts +245 -12
- package/dist/size.js +144 -1
- package/dist/types.d.ts +299 -0
- package/dist/utils/assert-valid-file-contents.d.ts +27 -0
- package/dist/utils/assert-valid-file-or-directory-path.d.ts +26 -0
- package/dist/utils/parse-json.d.ts +5 -0
- package/dist/utils/strip-json-comments.d.ts +44 -0
- package/dist/utils.d.ts +6 -19
- package/dist/utils.js +6 -1
- package/dist/write/utils/to-uint-8-array.d.ts +2 -0
- package/dist/write/write-file-sync.d.ts +30 -0
- package/dist/write/write-file.d.ts +30 -0
- package/dist/write/write-json-sync.d.ts +30 -0
- package/dist/write/write-json.d.ts +30 -0
- package/dist/write/write-yaml-sync.d.ts +4 -0
- package/dist/write/write-yaml.d.ts +4 -0
- package/dist/yaml.d.ts +5 -17
- package/dist/yaml.js +4 -1
- package/package.json +2 -3
- package/dist/packem_shared/AlreadyExistsError-CEu6_Tjb.js +0 -1
- package/dist/packem_shared/DirectoryError-ddlbUV8C.js +0 -1
- package/dist/packem_shared/F_OK-CAwY1qU7.js +0 -1
- package/dist/packem_shared/JSONError-D7h6PNWc.js +0 -4
- package/dist/packem_shared/NotEmptyError-DMh1o7UL.js +0 -1
- package/dist/packem_shared/NotFoundError-BPiW0icm.js +0 -1
- package/dist/packem_shared/PermissionError-B1Emi5a9.js +0 -1
- package/dist/packem_shared/WalkError-BsngoIKJ.js +0 -1
- package/dist/packem_shared/assertValidFileContents-BZFnXa7K.js +0 -1
- package/dist/packem_shared/assertValidFileOrDirectoryPath-DgPIPmZT.js +0 -1
- package/dist/packem_shared/collect-DO31RsLs.js +0 -1
- package/dist/packem_shared/collectSync-Cy7ULmjZ.js +0 -1
- package/dist/packem_shared/emptyDir-zBLHyPsJ.js +0 -1
- package/dist/packem_shared/emptyDirSync-DZ8nTo6g.js +0 -1
- package/dist/packem_shared/ensureDir-CwcwvbZ0.js +0 -1
- package/dist/packem_shared/ensureDirSync-DsFhH5oQ.js +0 -1
- package/dist/packem_shared/ensureFile-DwcEQVDX.js +0 -1
- package/dist/packem_shared/ensureFileSync-KnrH51Ox.js +0 -1
- package/dist/packem_shared/ensureLink-5rjQGEBb.js +0 -1
- package/dist/packem_shared/ensureLinkSync-CYXpscf2.js +0 -1
- package/dist/packem_shared/ensureSymlink-GATTbE5c.js +0 -1
- package/dist/packem_shared/ensureSymlinkSync-CvXgTFrl.js +0 -1
- package/dist/packem_shared/findUp-Di7Az07S.js +0 -1
- package/dist/packem_shared/findUpSync-iV97v14Q.js +0 -1
- package/dist/packem_shared/get-file-info-type-CaWGXRjY.js +0 -1
- package/dist/packem_shared/index-CYIVJA0W.js +0 -1
- package/dist/packem_shared/is-stats-identical-CohsLtWy.js +0 -1
- package/dist/packem_shared/isAccessible-CDFxsAAo.js +0 -1
- package/dist/packem_shared/isAccessibleSync-5nzZWgin.js +0 -1
- package/dist/packem_shared/isFsCaseSensitive-Drl8fHLV.js +0 -1
- package/dist/packem_shared/json-error-ZPgZIXcg.d.ts +0 -11
- package/dist/packem_shared/move-Bz4gSIjp.js +0 -1
- package/dist/packem_shared/parseJson-Cj4v3qzl.js +0 -6
- package/dist/packem_shared/readFile-CbxFM_zp.js +0 -1
- package/dist/packem_shared/readFileSync-B9iv2Sb8.js +0 -1
- package/dist/packem_shared/readJson-BgC3msx-.js +0 -1
- package/dist/packem_shared/readJsonSync-DHO1vjAG.js +0 -1
- package/dist/packem_shared/readYaml-D5mtfANg.js +0 -1
- package/dist/packem_shared/readYamlSync-D0igCVDE.js +0 -1
- package/dist/packem_shared/remove-BUqZUj1W.js +0 -1
- package/dist/packem_shared/removeSync-BbT4vmDi.js +0 -1
- package/dist/packem_shared/resolve-symlink-target-BofZSDIc.js +0 -1
- package/dist/packem_shared/stripJsonComments-DbMjL4qv.js +0 -1
- package/dist/packem_shared/to-uint-8-array-DwgaTasY.js +0 -1
- package/dist/packem_shared/types-T308NKwz.d.ts +0 -90
- package/dist/packem_shared/walk-ZrZngpc4.js +0 -1
- package/dist/packem_shared/walk-include-DCiVAwMP.js +0 -1
- package/dist/packem_shared/walkSync-BQa4NKSG.js +0 -1
- package/dist/packem_shared/writeFile-D5OYEMHu.js +0 -1
- package/dist/packem_shared/writeFileSync-CO4ySqUn.js +0 -1
- package/dist/packem_shared/writeJson-DfmgiY_s.js +0 -4
- package/dist/packem_shared/writeJsonSync-Ck1pmmj_.js +0 -4
- package/dist/packem_shared/writeYaml-BJeyUpyY.js +0 -1
- package/dist/packem_shared/writeYamlSync-D87XCS7Y.js +0 -1
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import type { Dirent, PathLike } from "node:fs";
|
|
2
|
+
import type { CreateNodeOptions, DocumentOptions, ParseOptions, SchemaOptions, ToJSOptions, ToStringOptions } from "yaml";
|
|
3
|
+
import type { FIND_UP_STOP } from "./constants.d.ts";
|
|
4
|
+
type ColorizeMethod = (value: string) => string;
|
|
5
|
+
/**
|
|
6
|
+
* Options for the `walk` and `walkSync` functions.
|
|
7
|
+
*/
|
|
8
|
+
export interface WalkOptions {
|
|
9
|
+
/**
|
|
10
|
+
* List of file extensions used to filter entries.
|
|
11
|
+
* If specified, entries without the file extension specified by this option are excluded.
|
|
12
|
+
* @default {undefined}
|
|
13
|
+
*/
|
|
14
|
+
extensions?: string[];
|
|
15
|
+
/**
|
|
16
|
+
* Indicates whether symlinks should be resolved or not.
|
|
17
|
+
* @default {false}
|
|
18
|
+
*/
|
|
19
|
+
followSymlinks?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Indicates whether directory entries should be included or not.
|
|
22
|
+
* @default {true}
|
|
23
|
+
*/
|
|
24
|
+
includeDirs?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Indicates whether file entries should be included or not.
|
|
27
|
+
* @default {true}
|
|
28
|
+
*/
|
|
29
|
+
includeFiles?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Indicates whether symlink entries should be included or not.
|
|
32
|
+
* This option is meaningful only if `followSymlinks` is set to `false`.
|
|
33
|
+
* @default {true}
|
|
34
|
+
*/
|
|
35
|
+
includeSymlinks?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* List of regular expression or glob patterns used to filter entries.
|
|
38
|
+
* If specified, entries that do not match the patterns specified by this option are excluded.
|
|
39
|
+
* @default {undefined}
|
|
40
|
+
*/
|
|
41
|
+
match?: (RegExp | string)[];
|
|
42
|
+
/**
|
|
43
|
+
* The maximum depth of the file tree to be walked recursively.
|
|
44
|
+
* @default {Infinity}
|
|
45
|
+
*/
|
|
46
|
+
maxDepth?: number;
|
|
47
|
+
/**
|
|
48
|
+
* List of regular expression or glob patterns used to filter entries.
|
|
49
|
+
* If specified, entries matching the patterns specified by this option are excluded.
|
|
50
|
+
* @default {undefined}
|
|
51
|
+
*/
|
|
52
|
+
skip?: (RegExp | string)[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Represents an entry found by `walk` or `walkSync`.
|
|
56
|
+
*/
|
|
57
|
+
export interface WalkEntry extends Pick<Dirent, "isDirectory" | "isFile" | "isSymbolicLink" | "name"> {
|
|
58
|
+
/** The full path to the entry. */
|
|
59
|
+
path: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Supported file encodings for reading files.
|
|
63
|
+
*/
|
|
64
|
+
export type ReadFileEncoding = "ascii" | "base64" | "base64url" | "hex" | "latin1" | "ucs-2" | "ucs2" | "utf-8" | "utf-16le" | "utf8" | "utf16le";
|
|
65
|
+
/**
|
|
66
|
+
* Options for reading files.
|
|
67
|
+
* @template C - The type of compression used.
|
|
68
|
+
*/
|
|
69
|
+
export type ReadFileOptions<C> = {
|
|
70
|
+
/**
|
|
71
|
+
* Return content as a Buffer. Default: `false`
|
|
72
|
+
*/
|
|
73
|
+
buffer?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Compression method to decompress the file against. Default: `none`
|
|
76
|
+
*/
|
|
77
|
+
compression?: C;
|
|
78
|
+
/**
|
|
79
|
+
* The encoding to use. Default: `utf8`
|
|
80
|
+
* @see https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings
|
|
81
|
+
*/
|
|
82
|
+
encoding?: ReadFileEncoding | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* The flag used to open the file. Default: `r`
|
|
85
|
+
*/
|
|
86
|
+
flag?: number | string | undefined;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Represents the content type of a read file, which can be a Buffer or a string based on options.
|
|
90
|
+
* @template O - The ReadFileOptions type.
|
|
91
|
+
*/
|
|
92
|
+
export type ContentType<O = undefined> = O extends {
|
|
93
|
+
buffer: true;
|
|
94
|
+
} ? Buffer : string;
|
|
95
|
+
/**
|
|
96
|
+
* Type for the `reviver` parameter of `JSON.parse()`.
|
|
97
|
+
* A function that transforms the results. This function is called for each member of the object.
|
|
98
|
+
* If a member contains nested objects, the nested objects are transformed before the parent object is.
|
|
99
|
+
*/
|
|
100
|
+
export type JsonReviver = Parameters<(typeof JSON)["parse"]>["1"];
|
|
101
|
+
/**
|
|
102
|
+
* Specifies a location (line and column) in a file for code frame generation.
|
|
103
|
+
*/
|
|
104
|
+
export type CodeFrameLocation = {
|
|
105
|
+
/** The column number. */
|
|
106
|
+
column?: number;
|
|
107
|
+
/** The line number. */
|
|
108
|
+
line: number;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Options for customizing the appearance of code frames.
|
|
112
|
+
*/
|
|
113
|
+
export type CodeFrameOptions = {
|
|
114
|
+
/** Colorization methods for different parts of the code frame. */
|
|
115
|
+
color?: {
|
|
116
|
+
/** Color for the gutter (line numbers). */
|
|
117
|
+
gutter?: ColorizeMethod;
|
|
118
|
+
/** Color for the marker (pointing to the error). */
|
|
119
|
+
marker?: ColorizeMethod;
|
|
120
|
+
/** Color for the message. */
|
|
121
|
+
message?: ColorizeMethod;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Options for reading and parsing JSON files.
|
|
126
|
+
* Extends {@link CodeFrameOptions}.
|
|
127
|
+
*/
|
|
128
|
+
export type ReadJsonOptions = CodeFrameOptions & {
|
|
129
|
+
/**
|
|
130
|
+
* A function to transform the string content before parsing.
|
|
131
|
+
* @param source The raw string content of the file.
|
|
132
|
+
* @returns The transformed string content.
|
|
133
|
+
*/
|
|
134
|
+
beforeParse?: (source: string) => string;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Options for writing files.
|
|
138
|
+
*/
|
|
139
|
+
export type WriteFileOptions = {
|
|
140
|
+
/**
|
|
141
|
+
* The group and user ID used to set the file ownership. Default: `undefined`
|
|
142
|
+
*/
|
|
143
|
+
chown?: {
|
|
144
|
+
gid: number;
|
|
145
|
+
uid: number;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* The encoding to use. Default: `utf8`
|
|
149
|
+
*/
|
|
150
|
+
encoding?: BufferEncoding | null | undefined;
|
|
151
|
+
/**
|
|
152
|
+
* The flag used to write the file. Default: `w`
|
|
153
|
+
*/
|
|
154
|
+
flag?: string | undefined;
|
|
155
|
+
/**
|
|
156
|
+
* The file mode (permission and sticky bits). Default: `0o666`
|
|
157
|
+
*/
|
|
158
|
+
mode?: number;
|
|
159
|
+
/**
|
|
160
|
+
* Indicates whether the file should be overwritten if it already exists. Default: `false`
|
|
161
|
+
*/
|
|
162
|
+
overwrite?: boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Recursively create parent directories if needed. Default: `true`
|
|
165
|
+
*/
|
|
166
|
+
recursive?: boolean;
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Type for the `replacer` parameter of `JSON.stringify()`.
|
|
170
|
+
* Can be a function that alters the behavior of the stringification process,
|
|
171
|
+
* or an array of strings and numbers that acts as a whitelist for selecting
|
|
172
|
+
* the properties of the value object to be included in the JSON string.
|
|
173
|
+
* If this value is null or not provided, all properties of the object are included in the resulting JSON string.
|
|
174
|
+
*/
|
|
175
|
+
export type JsonReplacer = (number | string)[] | ((this: unknown, key: string, value: unknown) => unknown) | null;
|
|
176
|
+
/**
|
|
177
|
+
* Type for the `replacer` parameter used in YAML serialization, similar to `JSON.stringify`'s replacer.
|
|
178
|
+
*/
|
|
179
|
+
export type YamlReplacer = JsonReplacer;
|
|
180
|
+
/**
|
|
181
|
+
* Options for writing JSON files.
|
|
182
|
+
* Extends {@link WriteFileOptions}.
|
|
183
|
+
*/
|
|
184
|
+
export type WriteJsonOptions = WriteFileOptions & {
|
|
185
|
+
/**
|
|
186
|
+
* Detect indentation automatically if the file exists. Default: `false`
|
|
187
|
+
*/
|
|
188
|
+
detectIndent?: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* The space used for pretty-printing.
|
|
191
|
+
*
|
|
192
|
+
* Pass in `undefined` for no formatting.
|
|
193
|
+
*/
|
|
194
|
+
indent?: number | string | undefined;
|
|
195
|
+
/**
|
|
196
|
+
* Passed into `JSON.stringify`.
|
|
197
|
+
*/
|
|
198
|
+
replacer?: JsonReplacer;
|
|
199
|
+
/**
|
|
200
|
+
* Override the default `JSON.stringify` method.
|
|
201
|
+
*/
|
|
202
|
+
stringify?: (data: unknown, replacer: JsonReplacer, space: number | string | undefined) => string;
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* Options for the `findUp` and `findUpSync` functions.
|
|
206
|
+
*/
|
|
207
|
+
export type FindUpOptions = {
|
|
208
|
+
/**
|
|
209
|
+
* Whether to follow symbolic links.
|
|
210
|
+
* @default undefined (behaves like `true` for `findUp`, `false` for `findUpSync` due to `fs.stat` vs `fs.lstat`)
|
|
211
|
+
*/
|
|
212
|
+
allowSymlinks?: boolean;
|
|
213
|
+
/**
|
|
214
|
+
* The current working directory.
|
|
215
|
+
* @default process.cwd()
|
|
216
|
+
*/
|
|
217
|
+
cwd?: URL | string;
|
|
218
|
+
/**
|
|
219
|
+
* The directory to stop searching at.
|
|
220
|
+
* @default path.parse(cwd).root
|
|
221
|
+
*/
|
|
222
|
+
stopAt?: URL | string;
|
|
223
|
+
/**
|
|
224
|
+
* The type of path to find.
|
|
225
|
+
* @default "file"
|
|
226
|
+
*/
|
|
227
|
+
type?: "directory" | "file";
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* The result type for the name matcher function used in `findUp`.
|
|
231
|
+
* It can be a `PathLike` (string, Buffer, or URL), a Promise resolving to `PathLike` or `FIND_UP_STOP`,
|
|
232
|
+
* `FIND_UP_STOP` to stop the search, or `undefined` to continue.
|
|
233
|
+
*/
|
|
234
|
+
export type FindUpNameFnResult = PathLike | Promise<PathLike | typeof FIND_UP_STOP> | typeof FIND_UP_STOP | undefined;
|
|
235
|
+
/**
|
|
236
|
+
* Specifies the name(s) of the file or directory to search for in `findUp`.
|
|
237
|
+
* Can be a single name, an array of names, or a function that returns a name or `FIND_UP_STOP`.
|
|
238
|
+
*/
|
|
239
|
+
export type FindUpName = string[] | string | ((directory: string) => FindUpNameFnResult);
|
|
240
|
+
/**
|
|
241
|
+
* The result type for the name matcher function used in `findUpSync`.
|
|
242
|
+
* It can be a `PathLike` (string, Buffer, or URL), `FIND_UP_STOP` to stop the search,
|
|
243
|
+
* or `undefined` to continue.
|
|
244
|
+
*/
|
|
245
|
+
export type FindUpNameSyncFnResult = PathLike | typeof FIND_UP_STOP | undefined;
|
|
246
|
+
/**
|
|
247
|
+
* Specifies the name(s) of the file or directory to search for in `findUpSync`.
|
|
248
|
+
* Can be a single name, an array of names, or a function that returns a name or `FIND_UP_STOP`.
|
|
249
|
+
*/
|
|
250
|
+
export type FindUpNameSync = string[] | string | ((directory: string) => FindUpNameSyncFnResult);
|
|
251
|
+
/**
|
|
252
|
+
* Options for operations that might require retries, like `emptyDir` or `remove`.
|
|
253
|
+
*/
|
|
254
|
+
export type RetryOptions = {
|
|
255
|
+
/**
|
|
256
|
+
* If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or
|
|
257
|
+
* `EPERM` error is encountered, Node.js will retry the operation with a linear
|
|
258
|
+
* backoff wait of `retryDelay` ms longer on each try. This option represents the
|
|
259
|
+
* number of retries. This option is ignored if the `recursive` option is not
|
|
260
|
+
* `true` for operations that support it (like `rm`).
|
|
261
|
+
* @default 0
|
|
262
|
+
*/
|
|
263
|
+
maxRetries?: number | undefined;
|
|
264
|
+
/**
|
|
265
|
+
* The amount of time in milliseconds to wait between retries.
|
|
266
|
+
* This option is ignored if the `recursive` option is not `true` for operations that support it.
|
|
267
|
+
* @default 100
|
|
268
|
+
*/
|
|
269
|
+
retryDelay?: number | undefined;
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* Options for reading YAML files.
|
|
273
|
+
* Combines options from `yaml` library (DocumentOptions, ParseOptions, SchemaOptions, ToJSOptions)
|
|
274
|
+
* and custom {@link ReadFileOptions}.
|
|
275
|
+
* @template C - The type of compression used.
|
|
276
|
+
*/
|
|
277
|
+
export type ReadYamlOptions<C> = DocumentOptions & ParseOptions & ReadFileOptions<C> & SchemaOptions & ToJSOptions;
|
|
278
|
+
/**
|
|
279
|
+
* Type for the `reviver` parameter used in YAML deserialization, similar to `JSON.parse`'s reviver.
|
|
280
|
+
* A function that transforms the results. This function is called for each member of the object.
|
|
281
|
+
* If a member contains nested objects, the nested objects are transformed before the parent object is.
|
|
282
|
+
*/
|
|
283
|
+
export type YamlReviver = (key: unknown, value: unknown) => unknown;
|
|
284
|
+
/**
|
|
285
|
+
* Options for writing YAML files.
|
|
286
|
+
* Extends {@link WriteFileOptions} and includes options from the `yaml` library for stringification.
|
|
287
|
+
*/
|
|
288
|
+
export type WriteYamlOptions = CreateNodeOptions & DocumentOptions & ParseOptions & SchemaOptions & ToStringOptions & WriteFileOptions & {
|
|
289
|
+
/**
|
|
290
|
+
* Passed into `yaml.stringify` as the replacer argument.
|
|
291
|
+
*/
|
|
292
|
+
replacer?: YamlReplacer;
|
|
293
|
+
/**
|
|
294
|
+
* Passed into `yaml.stringify` as the space argument for indentation.
|
|
295
|
+
* Can be a number of spaces or a string (e.g., a tab character).
|
|
296
|
+
*/
|
|
297
|
+
space?: number | string;
|
|
298
|
+
};
|
|
299
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Asserts that the provided contents are valid for writing to a file.
|
|
3
|
+
* Valid contents can be a string, an ArrayBuffer, or an ArrayBuffer view (e.g., Uint8Array).
|
|
4
|
+
* @param contents The file contents to validate.
|
|
5
|
+
* @throws {TypeError} If the contents are not a string, ArrayBuffer, or ArrayBuffer view.
|
|
6
|
+
* @example
|
|
7
|
+
* ```javascript
|
|
8
|
+
* import { assertValidFileContents } from "@visulima/fs"; // Assuming this util is exported
|
|
9
|
+
*
|
|
10
|
+
* try {
|
|
11
|
+
* assertValidFileContents("Hello, world!");
|
|
12
|
+
* assertValidFileContents(new Uint8Array([72, 101, 108, 108, 111])); // "Hello"
|
|
13
|
+
* assertValidFileContents(new ArrayBuffer(8));
|
|
14
|
+
* console.log("File contents are valid.");
|
|
15
|
+
* } catch (error) {
|
|
16
|
+
* console.error(error.message); // File contents must be a string, ArrayBuffer, or ArrayBuffer view.
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
19
|
+
* try {
|
|
20
|
+
* assertValidFileContents(123); // Invalid content type
|
|
21
|
+
* } catch (error) {
|
|
22
|
+
* console.error(error.message); // File contents must be a string, ArrayBuffer, or ArrayBuffer view.
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
declare const assertValidFileContents: (contents: any) => void;
|
|
27
|
+
export default assertValidFileContents;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Asserts that the provided path is a valid file or directory path.
|
|
3
|
+
* A valid path must be a non-empty string or a URL instance.
|
|
4
|
+
* @param fileOrDirectoryPath The path to validate.
|
|
5
|
+
* @throws {TypeError} If the path is not a non-empty string or a URL.
|
|
6
|
+
* @example
|
|
7
|
+
* ```javascript
|
|
8
|
+
* import { assertValidFileOrDirectoryPath } from "@visulima/fs"; // Assuming this util is exported
|
|
9
|
+
*
|
|
10
|
+
* try {
|
|
11
|
+
* assertValidFileOrDirectoryPath("/path/to/file.txt");
|
|
12
|
+
* assertValidFileOrDirectoryPath(new URL("file:///path/to/file.txt"));
|
|
13
|
+
* console.log("Path is valid.");
|
|
14
|
+
* } catch (error) {
|
|
15
|
+
* console.error(error.message); // Path must be a non-empty string or URL.
|
|
16
|
+
* }
|
|
17
|
+
*
|
|
18
|
+
* try {
|
|
19
|
+
* assertValidFileOrDirectoryPath(""); // Invalid path
|
|
20
|
+
* } catch (error) {
|
|
21
|
+
* console.error(error.message); // Path must be a non-empty string or URL.
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare const assertValidFileOrDirectoryPath: (fileOrDirectoryPath: any) => void;
|
|
26
|
+
export default assertValidFileOrDirectoryPath;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { JsonValue } from "type-fest";
|
|
2
|
+
import type { CodeFrameOptions, JsonReviver } from "../types.d.ts";
|
|
3
|
+
declare function parseJson<T = JsonValue>(string: string, filename?: string, options?: CodeFrameOptions): T;
|
|
4
|
+
declare function parseJson<T = JsonValue>(string: string, reviver: JsonReviver, fileName?: string, options?: CodeFrameOptions): T;
|
|
5
|
+
export default parseJson;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strips comments from a JSON string.
|
|
3
|
+
* Handles both single-line (//) and multi-line (/* ... *&#47;) comments.
|
|
4
|
+
* @param jsonString The JSON string possibly containing comments.
|
|
5
|
+
* @param [options] Optional configuration for stripping comments.
|
|
6
|
+
* @param [options.whitespace] If `true` (default), comments are replaced with whitespace to preserve line numbers and character positions. If `false`, comments are removed entirely.
|
|
7
|
+
* @returns The JSON string with comments stripped.
|
|
8
|
+
* @example
|
|
9
|
+
* ```javascript
|
|
10
|
+
* import { stripJsonComments } from "@visulima/fs"; // Assuming this util is exported
|
|
11
|
+
*
|
|
12
|
+
* const jsonWithComments = `{
|
|
13
|
+
* // This is a single-line comment
|
|
14
|
+
* "name": "John Doe",
|
|
15
|
+
* "age": 30, /* This is a
|
|
16
|
+
* multi-line comment */
|
|
17
|
+
* "city": "New York"
|
|
18
|
+
* }`;
|
|
19
|
+
*
|
|
20
|
+
* const stripped = stripJsonComments(jsonWithComments);
|
|
21
|
+
* console.log(stripped);
|
|
22
|
+
* // Output (with whitespace=true):
|
|
23
|
+
* // {
|
|
24
|
+
* //
|
|
25
|
+
* // "name": "John Doe",
|
|
26
|
+
* // "age": 30, /*
|
|
27
|
+
* //
|
|
28
|
+
* // "city": "New York"
|
|
29
|
+
* // }
|
|
30
|
+
*
|
|
31
|
+
* const strippedWithoutWhitespace = stripJsonComments(jsonWithComments, { whitespace: false });
|
|
32
|
+
* console.log(strippedWithoutWhitespace);
|
|
33
|
+
* // Output (with whitespace=false):
|
|
34
|
+
* // {
|
|
35
|
+
* // "name": "John Doe",
|
|
36
|
+
* // "age": 30,
|
|
37
|
+
* // "city": "New York"
|
|
38
|
+
* // }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
declare const stripJsonComments: (jsonString: string, options?: {
|
|
42
|
+
whitespace?: boolean;
|
|
43
|
+
}) => string;
|
|
44
|
+
export default stripJsonComments;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,19 +1,6 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
declare const assertValidFileContents: (contents: any) => void;
|
|
9
|
-
|
|
10
|
-
declare const assertValidFileOrDirectoryPath: (fileOrDirectoryPath: any) => void;
|
|
11
|
-
|
|
12
|
-
declare function parseJson<T = JsonValue>(string: string, filename?: string, options?: CodeFrameOptions): T;
|
|
13
|
-
declare function parseJson<T = JsonValue>(string: string, reviver: JsonReviver, fileName?: string, options?: CodeFrameOptions): T;
|
|
14
|
-
|
|
15
|
-
declare const stripJsonComments: (jsonString: string, { whitespace }?: {
|
|
16
|
-
whitespace?: boolean | undefined;
|
|
17
|
-
}) => string;
|
|
18
|
-
|
|
19
|
-
export { assertValidFileContents, assertValidFileOrDirectoryPath, parseJson, stripJsonComments };
|
|
1
|
+
export { default as JSONError } from "./error/json-error.d.ts";
|
|
2
|
+
export { default as assertValidFileContents } from "./utils/assert-valid-file-contents.d.ts";
|
|
3
|
+
export { default as assertValidFileOrDirectoryPath } from "./utils/assert-valid-file-or-directory-path.d.ts";
|
|
4
|
+
export { default as parseJson } from "./utils/parse-json.d.ts";
|
|
5
|
+
export { default as stripJsonComments } from "./utils/strip-json-comments.d.ts";
|
|
6
|
+
export { toPath } from "@visulima/path/utils";
|
package/dist/utils.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
export { default as JSONError } from './packem_shared/JSONError-BkHRnInH.js';
|
|
2
|
+
export { default as assertValidFileContents } from './packem_shared/assertValidFileContents-BmcLtsGd.js';
|
|
3
|
+
export { default as assertValidFileOrDirectoryPath } from './packem_shared/assertValidFileOrDirectoryPath-8HANmVjk.js';
|
|
4
|
+
export { default as parseJson } from './packem_shared/parseJson-CqUuRguZ.js';
|
|
5
|
+
export { default as stripJsonComments } from './packem_shared/stripJsonComments-21XWVDwP.js';
|
|
6
|
+
export { toPath } from '@visulima/path/utils';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { WriteFileOptions } from "../types.d.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Synchronously writes data to a file, replacing the file if it already exists.
|
|
4
|
+
* This function includes safeguards like writing to a temporary file first and then renaming, and handling permissions.
|
|
5
|
+
* @param path The path to the file to write. Can be a file URL or a string path.
|
|
6
|
+
* @param content The data to write. Can be a string, Buffer, ArrayBuffer, or ArrayBufferView.
|
|
7
|
+
* @param options Optional configuration for writing the file. See {@link WriteFileOptions}.
|
|
8
|
+
* @returns void
|
|
9
|
+
* @example
|
|
10
|
+
* ```javascript
|
|
11
|
+
* import { writeFileSync } from "@visulima/fs";
|
|
12
|
+
* import { join } from "node:path";
|
|
13
|
+
*
|
|
14
|
+
* const writeMyFileSync = () => {
|
|
15
|
+
* try {
|
|
16
|
+
* writeFileSync(join("/tmp", "my-new-file-sync.txt"), "Hello World Synchronously!");
|
|
17
|
+
* console.log("File written successfully (sync).");
|
|
18
|
+
*
|
|
19
|
+
* writeFileSync(join("/tmp", "another-file-sync.txt"), "Some other sync content", { encoding: 'utf16le', mode: 0o600 });
|
|
20
|
+
* console.log("Another file written with specific options (sync).");
|
|
21
|
+
* } catch (error) {
|
|
22
|
+
* console.error("Failed to write file (sync):", error);
|
|
23
|
+
* }
|
|
24
|
+
* };
|
|
25
|
+
*
|
|
26
|
+
* writeMyFileSync();
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare const writeFileSync: (path: URL | string, content: ArrayBuffer | ArrayBufferView | string, options?: WriteFileOptions) => void;
|
|
30
|
+
export default writeFileSync;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { WriteFileOptions } from "../types.d.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Asynchronously writes data to a file, replacing the file if it already exists.
|
|
4
|
+
* This function includes safeguards like writing to a temporary file first and then renaming, and handling permissions.
|
|
5
|
+
* @param path The path to the file to write. Can be a file URL or a string path.
|
|
6
|
+
* @param content The data to write. Can be a string, Buffer, ArrayBuffer, or ArrayBufferView.
|
|
7
|
+
* @param options Optional configuration for writing the file. See {@link WriteFileOptions}.
|
|
8
|
+
* @returns A promise that resolves when the file has been written.
|
|
9
|
+
* @example
|
|
10
|
+
* ```javascript
|
|
11
|
+
* import { writeFile } from "@visulima/fs";
|
|
12
|
+
* import { join } from "node:path";
|
|
13
|
+
*
|
|
14
|
+
* const writeMyFile = async () => {
|
|
15
|
+
* try {
|
|
16
|
+
* await writeFile(join("/tmp", "my-new-file.txt"), "Hello World!");
|
|
17
|
+
* console.log("File written successfully.");
|
|
18
|
+
*
|
|
19
|
+
* await writeFile(join("/tmp", "another-file.txt"), "Some other content", { encoding: 'utf16le', mode: 0o600 });
|
|
20
|
+
* console.log("Another file written with specific options.");
|
|
21
|
+
* } catch (error) {
|
|
22
|
+
* console.error("Failed to write file:", error);
|
|
23
|
+
* }
|
|
24
|
+
* };
|
|
25
|
+
*
|
|
26
|
+
* writeMyFile();
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare const writeFile: (path: URL | string, content: ArrayBuffer | ArrayBufferView | string, options?: WriteFileOptions) => Promise<void>;
|
|
30
|
+
export default writeFile;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { WriteJsonOptions } from "../types.d.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Synchronously writes an object to a JSON file.
|
|
4
|
+
* Handles indentation detection, custom stringifiers, and gracefully manages existing files.
|
|
5
|
+
* @param path The path to the JSON file to write. Can be a file URL or a string path.
|
|
6
|
+
* @param data The data to serialize and write. Can be any JavaScript value that can be stringified by `JSON.stringify` or a custom stringifier.
|
|
7
|
+
* @param options Optional configuration for writing the JSON file. See {@link WriteJsonOptions}.
|
|
8
|
+
* @returns void
|
|
9
|
+
* @example
|
|
10
|
+
* ```javascript
|
|
11
|
+
* import { writeJsonSync } from "@visulima/fs";
|
|
12
|
+
* import { join } from "node:path";
|
|
13
|
+
*
|
|
14
|
+
* const writeMyJsonSync = () => {
|
|
15
|
+
* try {
|
|
16
|
+
* writeJsonSync(join("/tmp", "my-config-sync.json"), { setting: "enabled", value: 456 });
|
|
17
|
+
* console.log("JSON file written successfully (sync).");
|
|
18
|
+
*
|
|
19
|
+
* writeJsonSync(join("/tmp", "another-config-sync.json"), { user: "testSync", id: "def" }, { indent: 4, replacer: ["id"] });
|
|
20
|
+
* console.log("Another JSON file written with specific options (sync, indent 4, only 'id' key).");
|
|
21
|
+
* } catch (error) {
|
|
22
|
+
* console.error("Failed to write JSON file (sync):", error);
|
|
23
|
+
* }
|
|
24
|
+
* };
|
|
25
|
+
*
|
|
26
|
+
* writeMyJsonSync();
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare const writeJsonSync: (path: URL | string, data: unknown, options?: WriteJsonOptions) => void;
|
|
30
|
+
export default writeJsonSync;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { WriteJsonOptions } from "../types.d.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Asynchronously writes an object to a JSON file.
|
|
4
|
+
* Handles indentation detection, custom stringifiers, and gracefully manages existing files.
|
|
5
|
+
* @param path The path to the JSON file to write. Can be a file URL or a string path.
|
|
6
|
+
* @param data The data to serialize and write. Can be any JavaScript value that can be stringified by `JSON.stringify` or a custom stringifier.
|
|
7
|
+
* @param options Optional configuration for writing the JSON file. See {@link WriteJsonOptions}.
|
|
8
|
+
* @returns A promise that resolves when the JSON file has been written.
|
|
9
|
+
* @example
|
|
10
|
+
* ```javascript
|
|
11
|
+
* import { writeJson } from "@visulima/fs";
|
|
12
|
+
* import { join } from "node:path";
|
|
13
|
+
*
|
|
14
|
+
* const writeMyJson = async () => {
|
|
15
|
+
* try {
|
|
16
|
+
* await writeJson(join("/tmp", "my-config.json"), { setting: "enabled", value: 123 });
|
|
17
|
+
* console.log("JSON file written successfully.");
|
|
18
|
+
*
|
|
19
|
+
* await writeJson(join("/tmp", "another-config.json"), { user: "test", id: "abc" }, { indent: 2, replacer: ["user"] });
|
|
20
|
+
* console.log("Another JSON file written with specific options (indent 2, only 'user' key).");
|
|
21
|
+
* } catch (error) {
|
|
22
|
+
* console.error("Failed to write JSON file:", error);
|
|
23
|
+
* }
|
|
24
|
+
* };
|
|
25
|
+
*
|
|
26
|
+
* writeMyJson();
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare const writeJson: (path: URL | string, data: unknown, options?: WriteJsonOptions) => Promise<void>;
|
|
30
|
+
export default writeJson;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WriteYamlOptions, YamlReplacer } from "../types.d.ts";
|
|
2
|
+
declare function writeYamlSync(path: URL | string, data: any, options?: WriteYamlOptions): void;
|
|
3
|
+
declare function writeYamlSync(path: URL | string, data: any, replacer?: YamlReplacer, options?: WriteYamlOptions | number | string): void;
|
|
4
|
+
export default writeYamlSync;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WriteYamlOptions, YamlReplacer } from "../types.d.ts";
|
|
2
|
+
declare function writeYaml(path: URL | string, data: any, options?: WriteYamlOptions): Promise<void>;
|
|
3
|
+
declare function writeYaml(path: URL | string, data: any, replacer?: YamlReplacer, options?: WriteYamlOptions | number | string): Promise<void>;
|
|
4
|
+
export default writeYaml;
|
package/dist/yaml.d.ts
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
declare function readYaml<R = Record<string, unknown>>(path: URL | string, reviver?: YamlReviver, options?: ReadYamlOptions<"brotli" | "gzip" | "none">): Promise<R>;
|
|
7
|
-
|
|
8
|
-
declare function readYamlSync<R = Record<string, unknown>>(path: URL | string, options?: ReadYamlOptions<"brotli" | "gzip" | "none">): R;
|
|
9
|
-
declare function readYamlSync<R = Record<string, unknown>>(path: URL | string, reviver?: YamlReviver, options?: ReadYamlOptions<"brotli" | "gzip" | "none">): R;
|
|
10
|
-
|
|
11
|
-
declare function writeYaml(path: URL | string, data: any, options?: WriteYamlOptions): Promise<void>;
|
|
12
|
-
declare function writeYaml(path: URL | string, data: any, replacer?: YamlReplacer, options?: WriteYamlOptions | number | string): Promise<void>;
|
|
13
|
-
|
|
14
|
-
declare function writeYamlSync(path: URL | string, data: any, options?: WriteYamlOptions): void;
|
|
15
|
-
declare function writeYamlSync(path: URL | string, data: any, replacer?: YamlReplacer, options?: WriteYamlOptions | number | string): void;
|
|
16
|
-
|
|
17
|
-
export { YamlReplacer, readYaml, readYamlSync, writeYaml, writeYamlSync };
|
|
1
|
+
export { default as readYaml } from "./read/read-yaml.d.ts";
|
|
2
|
+
export { default as readYamlSync } from "./read/read-yaml-sync.d.ts";
|
|
3
|
+
export type { YamlReplacer } from "./types.d.ts";
|
|
4
|
+
export { default as writeYaml } from "./write/write-yaml.d.ts";
|
|
5
|
+
export { default as writeYamlSync } from "./write/write-yaml-sync.d.ts";
|
package/dist/yaml.js
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
export { default as readYaml } from './packem_shared/readYaml-Bu1nsexB.js';
|
|
2
|
+
export { default as readYamlSync } from './packem_shared/readYamlSync-Di88aMME.js';
|
|
3
|
+
export { default as writeYaml } from './packem_shared/writeYaml-BMY0kOPf.js';
|
|
4
|
+
export { default as writeYamlSync } from './packem_shared/writeYamlSync-DqPu8cCd.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/fs",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.5",
|
|
4
4
|
"description": "Human friendly file system utilities for Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -113,8 +113,7 @@
|
|
|
113
113
|
"LICENSE.md"
|
|
114
114
|
],
|
|
115
115
|
"dependencies": {
|
|
116
|
-
"@visulima/path": "2.0.
|
|
117
|
-
"type-fest": "^5.2.0"
|
|
116
|
+
"@visulima/path": "2.0.4"
|
|
118
117
|
},
|
|
119
118
|
"peerDependencies": {
|
|
120
119
|
"yaml": "^2.7.1"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var o=Object.defineProperty;var t=(e,r)=>o(e,"name",{value:r,configurable:!0});var a=Object.defineProperty,n=t((e,r)=>a(e,"name",{value:r,configurable:!0}),"t");class E extends Error{static{t(this,"n")}static{n(this,"AlreadyExistsError")}constructor(r){super(`EEXIST: ${r}`)}get code(){return"EEXIST"}set code(r){throw new Error("Cannot overwrite code EEXIST")}get name(){return"AlreadyExistsError"}set name(r){throw new Error("Cannot overwrite name of AlreadyExistsError")}}export{E as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var t=Object.defineProperty;var o=(e,r)=>t(e,"name",{value:r,configurable:!0});var n=Object.defineProperty,a=o((e,r)=>n(e,"name",{value:r,configurable:!0}),"o");class i extends Error{static{o(this,"n")}static{a(this,"DirectoryError")}constructor(r){super(`EISDIR: Illegal operation on a directory, ${r}`)}get code(){return"EISDIR"}set code(r){throw new Error("Cannot overwrite code EISDIR")}get name(){return"DirectoryError"}set name(r){throw new Error("Cannot overwrite name of DirectoryError")}}export{i as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const _=0,O=4,S=2,o=1,K=Symbol("findUpStop"),N=/"(?:[^"\\]|\\.)*"|\/\/[^\r\n]*|\/\*[\s\S]*?\*\//g;export{K as FIND_UP_STOP,_ as F_OK,N as INTERNAL_STRIP_JSON_REGEX,O as R_OK,S as W_OK,o as X_OK};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var s=Object.defineProperty;var t=(r,e)=>s(r,"name",{value:e,configurable:!0});var a=Object.defineProperty,i=t((r,e)=>a(r,"name",{value:e,configurable:!0}),"i");class m extends Error{static{t(this,"t")}static{i(this,"JSONError")}fileName;codeFrame;name="JSONError";#e;constructor(e){super(),this.#e=e}get message(){return`${this.#e}${this.fileName?` in ${this.fileName}`:""}${this.codeFrame?`
|
|
2
|
-
|
|
3
|
-
${this.codeFrame}
|
|
4
|
-
`:""}`}set message(e){this.#e=e}}export{m as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var o=Object.defineProperty;var t=(e,r)=>o(e,"name",{value:r,configurable:!0});var n=Object.defineProperty,E=t((e,r)=>n(e,"name",{value:r,configurable:!0}),"t");class c extends Error{static{t(this,"n")}static{E(this,"NotEmptyError")}constructor(r){super(`ENOTEMPTY: Directory not empty, ${r}`)}get code(){return"ENOTEMPTY"}set code(r){throw new Error("Cannot overwrite code ENOTEMPTY")}get name(){return"NotEmptyError"}set name(r){throw new Error("Cannot overwrite name of NotEmptyError")}}export{c as default};
|