@visulima/fs 5.0.9 → 5.0.11
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 +4 -0
- package/dist/eol.d.ts +25 -25
- package/dist/eol.js +2 -2
- package/dist/error.d.ts +218 -218
- package/dist/glob-parent.d.ts +27 -27
- package/dist/glob-parent.js +1 -1
- package/dist/glob.d.ts +2 -2
- package/dist/glob.js +1 -1
- package/dist/index.d.ts +765 -765
- package/dist/index.js +1 -1
- package/dist/ini.d.ts +59 -59
- package/dist/ini.js +1 -1
- package/dist/is-glob.d.ts +26 -26
- package/dist/json5.d.ts +25 -25
- package/dist/json5.js +1 -1
- package/dist/jsonc.d.ts +54 -54
- package/dist/jsonc.js +1 -1
- package/dist/match.d.ts +40 -40
- package/dist/packem_shared/{collect-CIKDOMiD.js → collect-B0S0bJoE.js} +1 -1
- package/dist/packem_shared/{collectSync-D0FRLLqg.js → collectSync-0M1eoilI.js} +1 -1
- package/dist/packem_shared/copy-DiR5_5iA.js +1 -0
- package/dist/packem_shared/copySync-DffsYlhb.js +1 -0
- package/dist/packem_shared/emptyDir-BlBeczk0.js +1 -0
- package/dist/packem_shared/emptyDirSync-DfUZ9Ejz.js +1 -0
- package/dist/packem_shared/ensureDir-BEiomfxz.js +1 -0
- package/dist/packem_shared/ensureDirSync-B0w9WMwE.js +1 -0
- package/dist/packem_shared/ensureFile-waD4hDO8.js +1 -0
- package/dist/packem_shared/ensureFileSync-CG07zjV7.js +1 -0
- package/dist/packem_shared/ensureLink-Dz-PDWa5.js +1 -0
- package/dist/packem_shared/ensureLinkSync-BZH7TaSQ.js +1 -0
- package/dist/packem_shared/ensureSymlink-Byi6ajoE.js +1 -0
- package/dist/packem_shared/ensureSymlinkSync-D7OCsAd8.js +1 -0
- package/dist/packem_shared/findUp-Ylerv_a2.js +1 -0
- package/dist/packem_shared/findUpSync-BWBPRzEq.js +1 -0
- package/dist/packem_shared/glob-BUjyjdE8.js +1 -0
- package/dist/packem_shared/glob-sync.d-DaAZHTsv.d.ts +54 -0
- package/dist/packem_shared/globSync-Bk9TUV7x.js +1 -0
- package/dist/packem_shared/index-CPZbuHkp.js +1 -0
- package/dist/packem_shared/isAccessible-B7guOm3k.js +1 -0
- package/dist/packem_shared/isAccessibleSync-XH4YleJW.js +1 -0
- package/dist/packem_shared/json-error.d-COL8oxF_.d.ts +52 -0
- package/dist/packem_shared/move-KhPRvsRd.js +1 -0
- package/dist/packem_shared/{parseJson-EASgP4J9.js → parseJson-_OfIPruP.js} +1 -1
- package/dist/packem_shared/readFile-VgxUDrNH.js +1 -0
- package/dist/packem_shared/readFileSync-CloFeQw8.js +1 -0
- package/dist/packem_shared/{readIni-BsXudu2r.js → readIni-CEXHWn92.js} +1 -1
- package/dist/packem_shared/readIniSync-DsxVHypc.js +1 -0
- package/dist/packem_shared/{readJson-CcAsHxE5.js → readJson-Q3T3RlSy.js} +1 -1
- package/dist/packem_shared/{readJson5-CM1TIiHd.js → readJson5-S68aVros.js} +1 -1
- package/dist/packem_shared/{readJson5Sync-Bc26c3Fy.js → readJson5Sync-Bi9Rv46R.js} +1 -1
- package/dist/packem_shared/{readJsonSync-DuMMeB3s.js → readJsonSync-BnWiH5-R.js} +1 -1
- package/dist/packem_shared/{readJsonc-BZjMw_0f.js → readJsonc-DSoFyuDk.js} +1 -1
- package/dist/packem_shared/{readJsoncSync-C-xzeZz4.js → readJsoncSync-CLtlvFKV.js} +1 -1
- package/dist/packem_shared/readToml-CN_xnICv.js +1 -0
- package/dist/packem_shared/readTomlSync-B9TVGzen.js +1 -0
- package/dist/packem_shared/{readYaml-DvPxndW_.js → readYaml-DcpUq11D.js} +1 -1
- package/dist/packem_shared/{readYamlSync-DZ-0hSbZ.js → readYamlSync-D5RVZwco.js} +1 -1
- package/dist/packem_shared/remove-D_CUIlBL.js +1 -0
- package/dist/packem_shared/removeSync-F4nKiwrU.js +1 -0
- package/dist/packem_shared/renderError-DjesnVYT-pWsLqw-_.js +6 -0
- package/dist/packem_shared/sanitize-aEqeyx4d.js +1 -0
- package/dist/packem_shared/to-uint-8-array-7sXMoZwU.js +1 -0
- package/dist/packem_shared/{types.d-BMdL_ygj.d.ts → types.d-D3Jo_iA-.d.ts} +361 -383
- package/dist/packem_shared/walk-BReeHTKb.js +1 -0
- package/dist/packem_shared/walkSync-yHJUIJb9.js +1 -0
- package/dist/packem_shared/writeFile-srDcYaRC.js +1 -0
- package/dist/packem_shared/writeFileSync-Ddl_u4my.js +1 -0
- package/dist/packem_shared/writeIni-CKinbquM.js +4 -0
- package/dist/packem_shared/writeIniSync-BISRFyg0.js +4 -0
- package/dist/packem_shared/writeJson-DlCrFMXb.js +4 -0
- package/dist/packem_shared/writeJson5-rSp3QAKP.js +4 -0
- package/dist/packem_shared/writeJson5Sync-tSBBKnaP.js +4 -0
- package/dist/packem_shared/writeJsonSync-CKqVRz_9.js +4 -0
- package/dist/packem_shared/writeJsonc-bxz1jdeU.js +4 -0
- package/dist/packem_shared/writeJsoncSync-C-W0H9qP.js +4 -0
- package/dist/packem_shared/{writeToml-IuMO-yDu.js → writeToml-CrpfWNyK.js} +1 -1
- package/dist/packem_shared/{writeTomlSync-DhL7hHzB.js → writeTomlSync-DveRchLG.js} +1 -1
- package/dist/packem_shared/{writeYaml-ClQgvQID.js → writeYaml-DvSQ_Jbn.js} +1 -1
- package/dist/packem_shared/{writeYamlSync-DrXtHQQq.js → writeYamlSync-CEf0PUGQ.js} +1 -1
- package/dist/size.d.ts +236 -236
- package/dist/size.js +1 -1
- package/dist/toml.d.ts +52 -52
- package/dist/toml.js +1 -1
- package/dist/utils.d.ts +88 -88
- package/dist/utils.js +1 -1
- package/dist/yaml.d.ts +2 -2
- package/dist/yaml.js +1 -1
- package/package.json +1 -1
- package/dist/packem_shared/copy-Beb64BYG.js +0 -1
- package/dist/packem_shared/copySync-CagcIEBi.js +0 -1
- package/dist/packem_shared/emptyDir-C7lyd1lW.js +0 -1
- package/dist/packem_shared/emptyDirSync-B8EYpmO9.js +0 -1
- package/dist/packem_shared/ensureDir-DGarVZw8.js +0 -1
- package/dist/packem_shared/ensureDirSync-CsgPrsDH.js +0 -1
- package/dist/packem_shared/ensureFile-CMugWljp.js +0 -1
- package/dist/packem_shared/ensureFileSync-CJYTEx2r.js +0 -1
- package/dist/packem_shared/ensureLink-ChShf3lf.js +0 -1
- package/dist/packem_shared/ensureLinkSync-DPpq0I2Z.js +0 -1
- package/dist/packem_shared/ensureSymlink-y4FZjfxA.js +0 -1
- package/dist/packem_shared/ensureSymlinkSync-TcHssCH7.js +0 -1
- package/dist/packem_shared/findUp-Cii5ATt5.js +0 -1
- package/dist/packem_shared/findUpSync-C9Lkh7-v.js +0 -1
- package/dist/packem_shared/glob-DMbPwGSj.js +0 -1
- package/dist/packem_shared/glob-sync.d-hXe38TnZ.d.ts +0 -54
- package/dist/packem_shared/globSync-DiP2rtGn.js +0 -1
- package/dist/packem_shared/index-Ct4GqZSP.js +0 -1
- package/dist/packem_shared/isAccessible-PmWJhV6I.js +0 -1
- package/dist/packem_shared/isAccessibleSync-BrbOtwdr.js +0 -1
- package/dist/packem_shared/json-error.d-DVILOyHc.d.ts +0 -52
- package/dist/packem_shared/move-DopmzT-2.js +0 -1
- package/dist/packem_shared/readFile-BswaBgM0.js +0 -1
- package/dist/packem_shared/readFileSync-_fDF6Oj1.js +0 -1
- package/dist/packem_shared/readIniSync-DKwRbbs9.js +0 -1
- package/dist/packem_shared/readToml-D4jpe9q_.js +0 -1
- package/dist/packem_shared/readTomlSync-B5PIYT9z.js +0 -1
- package/dist/packem_shared/remove-CSbrd0dl.js +0 -1
- package/dist/packem_shared/removeSync-BoLAzRQE.js +0 -1
- package/dist/packem_shared/renderError-B3ePOoBG-Bi9WKMjv.js +0 -6
- package/dist/packem_shared/sanitize-DGZ3w-_w.js +0 -1
- package/dist/packem_shared/to-uint-8-array-BImOQNXm.js +0 -1
- package/dist/packem_shared/walk-OX4-6oCP.js +0 -1
- package/dist/packem_shared/walkSync-BPs6czIM.js +0 -1
- package/dist/packem_shared/writeFile-BrMtsJY7.js +0 -1
- package/dist/packem_shared/writeFileSync-W7Mf4BNy.js +0 -1
- package/dist/packem_shared/writeIni-BWX3cP1K.js +0 -4
- package/dist/packem_shared/writeIniSync-fOdgPFfL.js +0 -4
- package/dist/packem_shared/writeJson-bEVi25gX.js +0 -4
- package/dist/packem_shared/writeJson5-Ch8TpNPI.js +0 -4
- package/dist/packem_shared/writeJson5Sync-BrctV_Mk.js +0 -4
- package/dist/packem_shared/writeJsonSync-DkGnd416.js +0 -4
- package/dist/packem_shared/writeJsonc-CefrwsOc.js +0 -4
- package/dist/packem_shared/writeJsoncSync-BskDjn8o.js +0 -4
|
@@ -4,104 +4,98 @@ import { FSLike } from 'fdir';
|
|
|
4
4
|
type FileSystemAdapter = Partial<FSLike>;
|
|
5
5
|
interface GlobOptions$1 {
|
|
6
6
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
* Whether to return absolute paths. Disable to have relative paths.
|
|
8
|
+
* @default false
|
|
9
|
+
*/
|
|
10
10
|
absolute?: boolean;
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
* Enables support for brace expansion syntax, like `{a,b}` or `{1..9}`.
|
|
13
|
+
* @default true
|
|
14
|
+
*/
|
|
15
15
|
braceExpansion?: boolean;
|
|
16
16
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
* Whether to match in case-sensitive mode.
|
|
18
|
+
* @default true
|
|
19
|
+
*/
|
|
20
20
|
caseSensitiveMatch?: boolean;
|
|
21
21
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
* The working directory in which to search. Results will be returned relative to this directory, unless
|
|
23
|
+
* {@link absolute} is set.
|
|
24
|
+
*
|
|
25
|
+
* It is important to avoid globbing outside this directory when possible, even with absolute paths enabled,
|
|
26
|
+
* as doing so can harm performance due to having to recalculate relative paths.
|
|
27
|
+
* @default process.cwd()
|
|
28
|
+
*/
|
|
29
29
|
cwd?: string | URL;
|
|
30
30
|
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
* Logs useful debug information. Meant for development purposes. Logs can change at any time.
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
34
|
debug?: boolean;
|
|
35
35
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
* Maximum directory depth to crawl.
|
|
37
|
+
* @default Infinity
|
|
38
|
+
*/
|
|
39
39
|
deep?: number;
|
|
40
40
|
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
* Whether to return entries that start with a dot, like `.gitignore` or `.prettierrc`.
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
44
|
dot?: boolean;
|
|
45
45
|
/**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
* Whether to automatically expand directory patterns.
|
|
47
|
+
*
|
|
48
|
+
* Important to disable if migrating from [`fast-glob`](https://github.com/mrmlnc/fast-glob).
|
|
49
|
+
* @default true
|
|
50
|
+
*/
|
|
51
51
|
expandDirectories?: boolean;
|
|
52
52
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
* Enables support for extglobs, like `+(pattern)`.
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
56
56
|
extglob?: boolean;
|
|
57
57
|
/**
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
* Whether to traverse and include symbolic links. Can slightly affect performance.
|
|
59
|
+
* @default true
|
|
60
|
+
*/
|
|
61
61
|
followSymbolicLinks?: boolean;
|
|
62
62
|
/**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
* An object that overrides `node:fs` functions.
|
|
64
|
+
* @default import('node:fs')
|
|
65
|
+
*/
|
|
66
66
|
fs?: FileSystemAdapter;
|
|
67
67
|
/**
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
* Enables support for matching nested directories with globstars (`**`).
|
|
69
|
+
* If `false`, `**` behaves exactly like `*`.
|
|
70
|
+
* @default true
|
|
71
|
+
*/
|
|
72
72
|
globstar?: boolean;
|
|
73
73
|
/**
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
* Glob patterns to exclude from the results.
|
|
75
|
+
* @default []
|
|
76
|
+
*/
|
|
77
77
|
ignore?: string | readonly string[];
|
|
78
78
|
/**
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
* Enable to only return directories.
|
|
80
|
+
* If `true`, disables {@link onlyFiles}.
|
|
81
|
+
* @default false
|
|
82
|
+
*/
|
|
83
83
|
onlyDirectories?: boolean;
|
|
84
84
|
/**
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
* Enable to only return files.
|
|
86
|
+
* @default true
|
|
87
|
+
*/
|
|
88
88
|
onlyFiles?: boolean;
|
|
89
89
|
/**
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
* @deprecated Provide patterns as the first argument instead.
|
|
91
|
+
*/
|
|
92
92
|
patterns?: string | readonly string[];
|
|
93
93
|
/**
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
* An `AbortSignal` to abort crawling the file system.
|
|
95
|
+
* @default undefined
|
|
96
|
+
*/
|
|
97
97
|
signal?: AbortSignal;
|
|
98
|
-
}
|
|
99
|
-
//#region src/utils.d.ts
|
|
100
|
-
/**
|
|
101
|
-
* Converts a path to a pattern depending on the platform.
|
|
102
|
-
* Identical to {@link escapePath} on POSIX systems.
|
|
103
|
-
* @see {@link https://superchupu.dev/tinyglobby/documentation#convertPathToPattern}
|
|
104
|
-
*/
|
|
98
|
+
}
|
|
105
99
|
/**
|
|
106
100
|
* Tracks newlines during parsing in order to provide an efficient API for
|
|
107
101
|
* determining the one-indexed `{ line, col }` position for any offset
|
|
@@ -475,15 +469,7 @@ declare class Schema {
|
|
|
475
469
|
readonly [MAP]: CollectionTag;
|
|
476
470
|
readonly [SCALAR]: ScalarTag;
|
|
477
471
|
readonly [SEQ]: CollectionTag;
|
|
478
|
-
constructor({
|
|
479
|
-
compat,
|
|
480
|
-
customTags,
|
|
481
|
-
merge,
|
|
482
|
-
resolveKnownTags,
|
|
483
|
-
schema,
|
|
484
|
-
sortMapEntries,
|
|
485
|
-
toStringDefaults
|
|
486
|
-
}: SchemaOptions);
|
|
472
|
+
constructor({ compat, customTags, merge, resolveKnownTags, schema, sortMapEntries, toStringDefaults }: SchemaOptions);
|
|
487
473
|
clone(): Schema;
|
|
488
474
|
}
|
|
489
475
|
interface CreateNodeContext {
|
|
@@ -498,10 +484,7 @@ interface CreateNodeContext {
|
|
|
498
484
|
replacer?: Replacer;
|
|
499
485
|
schema: Schema;
|
|
500
486
|
}
|
|
501
|
-
declare function addPairToJSMap(ctx: ToJSContext | undefined, map: MapLike, {
|
|
502
|
-
key,
|
|
503
|
-
value
|
|
504
|
-
}: Pair): MapLike;
|
|
487
|
+
declare function addPairToJSMap(ctx: ToJSContext | undefined, map: MapLike, { key, value }: Pair): MapLike;
|
|
505
488
|
declare class Pair<K = unknown, V = unknown> {
|
|
506
489
|
readonly [NODE_TYPE]: symbol;
|
|
507
490
|
/** Always Node or null when parsed, but can be set to anything. */
|
|
@@ -922,12 +905,7 @@ declare abstract class NodeBase {
|
|
|
922
905
|
/** Create a copy of this node. */
|
|
923
906
|
clone(): NodeBase;
|
|
924
907
|
/** A plain JavaScript representation of this node. */
|
|
925
|
-
toJS(doc: Document<Node, boolean>, {
|
|
926
|
-
mapAsMap,
|
|
927
|
-
maxAliasCount,
|
|
928
|
-
onAnchor,
|
|
929
|
-
reviver
|
|
930
|
-
}?: ToJSOptions): any;
|
|
908
|
+
toJS(doc: Document<Node, boolean>, { mapAsMap, maxAliasCount, onAnchor, reviver }?: ToJSOptions): any;
|
|
931
909
|
}
|
|
932
910
|
interface SourceToken {
|
|
933
911
|
type: 'byte-order-mark' | 'doc-mode' | 'doc-start' | 'space' | 'comment' | 'newline' | 'directive-line' | 'anchor' | 'tag' | 'seq-item-ind' | 'explicit-key-ind' | 'map-value-ind' | 'flow-map-start' | 'flow-map-end' | 'flow-seq-start' | 'flow-seq-end' | 'flow-error-end' | 'comma' | 'block-scalar-header';
|
|
@@ -1216,222 +1194,222 @@ declare class Directives {
|
|
|
1216
1194
|
toString(doc?: Document): string;
|
|
1217
1195
|
}
|
|
1218
1196
|
/**
|
|
1219
|
-
* Constant to check if the path is visible to the calling process.
|
|
1220
|
-
* Corresponds to `node:fs.constants.F_OK`.
|
|
1221
|
-
*/
|
|
1197
|
+
* Constant to check if the path is visible to the calling process.
|
|
1198
|
+
* Corresponds to `node:fs.constants.F_OK`.
|
|
1199
|
+
*/
|
|
1222
1200
|
declare const F_OK: number;
|
|
1223
1201
|
/**
|
|
1224
|
-
* Constant to check if the path is readable to the calling process.
|
|
1225
|
-
* Corresponds to `node:fs.constants.R_OK`.
|
|
1226
|
-
*/
|
|
1202
|
+
* Constant to check if the path is readable to the calling process.
|
|
1203
|
+
* Corresponds to `node:fs.constants.R_OK`.
|
|
1204
|
+
*/
|
|
1227
1205
|
declare const R_OK: number;
|
|
1228
1206
|
/**
|
|
1229
|
-
* Constant to check if the path is writable to the calling process.
|
|
1230
|
-
* Corresponds to `node:fs.constants.W_OK`.
|
|
1231
|
-
*/
|
|
1207
|
+
* Constant to check if the path is writable to the calling process.
|
|
1208
|
+
* Corresponds to `node:fs.constants.W_OK`.
|
|
1209
|
+
*/
|
|
1232
1210
|
declare const W_OK: number;
|
|
1233
1211
|
/**
|
|
1234
|
-
* Constant to check if the path is executable by the calling process.
|
|
1235
|
-
* Corresponds to `node:fs.constants.X_OK`.
|
|
1236
|
-
*/
|
|
1212
|
+
* Constant to check if the path is executable by the calling process.
|
|
1213
|
+
* Corresponds to `node:fs.constants.X_OK`.
|
|
1214
|
+
*/
|
|
1237
1215
|
declare const X_OK: number;
|
|
1238
1216
|
/**
|
|
1239
|
-
* A special symbol that can be returned by the matcher function in `findUp` or `findUpSync`
|
|
1240
|
-
* to stop the search process prematurely.
|
|
1241
|
-
*/
|
|
1217
|
+
* A special symbol that can be returned by the matcher function in `findUp` or `findUpSync`
|
|
1218
|
+
* to stop the search process prematurely.
|
|
1219
|
+
*/
|
|
1242
1220
|
declare const FIND_UP_STOP: symbol;
|
|
1243
1221
|
type ColorizeMethod = (value: string) => string;
|
|
1244
1222
|
/**
|
|
1245
|
-
* Options accepted by `jsonc-parser`'s `parse` function.
|
|
1246
|
-
*/
|
|
1223
|
+
* Options accepted by `jsonc-parser`'s `parse` function.
|
|
1224
|
+
*/
|
|
1247
1225
|
type JsoncParseOptions = {
|
|
1248
1226
|
/**
|
|
1249
|
-
|
|
1250
|
-
|
|
1227
|
+
* Allow empty content as a valid input. Defaults to `false`.
|
|
1228
|
+
*/
|
|
1251
1229
|
allowEmptyContent?: boolean;
|
|
1252
1230
|
/**
|
|
1253
|
-
|
|
1254
|
-
|
|
1231
|
+
* Allow trailing commas in arrays and objects. Defaults to `false`.
|
|
1232
|
+
*/
|
|
1255
1233
|
allowTrailingComma?: boolean;
|
|
1256
1234
|
/**
|
|
1257
|
-
|
|
1258
|
-
|
|
1235
|
+
* Disallow JavaScript-style comments in the input. Defaults to `false` (comments allowed).
|
|
1236
|
+
*/
|
|
1259
1237
|
disallowComments?: boolean;
|
|
1260
1238
|
};
|
|
1261
1239
|
/**
|
|
1262
|
-
* Formatting options for `jsonc-parser` edits.
|
|
1263
|
-
*/
|
|
1240
|
+
* Formatting options for `jsonc-parser` edits.
|
|
1241
|
+
*/
|
|
1264
1242
|
type JsoncFormattingOptions = {
|
|
1265
1243
|
/**
|
|
1266
|
-
|
|
1267
|
-
|
|
1244
|
+
* The line ending to use in the output.
|
|
1245
|
+
*/
|
|
1268
1246
|
eol?: string;
|
|
1269
1247
|
/**
|
|
1270
|
-
|
|
1271
|
-
|
|
1248
|
+
* When `true`, insert a final newline when the output does not end with one.
|
|
1249
|
+
*/
|
|
1272
1250
|
insertFinalNewline?: boolean;
|
|
1273
1251
|
/**
|
|
1274
|
-
|
|
1275
|
-
|
|
1252
|
+
* Indent with spaces (`true`) or tabs (`false`). Defaults to `true`.
|
|
1253
|
+
*/
|
|
1276
1254
|
insertSpaces?: boolean;
|
|
1277
1255
|
/**
|
|
1278
|
-
|
|
1279
|
-
|
|
1256
|
+
* When `true`, attempt to keep the original line structure when applying edits.
|
|
1257
|
+
*/
|
|
1280
1258
|
keepLines?: boolean;
|
|
1281
1259
|
/**
|
|
1282
|
-
|
|
1283
|
-
|
|
1260
|
+
* Indent size when {@link JsoncFormattingOptions.insertSpaces | insertSpaces} is `true`.
|
|
1261
|
+
*/
|
|
1284
1262
|
tabSize?: number;
|
|
1285
1263
|
};
|
|
1286
1264
|
/**
|
|
1287
|
-
* Options accepted by the `ini` library's `stringify` / `encode` functions.
|
|
1288
|
-
* Kept as a local definition so the types compile without the optional peer installed.
|
|
1289
|
-
*/
|
|
1265
|
+
* Options accepted by the `ini` library's `stringify` / `encode` functions.
|
|
1266
|
+
* Kept as a local definition so the types compile without the optional peer installed.
|
|
1267
|
+
*/
|
|
1290
1268
|
type IniEncodeOptions = {
|
|
1291
1269
|
/**
|
|
1292
|
-
|
|
1293
|
-
|
|
1270
|
+
* Align `=` signs across the output.
|
|
1271
|
+
*/
|
|
1294
1272
|
align?: boolean;
|
|
1295
1273
|
/**
|
|
1296
|
-
|
|
1297
|
-
|
|
1274
|
+
* Serialize array values using the `key[]` convention. Defaults to `true`.
|
|
1275
|
+
*/
|
|
1298
1276
|
bracketedArray?: boolean;
|
|
1299
1277
|
/**
|
|
1300
|
-
|
|
1301
|
-
|
|
1278
|
+
* Append a trailing newline to every section.
|
|
1279
|
+
*/
|
|
1302
1280
|
newline?: boolean;
|
|
1303
1281
|
/**
|
|
1304
|
-
|
|
1305
|
-
|
|
1282
|
+
* Target platform for section/key escaping. Defaults to the current platform.
|
|
1283
|
+
*/
|
|
1306
1284
|
platform?: string;
|
|
1307
1285
|
/**
|
|
1308
|
-
|
|
1309
|
-
|
|
1286
|
+
* Name of the top-level section.
|
|
1287
|
+
*/
|
|
1310
1288
|
section?: string;
|
|
1311
1289
|
/**
|
|
1312
|
-
|
|
1313
|
-
|
|
1290
|
+
* Sort keys alphabetically within sections.
|
|
1291
|
+
*/
|
|
1314
1292
|
sort?: boolean;
|
|
1315
1293
|
/**
|
|
1316
|
-
|
|
1317
|
-
|
|
1294
|
+
* Write `key = value` with spaces around `=`. Defaults to `false`.
|
|
1295
|
+
*/
|
|
1318
1296
|
whitespace?: boolean;
|
|
1319
1297
|
};
|
|
1320
1298
|
/**
|
|
1321
|
-
* Replacer accepted by `JSON5.stringify()`.
|
|
1322
|
-
*/
|
|
1299
|
+
* Replacer accepted by `JSON5.stringify()`.
|
|
1300
|
+
*/
|
|
1323
1301
|
type Json5Replacer = (number | string)[] | ((this: unknown, key: string, value: unknown) => unknown) | null;
|
|
1324
1302
|
/**
|
|
1325
|
-
* Options for the `glob` and `globSync` functions.
|
|
1326
|
-
*
|
|
1327
|
-
* Re-exported from [`tinyglobby`](https://github.com/SuperchupuDev/tinyglobby) (which is bundled into the built
|
|
1328
|
-
* output, with a local patch adding negated-ignore support). The `ignore` option accepts leading-`!` patterns to
|
|
1329
|
-
* _un-ignore_ entries — for example `ignore: ["dist/**", "!dist/index.d.ts"]` drops the `dist/` tree except for
|
|
1330
|
-
* its type entry point.
|
|
1331
|
-
*/
|
|
1303
|
+
* Options for the `glob` and `globSync` functions.
|
|
1304
|
+
*
|
|
1305
|
+
* Re-exported from [`tinyglobby`](https://github.com/SuperchupuDev/tinyglobby) (which is bundled into the built
|
|
1306
|
+
* output, with a local patch adding negated-ignore support). The `ignore` option accepts leading-`!` patterns to
|
|
1307
|
+
* _un-ignore_ entries — for example `ignore: ["dist/**", "!dist/index.d.ts"]` drops the `dist/` tree except for
|
|
1308
|
+
* its type entry point.
|
|
1309
|
+
*/
|
|
1332
1310
|
type GlobOptions = Omit<GlobOptions$1, "patterns">;
|
|
1333
1311
|
/**
|
|
1334
|
-
* Options for the `walk` and `walkSync` functions.
|
|
1335
|
-
*/
|
|
1312
|
+
* Options for the `walk` and `walkSync` functions.
|
|
1313
|
+
*/
|
|
1336
1314
|
interface WalkOptions {
|
|
1337
1315
|
/**
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1316
|
+
* List of file extensions used to filter entries.
|
|
1317
|
+
* If specified, entries without the file extension specified by this option are excluded.
|
|
1318
|
+
* @default {undefined}
|
|
1319
|
+
*/
|
|
1342
1320
|
extensions?: string[];
|
|
1343
1321
|
/**
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1322
|
+
* Indicates whether symlinks should be resolved or not.
|
|
1323
|
+
* @default {false}
|
|
1324
|
+
*/
|
|
1347
1325
|
followSymlinks?: boolean;
|
|
1348
1326
|
/**
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1327
|
+
* Indicates whether directory entries should be included or not.
|
|
1328
|
+
* @default {true}
|
|
1329
|
+
*/
|
|
1352
1330
|
includeDirs?: boolean;
|
|
1353
1331
|
/**
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1332
|
+
* Indicates whether file entries should be included or not.
|
|
1333
|
+
* @default {true}
|
|
1334
|
+
*/
|
|
1357
1335
|
includeFiles?: boolean;
|
|
1358
1336
|
/**
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1337
|
+
* Indicates whether symlink entries should be included or not.
|
|
1338
|
+
* This option is meaningful only if `followSymlinks` is set to `false`.
|
|
1339
|
+
* @default {true}
|
|
1340
|
+
*/
|
|
1363
1341
|
includeSymlinks?: boolean;
|
|
1364
1342
|
/**
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1343
|
+
* List of regular expression or glob patterns used to filter entries.
|
|
1344
|
+
* If specified, entries that do not match the patterns specified by this option are excluded.
|
|
1345
|
+
* @default {undefined}
|
|
1346
|
+
*/
|
|
1369
1347
|
match?: (RegExp | string)[];
|
|
1370
1348
|
/**
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1349
|
+
* The maximum depth of the file tree to be walked recursively.
|
|
1350
|
+
* @default {Infinity}
|
|
1351
|
+
*/
|
|
1374
1352
|
maxDepth?: number;
|
|
1375
1353
|
/**
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1354
|
+
* List of regular expression or glob patterns used to filter entries.
|
|
1355
|
+
* If specified, entries matching the patterns specified by this option are excluded.
|
|
1356
|
+
* @default {undefined}
|
|
1357
|
+
*/
|
|
1380
1358
|
skip?: (RegExp | string)[];
|
|
1381
1359
|
}
|
|
1382
1360
|
/**
|
|
1383
|
-
* Represents an entry found by `walk` or `walkSync`.
|
|
1384
|
-
*/
|
|
1361
|
+
* Represents an entry found by `walk` or `walkSync`.
|
|
1362
|
+
*/
|
|
1385
1363
|
interface WalkEntry extends Pick<Dirent, "isDirectory" | "isFile" | "isSymbolicLink" | "name"> {
|
|
1386
1364
|
/** The full path to the entry. */
|
|
1387
1365
|
path: string;
|
|
1388
1366
|
}
|
|
1389
1367
|
/**
|
|
1390
|
-
* Supported compression types for file operations.
|
|
1391
|
-
*/
|
|
1368
|
+
* Supported compression types for file operations.
|
|
1369
|
+
*/
|
|
1392
1370
|
type CompressionType = "brotli" | "gzip" | "none";
|
|
1393
1371
|
/**
|
|
1394
|
-
* Supported file encodings for reading files.
|
|
1395
|
-
*/
|
|
1372
|
+
* Supported file encodings for reading files.
|
|
1373
|
+
*/
|
|
1396
1374
|
type ReadFileEncoding = "ascii" | "base64" | "base64url" | "hex" | "latin1" | "ucs-2" | "ucs2" | "utf-8" | "utf-16le" | "utf8" | "utf16le";
|
|
1397
1375
|
/**
|
|
1398
|
-
* Options for reading files.
|
|
1399
|
-
*/
|
|
1376
|
+
* Options for reading files.
|
|
1377
|
+
*/
|
|
1400
1378
|
type ReadFileOptions<C> = {
|
|
1401
1379
|
/**
|
|
1402
|
-
|
|
1403
|
-
|
|
1380
|
+
* Return content as a Buffer. Default: `false`
|
|
1381
|
+
*/
|
|
1404
1382
|
buffer?: boolean;
|
|
1405
1383
|
/**
|
|
1406
|
-
|
|
1407
|
-
|
|
1384
|
+
* Compression method to decompress the file against. Default: `none`
|
|
1385
|
+
*/
|
|
1408
1386
|
compression?: C;
|
|
1409
1387
|
/**
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1388
|
+
* The encoding to use. Default: `utf8`
|
|
1389
|
+
* @see https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings
|
|
1390
|
+
*/
|
|
1413
1391
|
encoding?: ReadFileEncoding;
|
|
1414
1392
|
/**
|
|
1415
|
-
|
|
1416
|
-
|
|
1393
|
+
* The flag used to open the file. Default: `r`
|
|
1394
|
+
*/
|
|
1417
1395
|
flag?: number | string;
|
|
1418
1396
|
};
|
|
1419
1397
|
/**
|
|
1420
|
-
* Represents the content type of a read file, which can be a Buffer or a string based on options.
|
|
1421
|
-
* @template O - The ReadFileOptions type.
|
|
1422
|
-
*/
|
|
1398
|
+
* Represents the content type of a read file, which can be a Buffer or a string based on options.
|
|
1399
|
+
* @template O - The ReadFileOptions type.
|
|
1400
|
+
*/
|
|
1423
1401
|
type ContentType<O = undefined> = O extends {
|
|
1424
1402
|
buffer: true;
|
|
1425
1403
|
} ? Buffer : string;
|
|
1426
1404
|
/**
|
|
1427
|
-
* Type for the `reviver` parameter of `JSON.parse()`.
|
|
1428
|
-
* A function that transforms the results. This function is called for each member of the object.
|
|
1429
|
-
* If a member contains nested objects, the nested objects are transformed before the parent object is.
|
|
1430
|
-
*/
|
|
1405
|
+
* Type for the `reviver` parameter of `JSON.parse()`.
|
|
1406
|
+
* A function that transforms the results. This function is called for each member of the object.
|
|
1407
|
+
* If a member contains nested objects, the nested objects are transformed before the parent object is.
|
|
1408
|
+
*/
|
|
1431
1409
|
type JsonReviver = Parameters<(typeof JSON)["parse"]>["1"];
|
|
1432
1410
|
/**
|
|
1433
|
-
* Specifies a location (line and column) in a file for code frame generation.
|
|
1434
|
-
*/
|
|
1411
|
+
* Specifies a location (line and column) in a file for code frame generation.
|
|
1412
|
+
*/
|
|
1435
1413
|
type CodeFrameLocation = {
|
|
1436
1414
|
/** The column number. */
|
|
1437
1415
|
column?: number;
|
|
@@ -1439,8 +1417,8 @@ type CodeFrameLocation = {
|
|
|
1439
1417
|
line: number;
|
|
1440
1418
|
};
|
|
1441
1419
|
/**
|
|
1442
|
-
* Options for customizing the appearance of code frames.
|
|
1443
|
-
*/
|
|
1420
|
+
* Options for customizing the appearance of code frames.
|
|
1421
|
+
*/
|
|
1444
1422
|
type CodeFrameOptions = {
|
|
1445
1423
|
/** Colorization methods for different parts of the code frame. */
|
|
1446
1424
|
color?: {
|
|
@@ -1453,321 +1431,321 @@ type CodeFrameOptions = {
|
|
|
1453
1431
|
};
|
|
1454
1432
|
};
|
|
1455
1433
|
/**
|
|
1456
|
-
* Options for reading and parsing JSON files.
|
|
1457
|
-
* Extends {@link CodeFrameOptions}.
|
|
1458
|
-
*/
|
|
1434
|
+
* Options for reading and parsing JSON files.
|
|
1435
|
+
* Extends {@link CodeFrameOptions}.
|
|
1436
|
+
*/
|
|
1459
1437
|
type ReadJsonOptions = CodeFrameOptions & {
|
|
1460
1438
|
/**
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1439
|
+
* A function to transform the string content before parsing.
|
|
1440
|
+
* @param source The raw string content of the file.
|
|
1441
|
+
* @returns The transformed string content.
|
|
1442
|
+
*/
|
|
1465
1443
|
beforeParse?: (source: string) => string;
|
|
1466
1444
|
};
|
|
1467
1445
|
/**
|
|
1468
|
-
* Options for writing files.
|
|
1469
|
-
*/
|
|
1446
|
+
* Options for writing files.
|
|
1447
|
+
*/
|
|
1470
1448
|
type WriteFileOptions = {
|
|
1471
1449
|
/**
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1450
|
+
* When `true` and the target file already exists, the previous contents are
|
|
1451
|
+
* preserved by renaming the existing file to `${path}.bak` before the new
|
|
1452
|
+
* contents are written. This is independent of {@link WriteFileOptions.overwrite}.
|
|
1453
|
+
*
|
|
1454
|
+
* Default: `false`
|
|
1455
|
+
*/
|
|
1478
1456
|
backup?: boolean;
|
|
1479
1457
|
/**
|
|
1480
|
-
|
|
1481
|
-
|
|
1458
|
+
* The group and user ID used to set the file ownership. Default: `undefined`
|
|
1459
|
+
*/
|
|
1482
1460
|
chown?: {
|
|
1483
1461
|
gid: number;
|
|
1484
1462
|
uid: number;
|
|
1485
1463
|
};
|
|
1486
1464
|
/**
|
|
1487
|
-
|
|
1488
|
-
|
|
1465
|
+
* The encoding to use. Default: `utf8`
|
|
1466
|
+
*/
|
|
1489
1467
|
encoding?: BufferEncoding | null;
|
|
1490
1468
|
/**
|
|
1491
|
-
|
|
1492
|
-
|
|
1469
|
+
* The flag used to write the file. Default: `w`
|
|
1470
|
+
*/
|
|
1493
1471
|
flag?: string;
|
|
1494
1472
|
/**
|
|
1495
|
-
|
|
1496
|
-
|
|
1473
|
+
* The file mode (permission and sticky bits). Default: `0o666`
|
|
1474
|
+
*/
|
|
1497
1475
|
mode?: number;
|
|
1498
1476
|
/**
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1477
|
+
* Indicates whether the file should be overwritten if it already exists.
|
|
1478
|
+
* When `false` and the target already exists, an `AlreadyExistsError` is thrown.
|
|
1479
|
+
*
|
|
1480
|
+
* Default: `true`
|
|
1481
|
+
*/
|
|
1504
1482
|
overwrite?: boolean;
|
|
1505
1483
|
/**
|
|
1506
|
-
|
|
1507
|
-
|
|
1484
|
+
* Recursively create parent directories if needed. Default: `true`
|
|
1485
|
+
*/
|
|
1508
1486
|
recursive?: boolean;
|
|
1509
1487
|
};
|
|
1510
1488
|
/**
|
|
1511
|
-
* Type for the `replacer` parameter of `JSON.stringify()`.
|
|
1512
|
-
* Can be a function that alters the behavior of the stringification process,
|
|
1513
|
-
* or an array of strings and numbers that acts as a whitelist for selecting
|
|
1514
|
-
* the properties of the value object to be included in the JSON string.
|
|
1515
|
-
* If this value is null or not provided, all properties of the object are included in the resulting JSON string.
|
|
1516
|
-
*/
|
|
1489
|
+
* Type for the `replacer` parameter of `JSON.stringify()`.
|
|
1490
|
+
* Can be a function that alters the behavior of the stringification process,
|
|
1491
|
+
* or an array of strings and numbers that acts as a whitelist for selecting
|
|
1492
|
+
* the properties of the value object to be included in the JSON string.
|
|
1493
|
+
* If this value is null or not provided, all properties of the object are included in the resulting JSON string.
|
|
1494
|
+
*/
|
|
1517
1495
|
type JsonReplacer = (number | string)[] | ((this: unknown, key: string, value: unknown) => unknown) | null;
|
|
1518
1496
|
/**
|
|
1519
|
-
* Type for the `replacer` parameter used in YAML serialization, similar to `JSON.stringify`'s replacer.
|
|
1520
|
-
* @deprecated Use {@link JsonReplacer} directly instead.
|
|
1521
|
-
*/
|
|
1497
|
+
* Type for the `replacer` parameter used in YAML serialization, similar to `JSON.stringify`'s replacer.
|
|
1498
|
+
* @deprecated Use {@link JsonReplacer} directly instead.
|
|
1499
|
+
*/
|
|
1522
1500
|
type YamlReplacer = JsonReplacer;
|
|
1523
1501
|
/**
|
|
1524
|
-
* Options for writing JSON files.
|
|
1525
|
-
* Extends {@link WriteFileOptions}.
|
|
1526
|
-
*/
|
|
1502
|
+
* Options for writing JSON files.
|
|
1503
|
+
* Extends {@link WriteFileOptions}.
|
|
1504
|
+
*/
|
|
1527
1505
|
type WriteJsonOptions = WriteFileOptions & {
|
|
1528
1506
|
/**
|
|
1529
|
-
|
|
1530
|
-
|
|
1507
|
+
* Detect indentation automatically if the file exists. Default: `false`
|
|
1508
|
+
*/
|
|
1531
1509
|
detectIndent?: boolean;
|
|
1532
1510
|
/**
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1511
|
+
* The space used for pretty-printing.
|
|
1512
|
+
*
|
|
1513
|
+
* Pass in `undefined` for no formatting.
|
|
1514
|
+
*/
|
|
1537
1515
|
indent?: number | string;
|
|
1538
1516
|
/**
|
|
1539
|
-
|
|
1540
|
-
|
|
1517
|
+
* Passed into `JSON.stringify`.
|
|
1518
|
+
*/
|
|
1541
1519
|
replacer?: JsonReplacer;
|
|
1542
1520
|
/**
|
|
1543
|
-
|
|
1544
|
-
|
|
1521
|
+
* Override the default `JSON.stringify` method.
|
|
1522
|
+
*/
|
|
1545
1523
|
stringify?: (data: unknown, replacer: JsonReplacer, space: number | string | undefined) => string;
|
|
1546
1524
|
};
|
|
1547
1525
|
/**
|
|
1548
|
-
* Options for the `findUp` and `findUpSync` functions.
|
|
1549
|
-
*/
|
|
1526
|
+
* Options for the `findUp` and `findUpSync` functions.
|
|
1527
|
+
*/
|
|
1550
1528
|
type FindUpOptions = {
|
|
1551
1529
|
/**
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1530
|
+
* Whether to follow symbolic links.
|
|
1531
|
+
* @default undefined (behaves like `true` for `findUp`, `false` for `findUpSync` due to `fs.stat` vs `fs.lstat`)
|
|
1532
|
+
*/
|
|
1555
1533
|
allowSymlinks?: boolean;
|
|
1556
1534
|
/**
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1535
|
+
* The current working directory.
|
|
1536
|
+
* @default process.cwd()
|
|
1537
|
+
*/
|
|
1560
1538
|
cwd?: URL | string;
|
|
1561
1539
|
/**
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1540
|
+
* The directory to stop searching at.
|
|
1541
|
+
* @default path.parse(cwd).root
|
|
1542
|
+
*/
|
|
1565
1543
|
stopAt?: URL | string;
|
|
1566
1544
|
/**
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1545
|
+
* The type of path to find.
|
|
1546
|
+
* @default "file"
|
|
1547
|
+
*/
|
|
1570
1548
|
type?: "directory" | "file";
|
|
1571
1549
|
};
|
|
1572
1550
|
/**
|
|
1573
|
-
* The result type for the name matcher function used in `findUp`.
|
|
1574
|
-
* It can be a `PathLike` (string, Buffer, or URL), a Promise resolving to `PathLike` or `FIND_UP_STOP`,
|
|
1575
|
-
* `FIND_UP_STOP` to stop the search, or `undefined` to continue.
|
|
1576
|
-
*/
|
|
1551
|
+
* The result type for the name matcher function used in `findUp`.
|
|
1552
|
+
* It can be a `PathLike` (string, Buffer, or URL), a Promise resolving to `PathLike` or `FIND_UP_STOP`,
|
|
1553
|
+
* `FIND_UP_STOP` to stop the search, or `undefined` to continue.
|
|
1554
|
+
*/
|
|
1577
1555
|
type FindUpNameFnResult = PathLike | Promise<PathLike | typeof FIND_UP_STOP> | typeof FIND_UP_STOP | undefined;
|
|
1578
1556
|
/**
|
|
1579
|
-
* Specifies the name(s) of the file or directory to search for in `findUp`.
|
|
1580
|
-
* Can be a single name, an array of names, or a function that returns a name or `FIND_UP_STOP`.
|
|
1581
|
-
*/
|
|
1557
|
+
* Specifies the name(s) of the file or directory to search for in `findUp`.
|
|
1558
|
+
* Can be a single name, an array of names, or a function that returns a name or `FIND_UP_STOP`.
|
|
1559
|
+
*/
|
|
1582
1560
|
type FindUpName = string[] | string | ((directory: string) => FindUpNameFnResult);
|
|
1583
1561
|
/**
|
|
1584
|
-
* The result type for the name matcher function used in `findUpSync`.
|
|
1585
|
-
* It can be a `PathLike` (string, Buffer, or URL), `FIND_UP_STOP` to stop the search,
|
|
1586
|
-
* or `undefined` to continue.
|
|
1587
|
-
*/
|
|
1562
|
+
* The result type for the name matcher function used in `findUpSync`.
|
|
1563
|
+
* It can be a `PathLike` (string, Buffer, or URL), `FIND_UP_STOP` to stop the search,
|
|
1564
|
+
* or `undefined` to continue.
|
|
1565
|
+
*/
|
|
1588
1566
|
type FindUpNameSyncFnResult = PathLike | typeof FIND_UP_STOP | undefined;
|
|
1589
1567
|
/**
|
|
1590
|
-
* Specifies the name(s) of the file or directory to search for in `findUpSync`.
|
|
1591
|
-
* Can be a single name, an array of names, or a function that returns a name or `FIND_UP_STOP`.
|
|
1592
|
-
*/
|
|
1568
|
+
* Specifies the name(s) of the file or directory to search for in `findUpSync`.
|
|
1569
|
+
* Can be a single name, an array of names, or a function that returns a name or `FIND_UP_STOP`.
|
|
1570
|
+
*/
|
|
1593
1571
|
type FindUpNameSync = string[] | string | ((directory: string) => FindUpNameSyncFnResult);
|
|
1594
1572
|
/**
|
|
1595
|
-
* Options for operations that might require retries, like `emptyDir` or `remove`.
|
|
1596
|
-
*/
|
|
1573
|
+
* Options for operations that might require retries, like `emptyDir` or `remove`.
|
|
1574
|
+
*/
|
|
1597
1575
|
type RetryOptions = {
|
|
1598
1576
|
/**
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1577
|
+
* If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or
|
|
1578
|
+
* `EPERM` error is encountered, Node.js will retry the operation with a linear
|
|
1579
|
+
* backoff wait of `retryDelay` ms longer on each try. This option represents the
|
|
1580
|
+
* number of retries. This option is ignored if the `recursive` option is not
|
|
1581
|
+
* `true` for operations that support it (like `rm`).
|
|
1582
|
+
* @default 0
|
|
1583
|
+
*/
|
|
1606
1584
|
maxRetries?: number;
|
|
1607
1585
|
/**
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1586
|
+
* The amount of time in milliseconds to wait between retries.
|
|
1587
|
+
* This option is ignored if the `recursive` option is not `true` for operations that support it.
|
|
1588
|
+
* @default 100
|
|
1589
|
+
*/
|
|
1612
1590
|
retryDelay?: number;
|
|
1613
1591
|
};
|
|
1614
1592
|
/**
|
|
1615
|
-
* Options for reading YAML files.
|
|
1616
|
-
* Combines options from `yaml` library (DocumentOptions, ParseOptions, SchemaOptions, ToJSOptions)
|
|
1617
|
-
* and custom {@link ReadFileOptions}.
|
|
1618
|
-
*/
|
|
1593
|
+
* Options for reading YAML files.
|
|
1594
|
+
* Combines options from `yaml` library (DocumentOptions, ParseOptions, SchemaOptions, ToJSOptions)
|
|
1595
|
+
* and custom {@link ReadFileOptions}.
|
|
1596
|
+
*/
|
|
1619
1597
|
type ReadYamlOptions<C> = DocumentOptions & ParseOptions & ReadFileOptions<C> & SchemaOptions & ToJSOptions;
|
|
1620
1598
|
/**
|
|
1621
|
-
* Type for the `reviver` parameter used in YAML deserialization, similar to `JSON.parse`'s reviver.
|
|
1622
|
-
* A function that transforms the results. This function is called for each member of the object.
|
|
1623
|
-
* If a member contains nested objects, the nested objects are transformed before the parent object is.
|
|
1624
|
-
*/
|
|
1599
|
+
* Type for the `reviver` parameter used in YAML deserialization, similar to `JSON.parse`'s reviver.
|
|
1600
|
+
* A function that transforms the results. This function is called for each member of the object.
|
|
1601
|
+
* If a member contains nested objects, the nested objects are transformed before the parent object is.
|
|
1602
|
+
*/
|
|
1625
1603
|
type YamlReviver = (key: unknown, value: unknown) => unknown;
|
|
1626
1604
|
/**
|
|
1627
|
-
* Options for writing YAML files.
|
|
1628
|
-
* Extends {@link WriteFileOptions} and includes options from the `yaml` library for stringification.
|
|
1629
|
-
*/
|
|
1605
|
+
* Options for writing YAML files.
|
|
1606
|
+
* Extends {@link WriteFileOptions} and includes options from the `yaml` library for stringification.
|
|
1607
|
+
*/
|
|
1630
1608
|
type WriteYamlExtras = {
|
|
1631
1609
|
/**
|
|
1632
|
-
|
|
1633
|
-
|
|
1610
|
+
* Passed into `yaml.stringify` as the replacer argument.
|
|
1611
|
+
*/
|
|
1634
1612
|
replacer?: JsonReplacer;
|
|
1635
1613
|
/**
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1614
|
+
* Passed into `yaml.stringify` as the space argument for indentation.
|
|
1615
|
+
* Can be a number of spaces or a string (e.g., a tab character).
|
|
1616
|
+
*/
|
|
1639
1617
|
space?: number | string;
|
|
1640
1618
|
};
|
|
1641
1619
|
type WriteYamlOptions = CreateNodeOptions & DocumentOptions & ParseOptions & SchemaOptions & ToStringOptions & WriteFileOptions & WriteYamlExtras;
|
|
1642
1620
|
/**
|
|
1643
|
-
* Options for reading TOML files.
|
|
1644
|
-
* Uses `smol-toml`, which does not expose additional parse options.
|
|
1645
|
-
*/
|
|
1621
|
+
* Options for reading TOML files.
|
|
1622
|
+
* Uses `smol-toml`, which does not expose additional parse options.
|
|
1623
|
+
*/
|
|
1646
1624
|
type ReadTomlOptions<C> = ReadFileOptions<C>;
|
|
1647
1625
|
/**
|
|
1648
|
-
* Options for writing TOML files.
|
|
1649
|
-
* Extends {@link WriteFileOptions}. `smol-toml` does not expose additional stringify options.
|
|
1650
|
-
*/
|
|
1626
|
+
* Options for writing TOML files.
|
|
1627
|
+
* Extends {@link WriteFileOptions}. `smol-toml` does not expose additional stringify options.
|
|
1628
|
+
*/
|
|
1651
1629
|
type WriteTomlOptions = WriteFileOptions;
|
|
1652
1630
|
/**
|
|
1653
|
-
* Extra options for JSONC parsing on top of file-reading and code-frame options.
|
|
1654
|
-
*/
|
|
1631
|
+
* Extra options for JSONC parsing on top of file-reading and code-frame options.
|
|
1632
|
+
*/
|
|
1655
1633
|
type ReadJsoncExtras = {
|
|
1656
1634
|
/**
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1635
|
+
* A function to transform the string content before parsing.
|
|
1636
|
+
* @param source The raw string content of the file.
|
|
1637
|
+
* @returns The transformed string content.
|
|
1638
|
+
*/
|
|
1661
1639
|
beforeParse?: (source: string) => string;
|
|
1662
1640
|
};
|
|
1663
1641
|
/**
|
|
1664
|
-
* Options for reading JSONC (JSON with comments) files.
|
|
1665
|
-
* Combines options from `jsonc-parser` and custom {@link ReadFileOptions} and {@link CodeFrameOptions}.
|
|
1666
|
-
*/
|
|
1642
|
+
* Options for reading JSONC (JSON with comments) files.
|
|
1643
|
+
* Combines options from `jsonc-parser` and custom {@link ReadFileOptions} and {@link CodeFrameOptions}.
|
|
1644
|
+
*/
|
|
1667
1645
|
type ReadJsoncOptions<C> = CodeFrameOptions & JsoncParseOptions & ReadFileOptions<C> & ReadJsoncExtras;
|
|
1668
1646
|
/**
|
|
1669
|
-
* Options for writing JSONC files with optional comment preservation.
|
|
1670
|
-
* Extends {@link WriteFileOptions}.
|
|
1671
|
-
*/
|
|
1647
|
+
* Options for writing JSONC files with optional comment preservation.
|
|
1648
|
+
* Extends {@link WriteFileOptions}.
|
|
1649
|
+
*/
|
|
1672
1650
|
type WriteJsoncOptions = WriteFileOptions & {
|
|
1673
1651
|
/**
|
|
1674
|
-
|
|
1675
|
-
|
|
1652
|
+
* Detect indentation automatically if the file exists. Default: `false`.
|
|
1653
|
+
*/
|
|
1676
1654
|
detectIndent?: boolean;
|
|
1677
1655
|
/**
|
|
1678
|
-
|
|
1679
|
-
|
|
1656
|
+
* Formatting options forwarded to `jsonc-parser` when modifying existing files.
|
|
1657
|
+
*/
|
|
1680
1658
|
formattingOptions?: JsoncFormattingOptions;
|
|
1681
1659
|
/**
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1660
|
+
* Indentation used when writing a fresh file (no existing file to preserve).
|
|
1661
|
+
* Default: `"\t"`.
|
|
1662
|
+
*/
|
|
1685
1663
|
indent?: number | string;
|
|
1686
1664
|
/**
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1665
|
+
* When `true` and the file already exists, preserve existing comments and formatting
|
|
1666
|
+
* by computing a minimal diff against the new data via `jsonc-parser`'s `modify` API. Default: `true`.
|
|
1667
|
+
*/
|
|
1690
1668
|
preserveComments?: boolean;
|
|
1691
1669
|
/**
|
|
1692
|
-
|
|
1693
|
-
|
|
1670
|
+
* Passed into `JSON.stringify` when writing a fresh file.
|
|
1671
|
+
*/
|
|
1694
1672
|
replacer?: JsonReplacer;
|
|
1695
1673
|
};
|
|
1696
1674
|
/**
|
|
1697
|
-
* Type for the `reviver` parameter of `JSON5.parse()`.
|
|
1698
|
-
*/
|
|
1675
|
+
* Type for the `reviver` parameter of `JSON5.parse()`.
|
|
1676
|
+
*/
|
|
1699
1677
|
type Json5Reviver = (this: unknown, key: string, value: unknown) => unknown;
|
|
1700
1678
|
/**
|
|
1701
|
-
* Extra options for JSON5 parsing on top of file-reading and code-frame options.
|
|
1702
|
-
*/
|
|
1679
|
+
* Extra options for JSON5 parsing on top of file-reading and code-frame options.
|
|
1680
|
+
*/
|
|
1703
1681
|
type ReadJson5Extras = {
|
|
1704
1682
|
/**
|
|
1705
|
-
|
|
1706
|
-
|
|
1683
|
+
* A function to transform the string content before parsing.
|
|
1684
|
+
*/
|
|
1707
1685
|
beforeParse?: (source: string) => string;
|
|
1708
1686
|
};
|
|
1709
1687
|
/**
|
|
1710
|
-
* Options for reading JSON5 files.
|
|
1711
|
-
*/
|
|
1688
|
+
* Options for reading JSON5 files.
|
|
1689
|
+
*/
|
|
1712
1690
|
type ReadJson5Options<C> = CodeFrameOptions & ReadFileOptions<C> & ReadJson5Extras;
|
|
1713
1691
|
/**
|
|
1714
|
-
* Options for writing JSON5 files.
|
|
1715
|
-
* Extends {@link WriteFileOptions}.
|
|
1716
|
-
*/
|
|
1692
|
+
* Options for writing JSON5 files.
|
|
1693
|
+
* Extends {@link WriteFileOptions}.
|
|
1694
|
+
*/
|
|
1717
1695
|
type WriteJson5Options = WriteFileOptions & {
|
|
1718
1696
|
/**
|
|
1719
|
-
|
|
1720
|
-
|
|
1697
|
+
* Detect indentation automatically if the file exists. Default: `false`.
|
|
1698
|
+
*/
|
|
1721
1699
|
detectIndent?: boolean;
|
|
1722
1700
|
/**
|
|
1723
|
-
|
|
1724
|
-
|
|
1701
|
+
* Indentation for pretty-printing.
|
|
1702
|
+
*/
|
|
1725
1703
|
indent?: number | string;
|
|
1726
1704
|
/**
|
|
1727
|
-
|
|
1728
|
-
|
|
1705
|
+
* Override the quote character used for strings. See `JSON5.stringify`.
|
|
1706
|
+
*/
|
|
1729
1707
|
quote?: string;
|
|
1730
1708
|
/**
|
|
1731
|
-
|
|
1732
|
-
|
|
1709
|
+
* Passed into `JSON5.stringify`.
|
|
1710
|
+
*/
|
|
1733
1711
|
replacer?: Json5Replacer;
|
|
1734
1712
|
};
|
|
1735
1713
|
/**
|
|
1736
|
-
* Options for reading INI files.
|
|
1737
|
-
*/
|
|
1714
|
+
* Options for reading INI files.
|
|
1715
|
+
*/
|
|
1738
1716
|
type ReadIniOptions<C> = ReadFileOptions<C> & {
|
|
1739
1717
|
/**
|
|
1740
|
-
|
|
1741
|
-
|
|
1718
|
+
* Parse array values (keys ending with `[]`) into native arrays. Default: `true`.
|
|
1719
|
+
*/
|
|
1742
1720
|
bracketedArray?: boolean;
|
|
1743
1721
|
};
|
|
1744
1722
|
/**
|
|
1745
|
-
* Supported INI line-ending values.
|
|
1746
|
-
*/
|
|
1723
|
+
* Supported INI line-ending values.
|
|
1724
|
+
*/
|
|
1747
1725
|
type IniLineEnding = "\n" | "\r\n";
|
|
1748
1726
|
/**
|
|
1749
|
-
* Extra options for INI writing on top of the `ini` encoder options and file-writing options.
|
|
1750
|
-
*/
|
|
1727
|
+
* Extra options for INI writing on top of the `ini` encoder options and file-writing options.
|
|
1728
|
+
*/
|
|
1751
1729
|
type WriteIniExtras = {
|
|
1752
1730
|
/**
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1731
|
+
* Line ending to write. When omitted and {@link WriteIniOptions.preserveStyle | preserveStyle} is `true`,
|
|
1732
|
+
* the line ending is auto-detected from the existing file. Falls back to `"\n"` otherwise.
|
|
1733
|
+
*/
|
|
1756
1734
|
eol?: IniLineEnding;
|
|
1757
1735
|
/**
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1736
|
+
* When `true` and the file already exists, auto-detect and preserve styling described on this type.
|
|
1737
|
+
* Defaults to `true`. Explicit `whitespace` / `eol` values always win over detection.
|
|
1738
|
+
*/
|
|
1761
1739
|
preserveStyle?: boolean;
|
|
1762
1740
|
};
|
|
1763
1741
|
/**
|
|
1764
|
-
* Options for writing INI files.
|
|
1765
|
-
*
|
|
1766
|
-
* Extends {@link WriteFileOptions} and `ini`'s {@link IniEncodeOptions}. When an existing file is present and
|
|
1767
|
-
* {@link WriteIniOptions.preserveStyle | preserveStyle} is `true` (the default), the following styling is
|
|
1768
|
-
* detected from that file and applied unless overridden: space around `=` (via {@link IniEncodeOptions.whitespace | whitespace}),
|
|
1769
|
-
* line ending (via {@link WriteIniOptions.eol | eol}), and per-key original lines (including trailing
|
|
1770
|
-
* whitespace and inline `;` / `#` comments) for unchanged values.
|
|
1771
|
-
*/
|
|
1742
|
+
* Options for writing INI files.
|
|
1743
|
+
*
|
|
1744
|
+
* Extends {@link WriteFileOptions} and `ini`'s {@link IniEncodeOptions}. When an existing file is present and
|
|
1745
|
+
* {@link WriteIniOptions.preserveStyle | preserveStyle} is `true` (the default), the following styling is
|
|
1746
|
+
* detected from that file and applied unless overridden: space around `=` (via {@link IniEncodeOptions.whitespace | whitespace}),
|
|
1747
|
+
* line ending (via {@link WriteIniOptions.eol | eol}), and per-key original lines (including trailing
|
|
1748
|
+
* whitespace and inline `;` / `#` comments) for unchanged values.
|
|
1749
|
+
*/
|
|
1772
1750
|
type WriteIniOptions = IniEncodeOptions & WriteFileOptions & WriteIniExtras;
|
|
1773
1751
|
export { CodeFrameLocation as A, FIND_UP_STOP as B, CompressionType as C, F_OK as D, FindUpNameFnResult as E, FindUpName as F, GlobOptions as G, FindUpNameSyncFnResult as H, IniEncodeOptions as I, Json5Reviver as J, R_OK as K, ReadFileEncoding as L, W_OK as M, ReadIniOptions as R, WriteIniOptions as W, X_OK as X, YamlReviver as Y, IniLineEnding as a, ReadJson5Options as b, WriteJson5Options as c, Json5Replacer as d, ReadJsoncOptions as e, WriteJsoncOptions as f, JsoncFormattingOptions as g, JsoncParseOptions as h, ReadTomlOptions as i, WriteTomlOptions as j, CodeFrameOptions as k, JsonReviver as l, ReadYamlOptions as m, WriteYamlOptions as n, JsonReplacer as o, YamlReplacer as p, WalkOptions as q, FindUpOptions as r, FindUpNameSync as s, WalkEntry as t, ReadFileOptions as u, ContentType as v, ReadJsonOptions as w, RetryOptions as x, WriteFileOptions as y, WriteJsonOptions as z };
|