@reliverse/relifso 1.2.3 → 1.2.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/bin/impl/mkdirs.d.ts +6 -2
- package/bin/impl/mkdirs.js +10 -8
- package/bin/mod.d.ts +22 -2
- package/bin/mod.js +43 -3
- package/package.json +1 -1
package/bin/impl/mkdirs.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
1
|
+
export interface MakeDirectoryOptions {
|
|
2
|
+
recursive?: boolean;
|
|
3
|
+
mode?: number | string;
|
|
4
|
+
}
|
|
5
|
+
export declare function mkdirsSync(dir: string, options?: MakeDirectoryOptions): string | undefined;
|
|
6
|
+
export declare function mkdirs(dir: string, options?: MakeDirectoryOptions): Promise<string | undefined>;
|
package/bin/impl/mkdirs.js
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { mkdirSync, existsSync } from "node:fs";
|
|
2
2
|
import { mkdir, stat } from "node:fs/promises";
|
|
3
|
-
export function mkdirsSync(dir) {
|
|
3
|
+
export function mkdirsSync(dir, options) {
|
|
4
4
|
if (existsSync(dir)) {
|
|
5
5
|
return;
|
|
6
6
|
}
|
|
7
|
-
return mkdirSync(dir, { recursive: true });
|
|
7
|
+
return mkdirSync(dir, { recursive: true, mode: options?.mode });
|
|
8
8
|
}
|
|
9
|
-
export async function mkdirs(dir) {
|
|
9
|
+
export async function mkdirs(dir, options) {
|
|
10
10
|
try {
|
|
11
|
-
await stat(dir);
|
|
12
|
-
|
|
11
|
+
const dirStat = await stat(dir);
|
|
12
|
+
if (dirStat.isDirectory()) {
|
|
13
|
+
return void 0;
|
|
14
|
+
}
|
|
13
15
|
} catch (error) {
|
|
14
|
-
if (error.code
|
|
15
|
-
|
|
16
|
+
if (error.code !== "ENOENT") {
|
|
17
|
+
throw error;
|
|
16
18
|
}
|
|
17
|
-
throw error;
|
|
18
19
|
}
|
|
20
|
+
return mkdir(dir, { recursive: true, mode: options?.mode });
|
|
19
21
|
}
|
package/bin/mod.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Stats } from "node:fs";
|
|
2
|
-
import {
|
|
2
|
+
import { accessSync, constants, readdirSync, statSync, copyFileSync } from "node:fs";
|
|
3
|
+
import { readdir as nodeReaddirInternal, stat as nodeStatInternal, readdir, stat, access, copyFile } from "node:fs/promises";
|
|
3
4
|
import type { DiveOptions } from "./impl/dive.js";
|
|
4
5
|
import { copy, copySync } from "./impl/copy.js";
|
|
5
6
|
import { createFile, createFileSync } from "./impl/create-file.js";
|
|
@@ -27,13 +28,19 @@ declare const ensureDirSync: typeof mkdirsSync;
|
|
|
27
28
|
declare const ensureFileSync: typeof createFileSync;
|
|
28
29
|
declare const rimrafSync: typeof removeSync;
|
|
29
30
|
declare const ncpSync: typeof copySync;
|
|
31
|
+
declare const mkdir: typeof mkdirs;
|
|
32
|
+
declare const mkdirSync: typeof mkdirsSync;
|
|
33
|
+
declare const unlink: typeof remove;
|
|
34
|
+
declare const unlinkSync: typeof removeSync;
|
|
35
|
+
declare const rename: typeof move;
|
|
36
|
+
declare const renameSync: typeof moveSync;
|
|
30
37
|
export type { CopyOptions } from "./impl/copy.js";
|
|
31
38
|
export type { MoveOptions } from "./impl/move.js";
|
|
32
39
|
export type { ReadFileOptions } from "./impl/read-file.js";
|
|
33
40
|
export type { ReadJsonOptions } from "./impl/read-json.js";
|
|
34
41
|
export type { JsonStringifyOptions } from "./impl/write-json.js";
|
|
35
42
|
export type { WriteJsonOptions } from "./impl/write-json.js";
|
|
36
|
-
export { readJson, writeJson, createFile, writeFile, readFile, mkdirs, emptyDir, pathExists, copy, move, remove, readdir, stat, readJsonSync, writeJsonSync, createFileSync, writeFileSync, readFileSync, mkdirsSync, emptyDirSync, pathExistsSync, copySync, moveSync, removeSync, mkdirp, mkdirpSync, rimraf, rimrafSync, ncp, ncpSync, ensureDir, ensureDirSync, ensureFile, ensureFileSync, outputJson, outputJsonSync, outputFile, outputFileSync, diveSync, };
|
|
43
|
+
export { readJson, writeJson, createFile, writeFile, readFile, mkdirs, emptyDir, pathExists, copy, move, remove, readdir, stat, access, copyFile, readJsonSync, writeJsonSync, createFileSync, writeFileSync, readFileSync, mkdirsSync, emptyDirSync, pathExistsSync, copySync, moveSync, removeSync, readdirSync, statSync, accessSync, constants, copyFileSync, mkdirp, mkdirpSync, rimraf, rimrafSync, ncp, ncpSync, ensureDir, ensureDirSync, ensureFile, ensureFileSync, outputJson, outputJsonSync, outputFile, outputFileSync, diveSync, mkdir, mkdirSync, unlink, unlinkSync, rename, renameSync, };
|
|
37
44
|
declare const fs: {
|
|
38
45
|
readJson: typeof readJson;
|
|
39
46
|
writeJson: typeof writeJson;
|
|
@@ -48,6 +55,8 @@ declare const fs: {
|
|
|
48
55
|
remove: typeof remove;
|
|
49
56
|
readdir: typeof nodeReaddirInternal;
|
|
50
57
|
stat: typeof nodeStatInternal;
|
|
58
|
+
access: typeof access;
|
|
59
|
+
copyFile: typeof copyFile;
|
|
51
60
|
readJsonSync: typeof readJsonSync;
|
|
52
61
|
writeJsonSync: typeof writeJsonSync;
|
|
53
62
|
createFileSync: typeof createFileSync;
|
|
@@ -59,6 +68,11 @@ declare const fs: {
|
|
|
59
68
|
copySync: typeof copySync;
|
|
60
69
|
moveSync: typeof moveSync;
|
|
61
70
|
removeSync: typeof removeSync;
|
|
71
|
+
readdirSync: typeof readdirSync;
|
|
72
|
+
statSync: import("fs").StatSyncFn;
|
|
73
|
+
accessSync: typeof accessSync;
|
|
74
|
+
constants: typeof constants;
|
|
75
|
+
copyFileSync: typeof copyFileSync;
|
|
62
76
|
mkdirp: typeof mkdirs;
|
|
63
77
|
mkdirpSync: typeof mkdirsSync;
|
|
64
78
|
rimraf: typeof remove;
|
|
@@ -75,5 +89,11 @@ declare const fs: {
|
|
|
75
89
|
outputFileSync: typeof outputFileSync;
|
|
76
90
|
dive: typeof dive;
|
|
77
91
|
diveSync: typeof diveSync;
|
|
92
|
+
mkdir: typeof mkdirs;
|
|
93
|
+
mkdirSync: typeof mkdirsSync;
|
|
94
|
+
unlink: typeof remove;
|
|
95
|
+
unlinkSync: typeof removeSync;
|
|
96
|
+
rename: typeof move;
|
|
97
|
+
renameSync: typeof moveSync;
|
|
78
98
|
};
|
|
79
99
|
export default fs;
|
package/bin/mod.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { accessSync, constants, readdirSync, statSync, copyFileSync } from "node:fs";
|
|
2
|
+
import {
|
|
3
|
+
readdir as nodeReaddirInternal,
|
|
4
|
+
stat as nodeStatInternal,
|
|
5
|
+
readdir,
|
|
6
|
+
stat,
|
|
7
|
+
access,
|
|
8
|
+
copyFile
|
|
9
|
+
} from "node:fs/promises";
|
|
2
10
|
import { join as pathJoin } from "node:path";
|
|
3
11
|
import { copy, copySync } from "./impl/copy.js";
|
|
4
12
|
import { createFile, createFileSync } from "./impl/create-file.js";
|
|
@@ -101,6 +109,12 @@ const ensureDirSync = mkdirsSync;
|
|
|
101
109
|
const ensureFileSync = createFileSync;
|
|
102
110
|
const rimrafSync = removeSync;
|
|
103
111
|
const ncpSync = copySync;
|
|
112
|
+
const mkdir = mkdirs;
|
|
113
|
+
const mkdirSync = mkdirsSync;
|
|
114
|
+
const unlink = remove;
|
|
115
|
+
const unlinkSync = removeSync;
|
|
116
|
+
const rename = move;
|
|
117
|
+
const renameSync = moveSync;
|
|
104
118
|
export {
|
|
105
119
|
readJson,
|
|
106
120
|
writeJson,
|
|
@@ -115,6 +129,8 @@ export {
|
|
|
115
129
|
remove,
|
|
116
130
|
readdir,
|
|
117
131
|
stat,
|
|
132
|
+
access,
|
|
133
|
+
copyFile,
|
|
118
134
|
readJsonSync,
|
|
119
135
|
writeJsonSync,
|
|
120
136
|
createFileSync,
|
|
@@ -126,6 +142,11 @@ export {
|
|
|
126
142
|
copySync,
|
|
127
143
|
moveSync,
|
|
128
144
|
removeSync,
|
|
145
|
+
readdirSync,
|
|
146
|
+
statSync,
|
|
147
|
+
accessSync,
|
|
148
|
+
constants,
|
|
149
|
+
copyFileSync,
|
|
129
150
|
mkdirp,
|
|
130
151
|
mkdirpSync,
|
|
131
152
|
rimraf,
|
|
@@ -140,7 +161,13 @@ export {
|
|
|
140
161
|
outputJsonSync,
|
|
141
162
|
outputFile,
|
|
142
163
|
outputFileSync,
|
|
143
|
-
diveSync
|
|
164
|
+
diveSync,
|
|
165
|
+
mkdir,
|
|
166
|
+
mkdirSync,
|
|
167
|
+
unlink,
|
|
168
|
+
unlinkSync,
|
|
169
|
+
rename,
|
|
170
|
+
renameSync
|
|
144
171
|
};
|
|
145
172
|
const fs = {
|
|
146
173
|
// async methods
|
|
@@ -157,6 +184,8 @@ const fs = {
|
|
|
157
184
|
remove,
|
|
158
185
|
readdir,
|
|
159
186
|
stat,
|
|
187
|
+
access,
|
|
188
|
+
copyFile,
|
|
160
189
|
// sync methods
|
|
161
190
|
readJsonSync,
|
|
162
191
|
writeJsonSync,
|
|
@@ -169,6 +198,11 @@ const fs = {
|
|
|
169
198
|
copySync,
|
|
170
199
|
moveSync,
|
|
171
200
|
removeSync,
|
|
201
|
+
readdirSync,
|
|
202
|
+
statSync,
|
|
203
|
+
accessSync,
|
|
204
|
+
constants,
|
|
205
|
+
copyFileSync,
|
|
172
206
|
// alias
|
|
173
207
|
mkdirp,
|
|
174
208
|
mkdirpSync,
|
|
@@ -185,6 +219,12 @@ const fs = {
|
|
|
185
219
|
outputFile,
|
|
186
220
|
outputFileSync,
|
|
187
221
|
dive,
|
|
188
|
-
diveSync
|
|
222
|
+
diveSync,
|
|
223
|
+
mkdir,
|
|
224
|
+
mkdirSync,
|
|
225
|
+
unlink,
|
|
226
|
+
unlinkSync,
|
|
227
|
+
rename,
|
|
228
|
+
renameSync
|
|
189
229
|
};
|
|
190
230
|
export default fs;
|