@reliverse/relifso 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/README.md +6 -1
  2. package/bin/impl/async.d.ts +7 -0
  3. package/bin/impl/async.js +9 -0
  4. package/bin/impl/copy.d.ts +20 -0
  5. package/bin/impl/copy.js +28 -0
  6. package/bin/impl/create-file.d.ts +1 -0
  7. package/bin/impl/create-file.js +8 -0
  8. package/bin/impl/dive.d.ts +17 -0
  9. package/bin/impl/dive.js +56 -0
  10. package/bin/impl/empty-dir.d.ts +1 -0
  11. package/bin/impl/empty-dir.js +10 -0
  12. package/bin/impl/mkdirs.d.ts +1 -0
  13. package/bin/impl/mkdirs.js +7 -0
  14. package/bin/impl/move.d.ts +14 -0
  15. package/bin/impl/move.js +42 -0
  16. package/bin/impl/output-file.d.ts +8 -0
  17. package/bin/impl/output-file.js +8 -0
  18. package/bin/impl/output-json.d.ts +8 -0
  19. package/bin/impl/output-json.js +8 -0
  20. package/bin/impl/path-exists.d.ts +1 -0
  21. package/bin/impl/path-exists.js +4 -0
  22. package/bin/impl/read-file.d.ts +12 -0
  23. package/bin/impl/read-file.js +12 -0
  24. package/bin/impl/read-json.d.ts +14 -0
  25. package/bin/impl/read-json.js +24 -0
  26. package/bin/impl/remove.d.ts +1 -0
  27. package/bin/impl/remove.js +4 -0
  28. package/bin/impl/write-file.d.ts +11 -0
  29. package/bin/impl/write-file.js +9 -0
  30. package/bin/impl/write-json.d.ts +20 -0
  31. package/bin/impl/write-json.js +11 -0
  32. package/bin/mod.d.ts +50 -2
  33. package/bin/mod.js +158 -2
  34. package/package.json +7 -9
  35. package/bin/d.ts.txt +0 -1000
  36. package/bin/impl/args-impl.d.ts +0 -0
  37. package/bin/impl/args-impl.js +0 -0
  38. package/bin/impl/array-polyfill.d.ts +0 -15
  39. package/bin/impl/external/path-is-inside.d.ts +0 -1
  40. package/bin/impl/external/path-is-inside.js +0 -16
  41. package/bin/impl/external/vacuum.d.ts +0 -26
  42. package/bin/impl/external/vacuum.js +0 -95
  43. package/bin/impl/fs/dive.d.ts +0 -8
  44. package/bin/impl/fs/dive.js +0 -91
  45. package/bin/impl/fs/exists.d.ts +0 -31
  46. package/bin/impl/fs/exists.js +0 -10
  47. package/bin/impl/fs/for-each-child.d.ts +0 -34
  48. package/bin/impl/fs/for-each-child.js +0 -37
  49. package/bin/impl/fs/index.d.ts +0 -1118
  50. package/bin/impl/fs/index.js +0 -66
  51. package/bin/impl/fs/is-directory.d.ts +0 -14
  52. package/bin/impl/fs/is-directory.js +0 -16
  53. package/bin/impl/fs/map-children.d.ts +0 -17
  54. package/bin/impl/fs/map-children.js +0 -31
  55. package/bin/impl/fs/map-structure.d.ts +0 -35
  56. package/bin/impl/fs/map-structure.js +0 -44
  57. package/bin/impl/fs/read-lines.d.ts +0 -16
  58. package/bin/impl/fs/read-lines.js +0 -32
  59. package/bin/impl/fs/read-text.d.ts +0 -13
  60. package/bin/impl/fs/read-text.js +0 -10
  61. package/bin/impl/fs/universalify.d.ts +0 -18
  62. package/bin/impl/fs/universalify.js +0 -38
  63. package/bin/impl/fs/write-file.d.ts +0 -93
  64. package/bin/impl/fs/write-file.js +0 -47
  65. package/bin/impl/helpers.d.ts +0 -1
  66. package/bin/impl/helpers.js +0 -37
  67. package/bin/impl/json.d.ts +0 -16
  68. package/bin/impl/json.js +0 -90
  69. package/bin/impl/lib/copy/copy-sync.d.ts +0 -25
  70. package/bin/impl/lib/copy/copy-sync.js +0 -119
  71. package/bin/impl/lib/copy/copy.d.ts +0 -7
  72. package/bin/impl/lib/copy/copy.js +0 -144
  73. package/bin/impl/lib/copy/index.d.ts +0 -5
  74. package/bin/impl/lib/copy/index.js +0 -2
  75. package/bin/impl/lib/empty/index.d.ts +0 -1
  76. package/bin/impl/lib/empty/index.js +0 -29
  77. package/bin/impl/lib/ensure/file.d.ts +0 -2
  78. package/bin/impl/lib/ensure/file.js +0 -56
  79. package/bin/impl/lib/ensure/index.d.ts +0 -8
  80. package/bin/impl/lib/ensure/index.js +0 -12
  81. package/bin/impl/lib/ensure/link.d.ts +0 -2
  82. package/bin/impl/lib/ensure/link.js +0 -53
  83. package/bin/impl/lib/ensure/symlink-paths.d.ts +0 -5
  84. package/bin/impl/lib/ensure/symlink-paths.js +0 -63
  85. package/bin/impl/lib/ensure/symlink-type.d.ts +0 -2
  86. package/bin/impl/lib/ensure/symlink-type.js +0 -23
  87. package/bin/impl/lib/ensure/symlink.d.ts +0 -2
  88. package/bin/impl/lib/ensure/symlink.js +0 -59
  89. package/bin/impl/lib/fs/index.d.ts +0 -1
  90. package/bin/impl/lib/fs/index.js +0 -1
  91. package/bin/impl/lib/index.d.ts +0 -15
  92. package/bin/impl/lib/index.js +0 -34
  93. package/bin/impl/lib/index_rollup.d.ts +0 -10
  94. package/bin/impl/lib/index_rollup.js +0 -10
  95. package/bin/impl/lib/json/index.d.ts +0 -3
  96. package/bin/impl/lib/json/index.js +0 -10
  97. package/bin/impl/lib/json/output-json-sync.d.ts +0 -1
  98. package/bin/impl/lib/json/output-json-sync.js +0 -6
  99. package/bin/impl/lib/json/output-json.d.ts +0 -1
  100. package/bin/impl/lib/json/output-json.js +0 -6
  101. package/bin/impl/lib/mkdirs/index.d.ts +0 -1
  102. package/bin/impl/lib/mkdirs/index.js +0 -4
  103. package/bin/impl/lib/mkdirs/make-dir.d.ts +0 -2
  104. package/bin/impl/lib/mkdirs/make-dir.js +0 -21
  105. package/bin/impl/lib/mkdirs/utils.d.ts +0 -1
  106. package/bin/impl/lib/mkdirs/utils.js +0 -13
  107. package/bin/impl/lib/move/index.d.ts +0 -30
  108. package/bin/impl/lib/move/index.js +0 -2
  109. package/bin/impl/lib/move/move-sync.d.ts +0 -8
  110. package/bin/impl/lib/move/move-sync.js +0 -51
  111. package/bin/impl/lib/move/move.d.ts +0 -6
  112. package/bin/impl/lib/move/move.js +0 -48
  113. package/bin/impl/lib/output-file/index.d.ts +0 -1
  114. package/bin/impl/lib/output-file/index.js +0 -24
  115. package/bin/impl/lib/remove/index.d.ts +0 -53
  116. package/bin/impl/lib/remove/index.js +0 -8
  117. package/bin/impl/lib/util/stat.d.ts +0 -39
  118. package/bin/impl/lib/util/stat.js +0 -140
  119. package/bin/impl/lib/util/utimes.d.ts +0 -7
  120. package/bin/impl/lib/util/utimes.js +0 -31
  121. package/bin/impl/subindex.d.ts +0 -38
  122. package/bin/impl/subindex.js +0 -148
  123. package/bin/types.d.ts +0 -100
  124. package/bin/types.js +0 -1
@@ -1,148 +0,0 @@
1
- export * from "./fs/index.js";
2
- export {
3
- access,
4
- appendFile,
5
- chmod,
6
- chown,
7
- close,
8
- copyFile,
9
- cp,
10
- createReadStream,
11
- createWriteStream,
12
- fchmod,
13
- fchown,
14
- fdatasync,
15
- fstat,
16
- ftruncate,
17
- futimes,
18
- lchmod,
19
- lchown,
20
- link,
21
- lstat,
22
- lutimes,
23
- mkdir,
24
- mkdtemp,
25
- open,
26
- openAsBlob,
27
- opendir,
28
- read,
29
- readFile,
30
- readv,
31
- readdir,
32
- realpath,
33
- rename,
34
- rm,
35
- rmdir,
36
- stat,
37
- statfs,
38
- symlink,
39
- truncate,
40
- unlink,
41
- unwatchFile,
42
- utimes,
43
- watch,
44
- watchFile,
45
- write,
46
- writev,
47
- accessSync,
48
- appendFileSync,
49
- chmodSync,
50
- chownSync,
51
- closeSync,
52
- copyFileSync,
53
- cpSync,
54
- existsSync,
55
- fchmodSync,
56
- fchownSync,
57
- fdatasyncSync,
58
- fstatSync,
59
- fsync,
60
- fsyncSync,
61
- ftruncateSync,
62
- futimesSync,
63
- lchmodSync,
64
- lchownSync,
65
- linkSync,
66
- lstatSync,
67
- lutimesSync,
68
- mkdirSync,
69
- mkdtempSync,
70
- openSync,
71
- opendirSync,
72
- readSync,
73
- readFileSync,
74
- readlinkSync,
75
- readvSync,
76
- readdirSync,
77
- realpathSync,
78
- renameSync,
79
- rmSync,
80
- rmdirSync,
81
- statSync,
82
- statfsSync,
83
- symlinkSync,
84
- truncateSync,
85
- unlinkSync,
86
- utimesSync,
87
- writeFileSync,
88
- writeSync,
89
- writevSync
90
- } from "./fs/index.js";
91
- export { default as vacuum } from "./external/vacuum.js";
92
- export { copy, copySync } from "./lib/copy/index.js";
93
- export { emptyDir, emptyDirSync } from "./lib/empty/index.js";
94
- export {
95
- ensureFile,
96
- ensureFileSync,
97
- ensureLink,
98
- ensureLinkSync,
99
- ensureSymlink,
100
- ensureSymlinkSync
101
- } from "./lib/ensure/index.js";
102
- export {
103
- mkdirs,
104
- mkdirsSync,
105
- mkdirs as ensureDir,
106
- mkdirsSync as ensureDirSync
107
- } from "./lib/mkdirs/index.js";
108
- export { move, moveSync } from "./lib/move/index.js";
109
- export { outputFile, outputFileSync } from "./lib/output-file/index.js";
110
- export { remove, removeSync } from "./lib/remove/index.js";
111
- export { exists, exists as pathExists } from "./fs/exists.js";
112
- export { dive, diveSync } from "./fs/dive.js";
113
- export { forEachChild, forEachChildSync } from "./fs/for-each-child.js";
114
- export { isDirectory, isDirectorySync } from "./fs/is-directory.js";
115
- export { mapChildren } from "./fs/map-children.js";
116
- export { mapStructure, mapStructureOrdered } from "./fs/map-structure.js";
117
- export { readLines, readLinesSync } from "./fs/read-lines.js";
118
- export { readText, readTextSync } from "./fs/read-text.js";
119
- export { writeFile } from "./fs/write-file.js";
120
- import * as fs from "./fs/index.js";
121
- export * from "./json.js";
122
- export function resolve(path, child) {
123
- if (path.endsWith("/") || path.endsWith("\\")) {
124
- return path + child;
125
- }
126
- if (path.includes("/")) {
127
- return `${path}/${child}`;
128
- }
129
- if (path.includes("\\")) {
130
- return `${path}\\${child}`;
131
- }
132
- return `${path}/${child}`;
133
- }
134
- export function isSymlink(file, callback) {
135
- return callback ? fs.lstat(
136
- file,
137
- (err, stats) => err ? callback(err) : callback(null, stats.isSymbolicLink())
138
- ) : fs.lstat(file).then((stats) => stats.isSymbolicLink());
139
- }
140
- function combine(fn1, fn2) {
141
- if (fn1) {
142
- if (fn2) return (...args) => fn1(...args) && fn2(...args);
143
- return fn1;
144
- } else {
145
- if (fn2) return fn2;
146
- return () => true;
147
- }
148
- }
package/bin/types.d.ts DELETED
@@ -1,100 +0,0 @@
1
- import type * as fs from "node:fs";
2
- export { move, moveSync } from "fs-extra";
3
- /**
4
- * Mapper function signature for [[mapChildren]] (sync).
5
- * @param contents returned value of [[readFile]]. Varies depending on `readOptions`
6
- * @param filename file name including extension (not including full path)
7
- * @param pathOnly path not including file name
8
- * @param pathWithFilename full path, including file name
9
- * @returns the value to pass to [[writeFile]], or a [[Promise]] resolving to the value to pass to [[writeFile]].
10
- */
11
- export type MapChildrenFunction<T> = (contents: T, filename: string, pathOnly: string, pathWithFilename: string) => string | Buffer | Promise<string | Buffer>;
12
- /**
13
- * Mapper function signature for [[mapStructure]] (async).
14
- * @param contents returned value of [[readFile]]. Varies depending on `readOptions`
15
- * @param fullPath the full path to the file **relative to the current working directory, NOT `path`**
16
- * @param stats a [[Stats]] object.
17
- * @returns the value to pass to [[writeFile]], or a [[Promise]] resolving to the value to pass to [[writeFile]].
18
- */
19
- export type MapStructureFunction<T> = (contents: T, fullPath: string, stat: fs.Stats) => Promise<string | Buffer> | string | Buffer;
20
- /**
21
- * A standard node.js callback with an error parameter, null means the operation completed successfully
22
- */
23
- export type ErrorCallback = (err?: NodeJS.ErrnoException | null) => void;
24
- /**
25
- * Action function for the overload of [[dive]] that takes a `complete` callback.
26
- * @param err an error or `null`
27
- * @param file the **full relative** pathname of a file (relative to `process.cwd`, not relative to `directory`)
28
- * @param stat a [[Stats]] object.
29
- */
30
- export type DiveActionCallback = (err: Error | null, file?: string, stat?: fs.Stats) => void;
31
- /**
32
- * Action function for the overload of [[dive]] that doesn't take a `complete` callback.
33
- * @param file the **full relative** pathname of a file (relative to `process.cwd`, not relative to `directory`)
34
- * @param stat a [[Stats]] object.
35
- */
36
- export type DiveActionPromise = (file: string, stat: fs.Stats) => void | Promise<void>;
37
- /**
38
- * Options for [[readFile]] calls in [[mapChildren]]. Not to be confused with the [[ReadOptions]] interface which is
39
- * misleadingly named but is only used for [[readJson]]/[[readJsonSync]]
40
- */
41
- export interface ReadFileOptions {
42
- encoding?: BufferEncoding;
43
- flag?: string;
44
- }
45
- /**
46
- * An entry in the resolved value of the promise returned by [[mapStructure]].
47
- */
48
- export interface MapStructureResult {
49
- /**
50
- * The full path to the file **relative to the current working directory, NOT `path`**
51
- */
52
- file: string;
53
- /**
54
- * A [[Stats]] object.
55
- */
56
- stat: fs.Stats;
57
- }
58
- /**
59
- * Options for [[vacuum]].
60
- */
61
- export interface VacuumOptions {
62
- /** No directories at or above this level of the filesystem will be removed. */
63
- base?: string;
64
- /** If set, nuke the whole leaf directory, including its contents. */
65
- purge?: boolean;
66
- /** A logging function that takes `npmlog`-compatible argument lists. */
67
- log?: (prefix: string | undefined, message?: string, ...args: any[]) => void;
68
- }
69
- /**
70
- * Options for [[dive]].
71
- */
72
- export interface DiveOptions {
73
- /** If set to false, this will ignore subdirectories. */
74
- recursive?: boolean;
75
- /** If set to true, this will show "dot files" and files in "dot directories", e.g. ".gitignore" or ".git/HEAD". */
76
- all?: boolean;
77
- /** If set to true, this will call `action` on directories, too. */
78
- directories?: boolean;
79
- /** If set to false, this won't call `action` on files any more. */
80
- files?: boolean;
81
- /** If set to a string or RegExp, all files and directories that match will be ignored. */
82
- ignore?: false | string | RegExp;
83
- }
84
- export type JsonReadOptions = {
85
- encoding?: BufferEncoding | null;
86
- flag?: string;
87
- throws?: boolean;
88
- fs?: typeof import("fs");
89
- reviver?: (key: any, value: any) => any;
90
- } | BufferEncoding | null | undefined;
91
- export type JsonWriteOptions = {
92
- encoding?: BufferEncoding | null;
93
- mode?: string | number;
94
- flag?: string;
95
- fs?: typeof import("fs");
96
- EOL?: string;
97
- finalEOL?: boolean;
98
- spaces?: string | number;
99
- replacer?: (key: string, value: any) => any;
100
- } | BufferEncoding | null | undefined;
package/bin/types.js DELETED
@@ -1 +0,0 @@
1
- export { move, moveSync } from "fs-extra";