@wocker/core 1.0.26 → 1.0.27-beta.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import FS from "fs";
|
|
1
|
+
import FS, { EncodingOption, BufferEncodingOption } from "fs";
|
|
2
2
|
import { Readable } from "stream";
|
|
3
3
|
import { FileSystemDriver, ReadStreamOptions, WriteStreamOptions } from "../types";
|
|
4
4
|
import { File } from "./File";
|
|
@@ -42,5 +42,7 @@ export declare class FileSystem {
|
|
|
42
42
|
createReadlineStream(path: string, options?: ReadlineOptions): Readable;
|
|
43
43
|
getLinePosition(path: string, line: number): number;
|
|
44
44
|
watch(path: string, options?: FS.WatchOptionsWithStringEncoding): FS.FSWatcher;
|
|
45
|
+
readlink(path: string, options?: EncodingOption): string;
|
|
46
|
+
readlink(path: string, options: BufferEncodingOption): Buffer<ArrayBuffer>;
|
|
45
47
|
}
|
|
46
48
|
export {};
|
package/lib/makes/FileSystem.js
CHANGED
|
@@ -170,5 +170,14 @@ class FileSystem {
|
|
|
170
170
|
watch(path, options = {}) {
|
|
171
171
|
return this.driver.watch(this.path(path), options);
|
|
172
172
|
}
|
|
173
|
+
readlink(path, options) {
|
|
174
|
+
const link = this.driver.readlinkSync(this.path(path), options);
|
|
175
|
+
if (typeof link === "string") {
|
|
176
|
+
return path_1.default.isAbsolute(link)
|
|
177
|
+
? path_1.default.relative(this.source, link)
|
|
178
|
+
: link;
|
|
179
|
+
}
|
|
180
|
+
return link;
|
|
181
|
+
}
|
|
173
182
|
}
|
|
174
183
|
exports.FileSystem = FileSystem;
|
|
@@ -29,8 +29,8 @@ let AppConfigService = class AppConfigService {
|
|
|
29
29
|
this.processService = processService;
|
|
30
30
|
this.fs = fs;
|
|
31
31
|
this.mapTypes = {
|
|
32
|
-
[project_1.PROJECT_TYPE_PRESET]: "Preset",
|
|
33
32
|
[project_1.PROJECT_TYPE_IMAGE]: "Image",
|
|
33
|
+
[project_1.PROJECT_TYPE_PRESET]: "Preset",
|
|
34
34
|
[project_1.PROJECT_TYPE_DOCKERFILE]: "Dockerfile"
|
|
35
35
|
};
|
|
36
36
|
this._pwd = (process.cwd() || process.env.PWD);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import FS, { type Dirent } from "fs";
|
|
1
|
+
import FS, { type Dirent, type EncodingOption, type BufferEncodingOption } from "fs";
|
|
2
2
|
type StreamOptions = {
|
|
3
3
|
flags?: string;
|
|
4
4
|
fd?: number;
|
|
@@ -36,5 +36,6 @@ export interface FileSystemDriver {
|
|
|
36
36
|
watchFile(path: string, listener: FS.StatsListener): FS.StatWatcher;
|
|
37
37
|
cpSync(source: string, destination: string, opts?: FS.CopySyncOptions): void;
|
|
38
38
|
renameSync(oldPath: string, newPath: string): void;
|
|
39
|
+
readlinkSync(path: string, options?: EncodingOption | BufferEncodingOption): string | Buffer<ArrayBuffer>;
|
|
39
40
|
}
|
|
40
41
|
export {};
|