@reliverse/relifso 1.3.1 → 1.4.1
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/LICENSES +16 -0
- package/README.md +106 -20
- package/bin/impl/bun.d.ts +11 -0
- package/bin/impl/bun.js +23 -0
- package/bin/impl/{node/copy.d.ts → copy.d.ts} +15 -3
- package/bin/impl/copy.js +229 -0
- package/bin/impl/create.d.ts +34 -0
- package/bin/impl/create.js +54 -0
- package/bin/impl/{node/dive.d.ts → dive.d.ts} +10 -0
- package/bin/impl/dive.js +145 -0
- package/bin/impl/empty.d.ts +28 -0
- package/bin/impl/empty.js +75 -0
- package/bin/impl/extras.d.ts +35 -0
- package/bin/impl/extras.js +112 -0
- package/bin/impl/json-utils.d.ts +30 -0
- package/bin/impl/json-utils.js +46 -0
- package/bin/impl/{node/mkdirs.js → mkdirs.js} +10 -3
- package/bin/impl/{node/move.d.ts → move.d.ts} +10 -0
- package/bin/impl/move.js +140 -0
- package/bin/impl/{node/output-file.d.ts → output-file.d.ts} +3 -2
- package/bin/impl/{node/output-json.d.ts → output-json.d.ts} +7 -2
- package/bin/impl/output-json.js +77 -0
- package/bin/impl/read-file.d.ts +31 -0
- package/bin/impl/read-file.js +165 -0
- package/bin/impl/{node/read-json.d.ts → read-json.d.ts} +9 -0
- package/bin/impl/read-json.js +241 -0
- package/bin/impl/stats.d.ts +31 -0
- package/bin/impl/stats.js +141 -0
- package/bin/impl/write-file.d.ts +31 -0
- package/bin/impl/write-file.js +257 -0
- package/bin/impl/write-json.d.ts +41 -0
- package/bin/impl/write-json.js +135 -0
- package/bin/mod.d.ts +89 -57
- package/bin/mod.js +131 -164
- package/bin/utils/json/helpers/JSONRepairError.d.ts +4 -0
- package/bin/utils/json/helpers/JSONRepairError.js +7 -0
- package/bin/utils/json/helpers/JsonSchemaError.d.ts +6 -0
- package/bin/utils/json/helpers/JsonSchemaError.js +6 -0
- package/bin/utils/json/helpers/stringUtils.d.ts +64 -0
- package/bin/utils/json/helpers/stringUtils.js +87 -0
- package/bin/utils/json/regular/jsonc.d.ts +45 -0
- package/bin/utils/json/regular/jsonc.js +88 -0
- package/bin/utils/json/regular/jsonrepair.d.ts +17 -0
- package/bin/utils/json/regular/jsonrepair.js +576 -0
- package/bin/utils/json/regular/validate.d.ts +22 -0
- package/bin/utils/json/regular/validate.js +52 -0
- package/bin/utils/json/stream/JsonStreamError.d.ts +6 -0
- package/bin/utils/json/stream/JsonStreamError.js +6 -0
- package/bin/utils/json/stream/buffer/InputBuffer.d.ts +13 -0
- package/bin/utils/json/stream/buffer/InputBuffer.js +68 -0
- package/bin/utils/json/stream/buffer/OutputBuffer.d.ts +17 -0
- package/bin/utils/json/stream/buffer/OutputBuffer.js +101 -0
- package/bin/utils/json/stream/core.d.ts +10 -0
- package/bin/utils/json/stream/core.js +695 -0
- package/bin/utils/json/stream/jsonl.d.ts +21 -0
- package/bin/utils/json/stream/jsonl.js +55 -0
- package/bin/utils/json/stream/parser.d.ts +14 -0
- package/bin/utils/json/stream/parser.js +81 -0
- package/bin/utils/json/stream/stack.d.ts +19 -0
- package/bin/utils/json/stream/stack.js +43 -0
- package/bin/utils/json/stream/stream.d.ts +6 -0
- package/bin/utils/json/stream/stream.js +30 -0
- package/bin/utils/json/stream/writer.d.ts +14 -0
- package/bin/utils/json/stream/writer.js +44 -0
- package/bin/utils/log.d.ts +1 -0
- package/bin/utils/log.js +7 -0
- package/package.json +4 -3
- package/bin/impl/node/copy.js +0 -94
- package/bin/impl/node/create-file.d.ts +0 -2
- package/bin/impl/node/create-file.js +0 -21
- package/bin/impl/node/dive.js +0 -56
- package/bin/impl/node/empty-dir.d.ts +0 -2
- package/bin/impl/node/empty-dir.js +0 -24
- package/bin/impl/node/move.js +0 -93
- package/bin/impl/node/output-json.js +0 -15
- package/bin/impl/node/read-file.d.ts +0 -30
- package/bin/impl/node/read-file.js +0 -30
- package/bin/impl/node/read-json.js +0 -50
- package/bin/impl/node/write-file.d.ts +0 -20
- package/bin/impl/node/write-file.js +0 -23
- package/bin/impl/node/write-json.d.ts +0 -28
- package/bin/impl/node/write-json.js +0 -22
- package/bin/impl/utils/additional.d.ts +0 -15
- package/bin/impl/utils/additional.js +0 -47
- /package/bin/impl/{node/mkdirs.d.ts → mkdirs.d.ts} +0 -0
- /package/bin/impl/{node/output-file.js → output-file.js} +0 -0
- /package/bin/impl/{node/path-exists.d.ts → path-exists.d.ts} +0 -0
- /package/bin/impl/{node/path-exists.js → path-exists.js} +0 -0
- /package/bin/impl/{node/remove.d.ts → remove.d.ts} +0 -0
- /package/bin/impl/{node/remove.js → remove.js} +0 -0
package/bin/mod.d.ts
CHANGED
|
@@ -1,31 +1,37 @@
|
|
|
1
|
-
import type { Stats } from "node:fs";
|
|
2
1
|
import { renameSync as nodeRenameSync, unlinkSync as nodeUnlinkSync, accessSync, constants, readdirSync, statSync, copyFileSync, appendFileSync, chmodSync, chownSync, closeSync, createReadStream, createWriteStream, fchmodSync, fchownSync, fdatasyncSync, fstatSync, fsyncSync, ftruncateSync, futimesSync, lchmodSync, lchownSync, linkSync, lstatSync, lutimesSync, mkdtempSync, openSync, opendirSync, readSync, readlinkSync, realpathSync, rmSync, rmdirSync, statfsSync, symlinkSync, truncateSync, unwatchFile, utimesSync, watchFile, writeFileSync, writeSync, readvSync, writevSync } from "node:fs";
|
|
3
|
-
import {
|
|
2
|
+
import { rename as nodeRename, unlink as nodeUnlink, access, appendFile, chmod, chown, copyFile, lchmod, lchown, link, lstat, lutimes, mkdtemp, open, opendir, readdir, readlink, realpath, rm, rmdir, stat, statfs, symlink, truncate, utimes, watch, writeFile } from "node:fs/promises";
|
|
4
3
|
import { resolve } from "node:path";
|
|
5
|
-
import
|
|
6
|
-
import { copy, copySync } from "./impl/
|
|
7
|
-
import { createFile, createFileSync } from "./impl/
|
|
8
|
-
import { diveSync } from "./impl/
|
|
9
|
-
import { emptyDir, emptyDirSync } from "./impl/
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
4
|
+
import { getFileBun, getFileTypeBun, isBun } from "./impl/bun";
|
|
5
|
+
import { copy, copySync } from "./impl/copy";
|
|
6
|
+
import { createFile, createFileSync, createDir, createDirs, createFiles, createDirSync, createDirsSync, createFilesSync } from "./impl/create";
|
|
7
|
+
import { dive, diveSync } from "./impl/dive";
|
|
8
|
+
import { emptyDir, emptyDirSync, emptyObject, emptyFile, emptyFileSync } from "./impl/empty";
|
|
9
|
+
import { readText, readTextSync, readLines, readLinesSync, isDirectory, isDirectorySync, isSymlink, isSymlinkSync, execAsync, isDirectoryEmpty, isHiddenAttribute, rmEnsureDir, setHiddenAttribute } from "./impl/extras";
|
|
10
|
+
import { validateAndRepairJson } from "./impl/json-utils";
|
|
11
|
+
import { mkdirs, mkdirsSync } from "./impl/mkdirs";
|
|
12
|
+
import { move, moveSync } from "./impl/move";
|
|
13
|
+
import { outputFile, outputFileSync } from "./impl/output-file";
|
|
14
|
+
import { outputJson, outputJsonSync } from "./impl/output-json";
|
|
15
|
+
import { pathExists, pathExistsSync } from "./impl/path-exists";
|
|
16
|
+
import { readFile, readFileSync } from "./impl/read-file";
|
|
17
|
+
import { readJson, readJsonSync } from "./impl/read-json";
|
|
18
|
+
import { remove, removeSync } from "./impl/remove";
|
|
19
|
+
import { getFileExists, getFileLastModified, getFileSize, getStats, getStatsSync, toNodeStats } from "./impl/stats";
|
|
20
|
+
import { writeJson, writeJsonSync } from "./impl/write-json";
|
|
21
|
+
import { JSONRepairError } from "./utils/json/helpers/JSONRepairError";
|
|
22
|
+
import { JsonSchemaError } from "./utils/json/helpers/JsonSchemaError";
|
|
23
|
+
import { extractComments } from "./utils/json/regular/jsonc";
|
|
24
|
+
import { jsonrepair } from "./utils/json/regular/jsonrepair";
|
|
25
|
+
import { validateJson } from "./utils/json/regular/validate";
|
|
26
|
+
import { createInputBuffer } from "./utils/json/stream/buffer/InputBuffer";
|
|
27
|
+
import { createOutputBuffer } from "./utils/json/stream/buffer/OutputBuffer";
|
|
28
|
+
import { jsonrepairCore } from "./utils/json/stream/core";
|
|
29
|
+
import { createJsonlParser } from "./utils/json/stream/jsonl";
|
|
30
|
+
import { createJsonlWriter } from "./utils/json/stream/jsonl";
|
|
31
|
+
import { JsonStreamError } from "./utils/json/stream/JsonStreamError";
|
|
32
|
+
import { createJsonStreamParser } from "./utils/json/stream/parser";
|
|
33
|
+
import { jsonrepairTransform } from "./utils/json/stream/stream";
|
|
34
|
+
import { createJsonStreamWriter } from "./utils/json/stream/writer";
|
|
29
35
|
declare const mkdirp: typeof mkdirs;
|
|
30
36
|
declare const ensureDir: typeof mkdirs;
|
|
31
37
|
declare const ensureFile: typeof createFile;
|
|
@@ -52,33 +58,24 @@ declare const cp: typeof copy;
|
|
|
52
58
|
declare const cpSync: typeof copySync;
|
|
53
59
|
declare const exists: typeof pathExists;
|
|
54
60
|
declare const existsSync: typeof pathExistsSync;
|
|
55
|
-
declare
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
declare function isSymlink(filePath: string): Promise<boolean>;
|
|
74
|
-
declare function isSymlinkSync(filePath: string): boolean;
|
|
75
|
-
export type { CopyOptions } from "./impl/node/copy.js";
|
|
76
|
-
export type { MoveOptions } from "./impl/node/move.js";
|
|
77
|
-
export type { ReadFileOptions } from "./impl/node/read-file.js";
|
|
78
|
-
export type { ReadJsonOptions } from "./impl/node/read-json.js";
|
|
79
|
-
export type { JsonStringifyOptions } from "./impl/node/write-json.js";
|
|
80
|
-
export type { WriteJsonOptions } from "./impl/node/write-json.js";
|
|
81
|
-
export { accessSync, appendFileSync, chmodSync, chownSync, closeSync, copyFileSync, createReadStream, createWriteStream, fchmodSync, fchownSync, fdatasyncSync, fstatSync, fsyncSync, ftruncateSync, futimesSync, lchmodSync, lchownSync, linkSync, lstatSync, lutimesSync, mkdtempSync, openSync, opendirSync, readFileSync, readlinkSync, readSync, readdirSync, realpathSync, nodeRenameSync, rmSync, rmdirSync, statSync, statfsSync, symlinkSync, truncateSync, nodeUnlinkSync, unwatchFile, utimesSync, watchFile, writeFileSync, writeSync, readvSync, writevSync, readJsonSync, writeJsonSync, createFileSync, mkdirsSync, emptyDirSync, pathExistsSync, copySync, moveSync, removeSync, outputJsonSync, outputFileSync, diveSync, cpSync, ensureDirSync as ensuredirSync, ensureDirSync, ensureFileSync, existsSync, mkdirpSync, mkdirSync, ncpSync, outputJSONSync, readJSONSync, renameSync, rimrafSync, unlinkSync, writeJSONSync, isDirectorySync, isSymlinkSync, readLinesSync, readTextSync, readJson, writeJson, createFile, mkdirs, emptyDir, pathExists, copy, move, remove, outputJson, outputFile, access, appendFile, chmod, chown, copyFile, lchmod, lchown, link, lstat, lutimes, mkdtemp, open, opendir, readFile, readdir, readlink, realpath, nodeRename, rm, rmdir, stat, statfs, symlink, truncate, nodeUnlink, utimes, watch, writeFile, constants, cp, ensureDir as ensuredir, ensureDir, ensureFile, exists, mkdir, mkdirp, ncp, outputJSON, readJSON, rename, resolve, rimraf, unlink, writeJSON, isDirectory, isSymlink, readLines, readText, execAsync, setHiddenAttributeOnWindows, isHidden, isDirectoryEmpty, rmEnsureDir, };
|
|
61
|
+
declare const jsonRepairRegular: typeof jsonrepair;
|
|
62
|
+
export type { CopyOptions } from "./impl/copy";
|
|
63
|
+
export type { MoveOptions } from "./impl/move";
|
|
64
|
+
export type { ReadFileOptions } from "./impl/read-file";
|
|
65
|
+
export type { ReadJsonOptions } from "./impl/read-json";
|
|
66
|
+
export type { JsonStringifyOptions } from "./impl/write-json";
|
|
67
|
+
export type { WriteJsonOptions } from "./impl/write-json";
|
|
68
|
+
export type { WriteFileOptions } from "./impl/write-file";
|
|
69
|
+
export type { DiveOptions } from "./impl/dive";
|
|
70
|
+
export type { JsonRepairTransformOptions } from "./utils/json/stream/stream";
|
|
71
|
+
export type { OutputJsonOptions } from "./impl/output-json";
|
|
72
|
+
export type { JSONSchema } from "./utils/json/regular/validate";
|
|
73
|
+
export type { InputBuffer } from "./utils/json/stream/buffer/InputBuffer";
|
|
74
|
+
export type { OutputBuffer, OutputBufferOptions } from "./utils/json/stream/buffer/OutputBuffer";
|
|
75
|
+
export type { JsonRepairCoreOptions, JsonRepairCore } from "./utils/json/stream/core";
|
|
76
|
+
export type { Text } from "./utils/json/helpers/stringUtils";
|
|
77
|
+
export type { JsoncParseOptions, JsoncStringifyOptions } from "./utils/json/regular/jsonc";
|
|
78
|
+
export { accessSync, appendFileSync, chmodSync, chownSync, closeSync, copyFileSync, createReadStream, createWriteStream, fchmodSync, fchownSync, fdatasyncSync, fstatSync, fsyncSync, ftruncateSync, futimesSync, lchmodSync, lchownSync, linkSync, lstatSync, lutimesSync, mkdtempSync, openSync, opendirSync, readFileSync, readlinkSync, readSync, readdirSync, realpathSync, nodeRenameSync, rmSync, rmdirSync, statSync, statfsSync, symlinkSync, truncateSync, nodeUnlinkSync, unwatchFile, utimesSync, watchFile, writeFileSync, writeSync, readvSync, writevSync, readJsonSync, writeJsonSync, createFileSync, createDirSync, createDirsSync, createFilesSync, emptyFileSync, mkdirsSync, emptyDirSync, pathExistsSync, copySync, moveSync, removeSync, outputJsonSync, outputFileSync, diveSync, cpSync, ensureDirSync as ensuredirSync, ensureDirSync, ensureFileSync, existsSync, mkdirpSync, mkdirSync, ncpSync, outputJSONSync, readJSONSync, renameSync, rimrafSync, unlinkSync, writeJSONSync, isDirectorySync, isSymlinkSync, readLinesSync, readTextSync, readJson, writeJson, createFile, createDir, createDirs, createFiles, emptyFile, mkdirs, emptyDir, pathExists, copy, move, remove, outputJson, outputFile, access, appendFile, chmod, chown, copyFile, lchmod, lchown, link, lstat, lutimes, mkdtemp, open, opendir, readFile, readdir, readlink, realpath, nodeRename, rm, rmdir, stat, statfs, symlink, truncate, nodeUnlink, utimes, watch, writeFile, constants, cp, ensureDir as ensuredir, ensureDir, ensureFile, exists, mkdir, mkdirp, ncp, outputJSON, readJSON, rename, resolve, rimraf, unlink, writeJSON, isDirectory, isSymlink, readLines, readText, execAsync, setHiddenAttribute, isHiddenAttribute, isDirectoryEmpty, rmEnsureDir, dive, getFileExists, getFileLastModified, getFileSize, getStats, getStatsSync, emptyObject, getFileBun, getFileTypeBun, toNodeStats, isBun, jsonrepair, jsonRepairRegular, createInputBuffer, createOutputBuffer, jsonrepairCore, JSONRepairError, jsonrepairTransform, validateAndRepairJson, validateJson, JsonSchemaError, createJsonStreamParser, createJsonStreamWriter, JsonStreamError, createJsonlParser, createJsonlWriter, extractComments, };
|
|
82
79
|
declare const fs: {
|
|
83
80
|
accessSync: typeof accessSync;
|
|
84
81
|
appendFileSync: typeof appendFileSync;
|
|
@@ -126,6 +123,10 @@ declare const fs: {
|
|
|
126
123
|
readJsonSync: typeof readJsonSync;
|
|
127
124
|
writeJsonSync: typeof writeJsonSync;
|
|
128
125
|
createFileSync: typeof createFileSync;
|
|
126
|
+
createDirSync: typeof createDirSync;
|
|
127
|
+
createDirsSync: typeof createDirsSync;
|
|
128
|
+
createFilesSync: typeof createFilesSync;
|
|
129
|
+
emptyFileSync: typeof emptyFileSync;
|
|
129
130
|
mkdirsSync: typeof mkdirsSync;
|
|
130
131
|
emptyDirSync: typeof emptyDirSync;
|
|
131
132
|
pathExistsSync: typeof pathExistsSync;
|
|
@@ -156,6 +157,10 @@ declare const fs: {
|
|
|
156
157
|
readJson: typeof readJson;
|
|
157
158
|
writeJson: typeof writeJson;
|
|
158
159
|
createFile: typeof createFile;
|
|
160
|
+
createDir: typeof createDir;
|
|
161
|
+
createDirs: typeof createDirs;
|
|
162
|
+
createFiles: typeof createFiles;
|
|
163
|
+
emptyFile: typeof emptyFile;
|
|
159
164
|
mkdirs: typeof mkdirs;
|
|
160
165
|
emptyDir: typeof emptyDir;
|
|
161
166
|
pathExists: typeof pathExists;
|
|
@@ -178,13 +183,13 @@ declare const fs: {
|
|
|
178
183
|
open: typeof open;
|
|
179
184
|
opendir: typeof opendir;
|
|
180
185
|
readFile: typeof readFile;
|
|
181
|
-
readdir: typeof
|
|
186
|
+
readdir: typeof readdir;
|
|
182
187
|
readlink: typeof readlink;
|
|
183
188
|
realpath: typeof realpath;
|
|
184
189
|
nodeRename: typeof nodeRename;
|
|
185
190
|
rm: typeof rm;
|
|
186
191
|
rmdir: typeof rmdir;
|
|
187
|
-
stat: typeof
|
|
192
|
+
stat: typeof stat;
|
|
188
193
|
statfs: typeof statfs;
|
|
189
194
|
symlink: typeof symlink;
|
|
190
195
|
truncate: typeof truncate;
|
|
@@ -213,9 +218,36 @@ declare const fs: {
|
|
|
213
218
|
readLines: typeof readLines;
|
|
214
219
|
readText: typeof readText;
|
|
215
220
|
execAsync: typeof import("child_process").exec.__promisify__;
|
|
216
|
-
|
|
217
|
-
|
|
221
|
+
setHiddenAttribute: typeof setHiddenAttribute;
|
|
222
|
+
isHiddenAttribute: typeof isHiddenAttribute;
|
|
218
223
|
isDirectoryEmpty: typeof isDirectoryEmpty;
|
|
219
224
|
rmEnsureDir: typeof rmEnsureDir;
|
|
225
|
+
dive: typeof dive;
|
|
226
|
+
getFileExists: typeof getFileExists;
|
|
227
|
+
getFileLastModified: typeof getFileLastModified;
|
|
228
|
+
getFileSize: typeof getFileSize;
|
|
229
|
+
getStats: typeof getStats;
|
|
230
|
+
getStatsSync: typeof getStatsSync;
|
|
231
|
+
emptyObject: typeof emptyObject;
|
|
232
|
+
getFileBun: typeof getFileBun;
|
|
233
|
+
getFileTypeBun: typeof getFileTypeBun;
|
|
234
|
+
toNodeStats: typeof toNodeStats;
|
|
235
|
+
isBun: string | false;
|
|
236
|
+
jsonrepair: typeof jsonrepair;
|
|
237
|
+
jsonRepairRegular: typeof jsonrepair;
|
|
238
|
+
createInputBuffer: typeof createInputBuffer;
|
|
239
|
+
createOutputBuffer: typeof createOutputBuffer;
|
|
240
|
+
jsonrepairCore: typeof jsonrepairCore;
|
|
241
|
+
JSONRepairError: typeof JSONRepairError;
|
|
242
|
+
jsonrepairTransform: typeof jsonrepairTransform;
|
|
243
|
+
validateAndRepairJson: typeof validateAndRepairJson;
|
|
244
|
+
validateJson: typeof validateJson;
|
|
245
|
+
JsonSchemaError: typeof JsonSchemaError;
|
|
246
|
+
createJsonStreamParser: typeof createJsonStreamParser;
|
|
247
|
+
createJsonStreamWriter: typeof createJsonStreamWriter;
|
|
248
|
+
JsonStreamError: typeof JsonStreamError;
|
|
249
|
+
createJsonlParser: typeof createJsonlParser;
|
|
250
|
+
createJsonlWriter: typeof createJsonlWriter;
|
|
251
|
+
extractComments: typeof extractComments;
|
|
220
252
|
};
|
|
221
253
|
export default fs;
|
package/bin/mod.js
CHANGED
|
@@ -44,8 +44,6 @@ import {
|
|
|
44
44
|
writevSync
|
|
45
45
|
} from "node:fs";
|
|
46
46
|
import {
|
|
47
|
-
readdir as nodeReaddirInternal,
|
|
48
|
-
stat as nodeStatInternal,
|
|
49
47
|
rename as nodeRename,
|
|
50
48
|
unlink as nodeUnlink,
|
|
51
49
|
access,
|
|
@@ -74,104 +72,61 @@ import {
|
|
|
74
72
|
watch,
|
|
75
73
|
writeFile
|
|
76
74
|
} from "node:fs/promises";
|
|
77
|
-
import {
|
|
78
|
-
import {
|
|
79
|
-
import {
|
|
80
|
-
import { diveSync } from "./impl/node/dive.js";
|
|
81
|
-
import { emptyDir, emptyDirSync } from "./impl/node/empty-dir.js";
|
|
82
|
-
import { mkdirs, mkdirsSync } from "./impl/node/mkdirs.js";
|
|
83
|
-
import { move, moveSync } from "./impl/node/move.js";
|
|
84
|
-
import { outputFile, outputFileSync } from "./impl/node/output-file.js";
|
|
85
|
-
import { outputJson, outputJsonSync } from "./impl/node/output-json.js";
|
|
86
|
-
import { pathExists, pathExistsSync } from "./impl/node/path-exists.js";
|
|
87
|
-
import { readFile, readFileSync } from "./impl/node/read-file.js";
|
|
88
|
-
import { readJson, readJsonSync } from "./impl/node/read-json.js";
|
|
89
|
-
import { remove, removeSync } from "./impl/node/remove.js";
|
|
90
|
-
import { writeJson, writeJsonSync } from "./impl/node/write-json.js";
|
|
75
|
+
import { resolve } from "node:path";
|
|
76
|
+
import { getFileBun, getFileTypeBun, isBun } from "./impl/bun.js";
|
|
77
|
+
import { copy, copySync } from "./impl/copy.js";
|
|
91
78
|
import {
|
|
79
|
+
createFile,
|
|
80
|
+
createFileSync,
|
|
81
|
+
createDir,
|
|
82
|
+
createDirs,
|
|
83
|
+
createFiles,
|
|
84
|
+
createDirSync,
|
|
85
|
+
createDirsSync,
|
|
86
|
+
createFilesSync
|
|
87
|
+
} from "./impl/create.js";
|
|
88
|
+
import { dive, diveSync } from "./impl/dive.js";
|
|
89
|
+
import { emptyDir, emptyDirSync, emptyObject, emptyFile, emptyFileSync } from "./impl/empty.js";
|
|
90
|
+
import {
|
|
91
|
+
readText,
|
|
92
|
+
readTextSync,
|
|
93
|
+
readLines,
|
|
94
|
+
readLinesSync,
|
|
95
|
+
isDirectory,
|
|
96
|
+
isDirectorySync,
|
|
97
|
+
isSymlink,
|
|
98
|
+
isSymlinkSync,
|
|
92
99
|
execAsync,
|
|
93
|
-
setHiddenAttributeOnWindows,
|
|
94
|
-
isHidden,
|
|
95
100
|
isDirectoryEmpty,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
} catch (_err) {
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
if (entry.isDirectory()) {
|
|
129
|
-
if (options.directories ?? false) {
|
|
130
|
-
yield { file: entryPath, stat: entryStat };
|
|
131
|
-
}
|
|
132
|
-
if (options.recursive ?? true) {
|
|
133
|
-
if (currentDepth < maxDepth) {
|
|
134
|
-
yield* _diveWorker(entryPath, options, currentDepth + 1);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
} else if (entry.isFile()) {
|
|
138
|
-
if (options.files ?? true) {
|
|
139
|
-
yield { file: entryPath, stat: entryStat };
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
export async function dive(directory, actionOrOptions, optionsOnly) {
|
|
145
|
-
let action;
|
|
146
|
-
let options;
|
|
147
|
-
if (typeof actionOrOptions === "function") {
|
|
148
|
-
action = actionOrOptions;
|
|
149
|
-
options = optionsOnly;
|
|
150
|
-
} else {
|
|
151
|
-
options = actionOrOptions;
|
|
152
|
-
}
|
|
153
|
-
const currentOptions = {
|
|
154
|
-
recursive: true,
|
|
155
|
-
files: true,
|
|
156
|
-
directories: false,
|
|
157
|
-
all: false,
|
|
158
|
-
depth: Number.POSITIVE_INFINITY,
|
|
159
|
-
...options
|
|
160
|
-
// User options override defaults
|
|
161
|
-
};
|
|
162
|
-
if (action) {
|
|
163
|
-
for await (const { file, stat: entryStat } of _diveWorker(directory, currentOptions, 0)) {
|
|
164
|
-
await action(file, entryStat);
|
|
165
|
-
}
|
|
166
|
-
return;
|
|
167
|
-
} else {
|
|
168
|
-
const results = [];
|
|
169
|
-
for await (const { file } of _diveWorker(directory, currentOptions, 0)) {
|
|
170
|
-
results.push(file);
|
|
171
|
-
}
|
|
172
|
-
return results;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
101
|
+
isHiddenAttribute,
|
|
102
|
+
rmEnsureDir,
|
|
103
|
+
setHiddenAttribute
|
|
104
|
+
} from "./impl/extras.js";
|
|
105
|
+
import { validateAndRepairJson } from "./impl/json-utils.js";
|
|
106
|
+
import { mkdirs, mkdirsSync } from "./impl/mkdirs.js";
|
|
107
|
+
import { move, moveSync } from "./impl/move.js";
|
|
108
|
+
import { outputFile, outputFileSync } from "./impl/output-file.js";
|
|
109
|
+
import { outputJson, outputJsonSync } from "./impl/output-json.js";
|
|
110
|
+
import { pathExists, pathExistsSync } from "./impl/path-exists.js";
|
|
111
|
+
import { readFile, readFileSync } from "./impl/read-file.js";
|
|
112
|
+
import { readJson, readJsonSync } from "./impl/read-json.js";
|
|
113
|
+
import { remove, removeSync } from "./impl/remove.js";
|
|
114
|
+
import { getFileExists, getFileLastModified, getFileSize, getStats, getStatsSync, toNodeStats } from "./impl/stats.js";
|
|
115
|
+
import { writeJson, writeJsonSync } from "./impl/write-json.js";
|
|
116
|
+
import { JSONRepairError } from "./utils/json/helpers/JSONRepairError.js";
|
|
117
|
+
import { JsonSchemaError } from "./utils/json/helpers/JsonSchemaError.js";
|
|
118
|
+
import { extractComments } from "./utils/json/regular/jsonc.js";
|
|
119
|
+
import { jsonrepair } from "./utils/json/regular/jsonrepair.js";
|
|
120
|
+
import { validateJson } from "./utils/json/regular/validate.js";
|
|
121
|
+
import { createInputBuffer } from "./utils/json/stream/buffer/InputBuffer.js";
|
|
122
|
+
import { createOutputBuffer } from "./utils/json/stream/buffer/OutputBuffer.js";
|
|
123
|
+
import { jsonrepairCore } from "./utils/json/stream/core.js";
|
|
124
|
+
import { createJsonlParser } from "./utils/json/stream/jsonl.js";
|
|
125
|
+
import { createJsonlWriter } from "./utils/json/stream/jsonl.js";
|
|
126
|
+
import { JsonStreamError } from "./utils/json/stream/JsonStreamError.js";
|
|
127
|
+
import { createJsonStreamParser } from "./utils/json/stream/parser.js";
|
|
128
|
+
import { jsonrepairTransform } from "./utils/json/stream/stream.js";
|
|
129
|
+
import { createJsonStreamWriter } from "./utils/json/stream/writer.js";
|
|
175
130
|
const mkdirp = mkdirs;
|
|
176
131
|
const ensureDir = mkdirs;
|
|
177
132
|
const ensureFile = createFile;
|
|
@@ -198,67 +153,7 @@ const cp = copy;
|
|
|
198
153
|
const cpSync = copySync;
|
|
199
154
|
const exists = pathExists;
|
|
200
155
|
const existsSync = pathExistsSync;
|
|
201
|
-
|
|
202
|
-
return readFile(filePath, options);
|
|
203
|
-
}
|
|
204
|
-
function readTextSync(filePath, options = "utf8") {
|
|
205
|
-
return readFileSync(filePath, options);
|
|
206
|
-
}
|
|
207
|
-
async function readLines(filePath, options = { encoding: "utf8" }) {
|
|
208
|
-
const effectiveOptions = typeof options === "string" ? { encoding: options } : options;
|
|
209
|
-
const contentBuffer = await readFile(filePath, { ...effectiveOptions, encoding: null });
|
|
210
|
-
return contentBuffer.split(/\r?\n/);
|
|
211
|
-
}
|
|
212
|
-
function readLinesSync(filePath, options = { encoding: "utf8" }) {
|
|
213
|
-
const effectiveOptions = typeof options === "string" ? { encoding: options } : options;
|
|
214
|
-
const contentBuffer = readFileSync(filePath, { ...effectiveOptions, encoding: null });
|
|
215
|
-
const content = contentBuffer;
|
|
216
|
-
return content.split(/\r?\n/);
|
|
217
|
-
}
|
|
218
|
-
async function isDirectory(filePath) {
|
|
219
|
-
try {
|
|
220
|
-
const stats = await stat(filePath);
|
|
221
|
-
return stats.isDirectory();
|
|
222
|
-
} catch (error) {
|
|
223
|
-
if (error.code === "ENOENT" || error.code === "ENOTDIR") {
|
|
224
|
-
return false;
|
|
225
|
-
}
|
|
226
|
-
throw error;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
function isDirectorySync(filePath) {
|
|
230
|
-
try {
|
|
231
|
-
const stats = statSync(filePath);
|
|
232
|
-
return stats.isDirectory();
|
|
233
|
-
} catch (error) {
|
|
234
|
-
if (error.code === "ENOENT" || error.code === "ENOTDIR") {
|
|
235
|
-
return false;
|
|
236
|
-
}
|
|
237
|
-
throw error;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
async function isSymlink(filePath) {
|
|
241
|
-
try {
|
|
242
|
-
const stats = await lstat(filePath);
|
|
243
|
-
return stats.isSymbolicLink();
|
|
244
|
-
} catch (error) {
|
|
245
|
-
if (error.code === "ENOENT") {
|
|
246
|
-
return false;
|
|
247
|
-
}
|
|
248
|
-
throw error;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
function isSymlinkSync(filePath) {
|
|
252
|
-
try {
|
|
253
|
-
const stats = lstatSync(filePath);
|
|
254
|
-
return stats.isSymbolicLink();
|
|
255
|
-
} catch (error) {
|
|
256
|
-
if (error.code === "ENOENT") {
|
|
257
|
-
return false;
|
|
258
|
-
}
|
|
259
|
-
throw error;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
156
|
+
const jsonRepairRegular = jsonrepair;
|
|
262
157
|
export {
|
|
263
158
|
accessSync,
|
|
264
159
|
appendFileSync,
|
|
@@ -306,6 +201,10 @@ export {
|
|
|
306
201
|
readJsonSync,
|
|
307
202
|
writeJsonSync,
|
|
308
203
|
createFileSync,
|
|
204
|
+
createDirSync,
|
|
205
|
+
createDirsSync,
|
|
206
|
+
createFilesSync,
|
|
207
|
+
emptyFileSync,
|
|
309
208
|
mkdirsSync,
|
|
310
209
|
emptyDirSync,
|
|
311
210
|
pathExistsSync,
|
|
@@ -336,6 +235,10 @@ export {
|
|
|
336
235
|
readJson,
|
|
337
236
|
writeJson,
|
|
338
237
|
createFile,
|
|
238
|
+
createDir,
|
|
239
|
+
createDirs,
|
|
240
|
+
createFiles,
|
|
241
|
+
emptyFile,
|
|
339
242
|
mkdirs,
|
|
340
243
|
emptyDir,
|
|
341
244
|
pathExists,
|
|
@@ -393,10 +296,37 @@ export {
|
|
|
393
296
|
readLines,
|
|
394
297
|
readText,
|
|
395
298
|
execAsync,
|
|
396
|
-
|
|
397
|
-
|
|
299
|
+
setHiddenAttribute,
|
|
300
|
+
isHiddenAttribute,
|
|
398
301
|
isDirectoryEmpty,
|
|
399
|
-
rmEnsureDir
|
|
302
|
+
rmEnsureDir,
|
|
303
|
+
dive,
|
|
304
|
+
getFileExists,
|
|
305
|
+
getFileLastModified,
|
|
306
|
+
getFileSize,
|
|
307
|
+
getStats,
|
|
308
|
+
getStatsSync,
|
|
309
|
+
emptyObject,
|
|
310
|
+
getFileBun,
|
|
311
|
+
getFileTypeBun,
|
|
312
|
+
toNodeStats,
|
|
313
|
+
isBun,
|
|
314
|
+
jsonrepair,
|
|
315
|
+
jsonRepairRegular,
|
|
316
|
+
createInputBuffer,
|
|
317
|
+
createOutputBuffer,
|
|
318
|
+
jsonrepairCore,
|
|
319
|
+
JSONRepairError,
|
|
320
|
+
jsonrepairTransform,
|
|
321
|
+
validateAndRepairJson,
|
|
322
|
+
validateJson,
|
|
323
|
+
JsonSchemaError,
|
|
324
|
+
createJsonStreamParser,
|
|
325
|
+
createJsonStreamWriter,
|
|
326
|
+
JsonStreamError,
|
|
327
|
+
createJsonlParser,
|
|
328
|
+
createJsonlWriter,
|
|
329
|
+
extractComments
|
|
400
330
|
};
|
|
401
331
|
const fs = {
|
|
402
332
|
// Sync direct exports (node:fs)
|
|
@@ -446,6 +376,10 @@ const fs = {
|
|
|
446
376
|
readJsonSync,
|
|
447
377
|
writeJsonSync,
|
|
448
378
|
createFileSync,
|
|
379
|
+
createDirSync,
|
|
380
|
+
createDirsSync,
|
|
381
|
+
createFilesSync,
|
|
382
|
+
emptyFileSync,
|
|
449
383
|
mkdirsSync,
|
|
450
384
|
emptyDirSync,
|
|
451
385
|
pathExistsSync,
|
|
@@ -479,6 +413,10 @@ const fs = {
|
|
|
479
413
|
readJson,
|
|
480
414
|
writeJson,
|
|
481
415
|
createFile,
|
|
416
|
+
createDir,
|
|
417
|
+
createDirs,
|
|
418
|
+
createFiles,
|
|
419
|
+
emptyFile,
|
|
482
420
|
mkdirs,
|
|
483
421
|
emptyDir,
|
|
484
422
|
pathExists,
|
|
@@ -539,9 +477,38 @@ const fs = {
|
|
|
539
477
|
readText,
|
|
540
478
|
// Additional utility functions
|
|
541
479
|
execAsync,
|
|
542
|
-
|
|
543
|
-
|
|
480
|
+
setHiddenAttribute,
|
|
481
|
+
isHiddenAttribute,
|
|
544
482
|
isDirectoryEmpty,
|
|
545
|
-
rmEnsureDir
|
|
483
|
+
rmEnsureDir,
|
|
484
|
+
dive,
|
|
485
|
+
getFileExists,
|
|
486
|
+
getFileLastModified,
|
|
487
|
+
getFileSize,
|
|
488
|
+
getStats,
|
|
489
|
+
getStatsSync,
|
|
490
|
+
emptyObject,
|
|
491
|
+
// Bun-specific utilities
|
|
492
|
+
getFileBun,
|
|
493
|
+
getFileTypeBun,
|
|
494
|
+
toNodeStats,
|
|
495
|
+
isBun,
|
|
496
|
+
// JSON utilities
|
|
497
|
+
jsonrepair,
|
|
498
|
+
jsonRepairRegular,
|
|
499
|
+
createInputBuffer,
|
|
500
|
+
createOutputBuffer,
|
|
501
|
+
jsonrepairCore,
|
|
502
|
+
JSONRepairError,
|
|
503
|
+
jsonrepairTransform,
|
|
504
|
+
validateAndRepairJson,
|
|
505
|
+
validateJson,
|
|
506
|
+
JsonSchemaError,
|
|
507
|
+
createJsonStreamParser,
|
|
508
|
+
createJsonStreamWriter,
|
|
509
|
+
JsonStreamError,
|
|
510
|
+
createJsonlParser,
|
|
511
|
+
createJsonlWriter,
|
|
512
|
+
extractComments
|
|
546
513
|
};
|
|
547
514
|
export default fs;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export declare function isHex(char: string): boolean;
|
|
2
|
+
export declare function isDigit(char: string): boolean;
|
|
3
|
+
export declare function isValidStringCharacter(char: string): boolean;
|
|
4
|
+
export declare function isDelimiter(char: string): boolean;
|
|
5
|
+
export declare function isFunctionNameCharStart(char: string): boolean;
|
|
6
|
+
export declare function isFunctionNameChar(char: string): boolean;
|
|
7
|
+
export declare const regexUrlStart: RegExp;
|
|
8
|
+
export declare const regexUrlChar: RegExp;
|
|
9
|
+
export declare function isUnquotedStringDelimiter(char: string): boolean;
|
|
10
|
+
export declare function isStartOfValue(char: string): boolean;
|
|
11
|
+
export declare function isControlCharacter(char: string): char is "\b" | "\f" | "\n" | "\r" | "\t";
|
|
12
|
+
export interface Text {
|
|
13
|
+
charCodeAt: (index: number) => number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Check if the given character is a whitespace character like space, tab, or
|
|
17
|
+
* newline
|
|
18
|
+
*/
|
|
19
|
+
export declare function isWhitespace(text: Text, index: number): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Check if the given character is a whitespace character like space or tab,
|
|
22
|
+
* but NOT a newline
|
|
23
|
+
*/
|
|
24
|
+
export declare function isWhitespaceExceptNewline(text: Text, index: number): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Check if the given character is a special whitespace character, some
|
|
27
|
+
* unicode variant
|
|
28
|
+
*/
|
|
29
|
+
export declare function isSpecialWhitespace(text: Text, index: number): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Test whether the given character is a quote or double quote character.
|
|
32
|
+
* Also tests for special variants of quotes.
|
|
33
|
+
*/
|
|
34
|
+
export declare function isQuote(char: string): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Test whether the given character is a double quote character.
|
|
37
|
+
* Also tests for special variants of double quotes.
|
|
38
|
+
*/
|
|
39
|
+
export declare function isDoubleQuoteLike(char: string): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Test whether the given character is a double quote character.
|
|
42
|
+
* Does NOT test for special variants of double quotes.
|
|
43
|
+
*/
|
|
44
|
+
export declare function isDoubleQuote(char: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Test whether the given character is a single quote character.
|
|
47
|
+
* Also tests for special variants of single quotes.
|
|
48
|
+
*/
|
|
49
|
+
export declare function isSingleQuoteLike(char: string): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Test whether the given character is a single quote character.
|
|
52
|
+
* Does NOT test for special variants of single quotes.
|
|
53
|
+
*/
|
|
54
|
+
export declare function isSingleQuote(char: string): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Strip last occurrence of textToStrip from text
|
|
57
|
+
*/
|
|
58
|
+
export declare function stripLastOccurrence(text: string, textToStrip: string, stripRemainingText?: boolean): string;
|
|
59
|
+
export declare function insertBeforeLastWhitespace(text: string, textToInsert: string): string;
|
|
60
|
+
export declare function removeAtIndex(text: string, start: number, count: number): string;
|
|
61
|
+
/**
|
|
62
|
+
* Test whether a string ends with a newline or comma character and optional whitespace
|
|
63
|
+
*/
|
|
64
|
+
export declare function endsWithCommaOrNewline(text: string): boolean;
|