From 9bce51f651aad297ef9eb6df832bfdaf1de05d84 Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期三, 22 四月 2026 14:27:54 +0800
Subject: [PATCH] 青岛推送
---
node_modules/webpack/lib/util/fs.js | 229 ++++++++++++++++++++++++++++++++++++---------------------
1 files changed, 144 insertions(+), 85 deletions(-)
diff --git a/node_modules/webpack/lib/util/fs.js b/node_modules/webpack/lib/util/fs.js
index 4db861e..c31f06d 100644
--- a/node_modules/webpack/lib/util/fs.js
+++ b/node_modules/webpack/lib/util/fs.js
@@ -8,9 +8,12 @@
const path = require("path");
/** @typedef {import("../../declarations/WebpackOptions").WatchOptions} WatchOptions */
-/** @typedef {import("../FileSystemInfo").FileSystemInfoEntry} FileSystemInfoEntry */
+/** @typedef {import("watchpack").Entry} Entry */
+/** @typedef {import("watchpack").OnlySafeTimeEntry} OnlySafeTimeEntry */
+/** @typedef {import("watchpack").ExistenceOnlyTimeEntry} ExistenceOnlyTimeEntry */
/**
+ * Defines the i stats base type used by this module.
* @template T
* @typedef {object} IStatsBase
* @property {() => boolean} isFile
@@ -41,14 +44,17 @@
*/
/**
+ * Defines the i stats type used by this module.
* @typedef {IStatsBase<number>} IStats
*/
/**
- * @typedef {IStatsBase<bigint> & { atimeNs: bigint, mtimeNs: bigint, ctimeNs: bigint, birthtimeNs: bigint }} IBigIntStats
+ * Defines the i big int stats type used by this module.
+ * @typedef {IStatsBase<bigint> & { atimeNs: bigint, mtimeNs: bigint, ctimeNs: bigint, birthtimeNs: bigint }} IBigIntStats
*/
/**
+ * Defines the dirent type used by this module.
* @template {string | Buffer} [T=string]
* @typedef {object} Dirent
* @property {() => boolean} isFile true when is file, otherwise false
@@ -83,12 +89,13 @@
/** @typedef {(err: NodeJS.ErrnoException | null, result?: number) => void} NumberCallback */
/** @typedef {(err: NodeJS.ErrnoException | Error | null, result?: JsonObject) => void} ReadJsonCallback */
-/** @typedef {Map<string, FileSystemInfoEntry | "ignore">} TimeInfoEntries */
+/** @typedef {Map<string, Entry | OnlySafeTimeEntry | ExistenceOnlyTimeEntry | null | "ignore">} TimeInfoEntries */
/** @typedef {Set<string>} Changes */
/** @typedef {Set<string>} Removals */
/**
+ * Defines the watcher info type used by this module.
* @typedef {object} WatcherInfo
* @property {Changes | null} changes get current aggregated changes that have not yet send to callback
* @property {Removals | null} removals get current aggregated removals that have not yet send to callback
@@ -98,6 +105,7 @@
// TODO webpack 6 deprecate missing getInfo
/**
+ * Defines the watcher type used by this module.
* @typedef {object} Watcher
* @property {() => void} close closes the watcher and all underlying file watchers
* @property {() => void} pause closes the watcher, but keeps underlying file watchers alive until the next watch call
@@ -109,6 +117,7 @@
*/
/**
+ * Defines the watch method callback.
* @callback WatchMethod
* @param {Iterable<string>} files watched files
* @param {Iterable<string>} directories watched directories
@@ -123,164 +132,187 @@
// TODO webpack 6 make optional methods required and avoid using non standard methods like `join`, `relative`, `dirname`, move IntermediateFileSystemExtras methods to InputFilesystem or OutputFilesystem
/**
+ * Defines the path like type used by this module.
* @typedef {string | Buffer | URL} PathLike
*/
/**
+ * Defines the path or file descriptor type used by this module.
* @typedef {PathLike | number} PathOrFileDescriptor
*/
/**
+ * Defines the object encoding options type used by this module.
* @typedef {object} ObjectEncodingOptions
* @property {BufferEncoding | null | undefined=} encoding
*/
/**
+ * Describes the read file shape.
* @typedef {{
- * (path: PathOrFileDescriptor, options: ({ encoding?: null | undefined, flag?: string | undefined } & import("events").Abortable) | undefined | null, callback: BufferCallback): void;
- * (path: PathOrFileDescriptor, options: ({ encoding: BufferEncoding, flag?: string | undefined } & import("events").Abortable) | BufferEncoding, callback: StringCallback): void;
- * (path: PathOrFileDescriptor, options: (ObjectEncodingOptions & { flag?: string | undefined } & import("events").Abortable) | BufferEncoding | undefined | null, callback: StringOrBufferCallback): void;
- * (path: PathOrFileDescriptor, callback: BufferCallback): void;
+ * (path: PathOrFileDescriptor, options: ({ encoding?: null | undefined, flag?: string | undefined } & import("events").Abortable) | undefined | null, callback: BufferCallback): void,
+ * (path: PathOrFileDescriptor, options: ({ encoding: BufferEncoding, flag?: string | undefined } & import("events").Abortable) | BufferEncoding, callback: StringCallback): void,
+ * (path: PathOrFileDescriptor, options: (ObjectEncodingOptions & { flag?: string | undefined } & import("events").Abortable) | BufferEncoding | undefined | null, callback: StringOrBufferCallback): void,
+ * (path: PathOrFileDescriptor, callback: BufferCallback): void,
* }} ReadFile
*/
/**
+ * Describes the read file sync shape.
* @typedef {{
- * (path: PathOrFileDescriptor, options?: { encoding?: null | undefined, flag?: string | undefined } | null): Buffer;
- * (path: PathOrFileDescriptor, options: { encoding: BufferEncoding, flag?: string | undefined } | BufferEncoding): string;
- * (path: PathOrFileDescriptor, options?: (ObjectEncodingOptions & { flag?: string | undefined }) | BufferEncoding | null): string | Buffer;
+ * (path: PathOrFileDescriptor, options?: { encoding?: null | undefined, flag?: string | undefined } | null): Buffer,
+ * (path: PathOrFileDescriptor, options: { encoding: BufferEncoding, flag?: string | undefined } | BufferEncoding): string,
+ * (path: PathOrFileDescriptor, options?: (ObjectEncodingOptions & { flag?: string | undefined }) | BufferEncoding | null): string | Buffer,
* }} ReadFileSync
*/
/**
+ * Defines the encoding option type used by this module.
* @typedef {ObjectEncodingOptions | BufferEncoding | undefined | null} EncodingOption
*/
/**
- * @typedef {'buffer'| { encoding: 'buffer' }} BufferEncodingOption
+ * Defines the buffer encoding option type used by this module.
+ * @typedef {"buffer" | { encoding: "buffer" }} BufferEncodingOption
*/
/**
+ * Defines the stat options type used by this module.
* @typedef {object} StatOptions
* @property {(boolean | undefined)=} bigint
*/
/**
+ * Defines the stat sync options type used by this module.
* @typedef {object} StatSyncOptions
* @property {(boolean | undefined)=} bigint
* @property {(boolean | undefined)=} throwIfNoEntry
*/
/**
+ * Describes the readlink shape.
* @typedef {{
- * (path: PathLike, options: EncodingOption, callback: StringCallback): void;
- * (path: PathLike, options: BufferEncodingOption, callback: BufferCallback): void;
- * (path: PathLike, options: EncodingOption, callback: StringOrBufferCallback): void;
- * (path: PathLike, callback: StringCallback): void;
+ * (path: PathLike, options: EncodingOption, callback: StringCallback): void,
+ * (path: PathLike, options: BufferEncodingOption, callback: BufferCallback): void,
+ * (path: PathLike, options: EncodingOption, callback: StringOrBufferCallback): void,
+ * (path: PathLike, callback: StringCallback): void,
* }} Readlink
*/
/**
+ * Describes the readlink sync shape.
* @typedef {{
- * (path: PathLike, options?: EncodingOption): string;
- * (path: PathLike, options: BufferEncodingOption): Buffer;
- * (path: PathLike, options?: EncodingOption): string | Buffer;
+ * (path: PathLike, options?: EncodingOption): string,
+ * (path: PathLike, options: BufferEncodingOption): Buffer,
+ * (path: PathLike, options?: EncodingOption): string | Buffer,
* }} ReadlinkSync
*/
/**
+ * Describes the readdir shape.
* @typedef {{
- * (path: PathLike, options: { encoding: BufferEncoding | null, withFileTypes?: false | undefined, recursive?: boolean | undefined } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, files?: string[]) => void): void;
- * (path: PathLike, options: { encoding: 'buffer', withFileTypes?: false | undefined, recursive?: boolean | undefined } | 'buffer', callback: (err: NodeJS.ErrnoException | null, files?: Buffer[]) => void): void;
- * (path: PathLike, options: (ObjectEncodingOptions & { withFileTypes?: false | undefined, recursive?: boolean | undefined }) | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, files?: string[] | Buffer[]) => void): void;
- * (path: PathLike, callback: (err: NodeJS.ErrnoException | null, files?: string[]) => void): void;
- * (path: PathLike, options: ObjectEncodingOptions & { withFileTypes: true, recursive?: boolean | undefined }, callback: (err: NodeJS.ErrnoException | null, files?: Dirent<string>[]) => void): void;
- * (path: PathLike, options: { encoding: 'buffer', withFileTypes: true, recursive?: boolean | undefined }, callback: (err: NodeJS.ErrnoException | null, files: Dirent<Buffer>[]) => void): void;
+ * (path: PathLike, options: { encoding: BufferEncoding | null, withFileTypes?: false | undefined, recursive?: boolean | undefined } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, files?: string[]) => void): void,
+ * (path: PathLike, options: { encoding: "buffer", withFileTypes?: false | undefined, recursive?: boolean | undefined } | "buffer", callback: (err: NodeJS.ErrnoException | null, files?: Buffer[]) => void): void,
+ * (path: PathLike, options: (ObjectEncodingOptions & { withFileTypes?: false | undefined, recursive?: boolean | undefined }) | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException | null, files?: string[] | Buffer[]) => void): void,
+ * (path: PathLike, callback: (err: NodeJS.ErrnoException | null, files?: string[]) => void): void,
+ * (path: PathLike, options: ObjectEncodingOptions & { withFileTypes: true, recursive?: boolean | undefined }, callback: (err: NodeJS.ErrnoException | null, files?: Dirent<string>[]) => void): void,
+ * (path: PathLike, options: { encoding: "buffer", withFileTypes: true, recursive?: boolean | undefined }, callback: (err: NodeJS.ErrnoException | null, files: Dirent<Buffer>[]) => void): void,
* }} Readdir
*/
/**
+ * Describes the readdir sync shape.
* @typedef {{
- * (path: PathLike, options?: { encoding: BufferEncoding | null, withFileTypes?: false | undefined, recursive?: boolean | undefined; } | BufferEncoding | null): string[];
- * (path: PathLike, options: { encoding: 'buffer', withFileTypes?: false | undefined, recursive?: boolean | undefined } | 'buffer'): Buffer[];
- * (path: PathLike, options?: (ObjectEncodingOptions & { withFileTypes?: false | undefined, recursive?: boolean | undefined }) | BufferEncoding | null): string[] | Buffer[];
- * (path: PathLike, options: ObjectEncodingOptions & { withFileTypes: true, recursive?: boolean | undefined }): Dirent[];
- * (path: PathLike, options: { encoding: "buffer", withFileTypes: true, recursive?: boolean | undefined }): Dirent<Buffer>[];
+ * (path: PathLike, options?: { encoding: BufferEncoding | null, withFileTypes?: false | undefined, recursive?: boolean | undefined } | BufferEncoding | null): string[],
+ * (path: PathLike, options: { encoding: "buffer", withFileTypes?: false | undefined, recursive?: boolean | undefined } | "buffer"): Buffer[],
+ * (path: PathLike, options?: (ObjectEncodingOptions & { withFileTypes?: false | undefined, recursive?: boolean | undefined }) | BufferEncoding | null): string[] | Buffer[],
+ * (path: PathLike, options: ObjectEncodingOptions & { withFileTypes: true, recursive?: boolean | undefined }): Dirent[],
+ * (path: PathLike, options: { encoding: "buffer", withFileTypes: true, recursive?: boolean | undefined }): Dirent<Buffer>[],
* }} ReaddirSync
*/
/**
+ * Describes the stat shape.
* @typedef {{
- * (path: PathLike, callback: StatsCallback): void;
- * (path: PathLike, options: (StatOptions & { bigint?: false | undefined }) | undefined, callback: StatsCallback): void;
- * (path: PathLike, options: StatOptions & { bigint: true }, callback: BigIntStatsCallback): void;
- * (path: PathLike, options: StatOptions | undefined, callback: StatsOrBigIntStatsCallback): void;
+ * (path: PathLike, callback: StatsCallback): void,
+ * (path: PathLike, options: (StatOptions & { bigint?: false | undefined }) | undefined, callback: StatsCallback): void,
+ * (path: PathLike, options: StatOptions & { bigint: true }, callback: BigIntStatsCallback): void,
+ * (path: PathLike, options: StatOptions | undefined, callback: StatsOrBigIntStatsCallback): void,
* }} Stat
*/
/**
+ * Describes the stat sync shape.
* @typedef {{
- * (path: PathLike, options?: undefined): IStats;
- * (path: PathLike, options?: StatSyncOptions & { bigint?: false | undefined, throwIfNoEntry: false }): IStats | undefined;
- * (path: PathLike, options: StatSyncOptions & { bigint: true, throwIfNoEntry: false }): IBigIntStats | undefined;
- * (path: PathLike, options?: StatSyncOptions & { bigint?: false | undefined }): IStats;
- * (path: PathLike, options: StatSyncOptions & { bigint: true }): IBigIntStats;
- * (path: PathLike, options: StatSyncOptions & { bigint: boolean, throwIfNoEntry?: false | undefined }): IStats | IBigIntStats;
- * (path: PathLike, options?: StatSyncOptions): IStats | IBigIntStats | undefined;
+ * (path: PathLike, options?: undefined): IStats,
+ * (path: PathLike, options?: StatSyncOptions & { bigint?: false | undefined, throwIfNoEntry: false }): IStats | undefined,
+ * (path: PathLike, options: StatSyncOptions & { bigint: true, throwIfNoEntry: false }): IBigIntStats | undefined,
+ * (path: PathLike, options?: StatSyncOptions & { bigint?: false | undefined }): IStats,
+ * (path: PathLike, options: StatSyncOptions & { bigint: true }): IBigIntStats,
+ * (path: PathLike, options: StatSyncOptions & { bigint: boolean, throwIfNoEntry?: false | undefined }): IStats | IBigIntStats,
+ * (path: PathLike, options?: StatSyncOptions): IStats | IBigIntStats | undefined,
* }} StatSync
*/
/**
+ * Describes the l stat shape.
* @typedef {{
- * (path: PathLike, callback: StatsCallback): void;
- * (path: PathLike, options: (StatOptions & { bigint?: false | undefined }) | undefined, callback: StatsCallback): void;
- * (path: PathLike, options: StatOptions & { bigint: true }, callback: BigIntStatsCallback): void;
- * (path: PathLike, options: StatOptions | undefined, callback: StatsOrBigIntStatsCallback): void;
+ * (path: PathLike, callback: StatsCallback): void,
+ * (path: PathLike, options: (StatOptions & { bigint?: false | undefined }) | undefined, callback: StatsCallback): void,
+ * (path: PathLike, options: StatOptions & { bigint: true }, callback: BigIntStatsCallback): void,
+ * (path: PathLike, options: StatOptions | undefined, callback: StatsOrBigIntStatsCallback): void,
* }} LStat
*/
/**
+ * Describes the l stat sync shape.
* @typedef {{
- * (path: PathLike, options?: undefined): IStats;
- * (path: PathLike, options?: StatSyncOptions & { bigint?: false | undefined, throwIfNoEntry: false }): IStats | undefined;
- * (path: PathLike, options: StatSyncOptions & { bigint: true, throwIfNoEntry: false }): IBigIntStats | undefined;
- * (path: PathLike, options?: StatSyncOptions & { bigint?: false | undefined }): IStats;
- * (path: PathLike, options: StatSyncOptions & { bigint: true }): IBigIntStats;
- * (path: PathLike, options: StatSyncOptions & { bigint: boolean, throwIfNoEntry?: false | undefined }): IStats | IBigIntStats;
- * (path: PathLike, options?: StatSyncOptions): IStats | IBigIntStats | undefined;
+ * (path: PathLike, options?: undefined): IStats,
+ * (path: PathLike, options?: StatSyncOptions & { bigint?: false | undefined, throwIfNoEntry: false }): IStats | undefined,
+ * (path: PathLike, options: StatSyncOptions & { bigint: true, throwIfNoEntry: false }): IBigIntStats | undefined,
+ * (path: PathLike, options?: StatSyncOptions & { bigint?: false | undefined }): IStats,
+ * (path: PathLike, options: StatSyncOptions & { bigint: true }): IBigIntStats,
+ * (path: PathLike, options: StatSyncOptions & { bigint: boolean, throwIfNoEntry?: false | undefined }): IStats | IBigIntStats,
+ * (path: PathLike, options?: StatSyncOptions): IStats | IBigIntStats | undefined,
* }} LStatSync
*/
/**
+ * Describes the real path shape.
* @typedef {{
- * (path: PathLike, options: EncodingOption, callback: StringCallback): void;
- * (path: PathLike, options: BufferEncodingOption, callback: BufferCallback): void;
- * (path: PathLike, options: EncodingOption, callback: StringOrBufferCallback): void;
- * (path: PathLike, callback: StringCallback): void;
+ * (path: PathLike, options: EncodingOption, callback: StringCallback): void,
+ * (path: PathLike, options: BufferEncodingOption, callback: BufferCallback): void,
+ * (path: PathLike, options: EncodingOption, callback: StringOrBufferCallback): void,
+ * (path: PathLike, callback: StringCallback): void,
* }} RealPath
*/
/**
+ * Describes the real path sync shape.
* @typedef {{
- * (path: PathLike, options?: EncodingOption): string;
- * (path: PathLike, options: BufferEncodingOption): Buffer;
- * (path: PathLike, options?: EncodingOption): string | Buffer;
+ * (path: PathLike, options?: EncodingOption): string,
+ * (path: PathLike, options: BufferEncodingOption): Buffer,
+ * (path: PathLike, options?: EncodingOption): string | Buffer,
* }} RealPathSync
*/
/**
+ * Defines the read json type used by this module.
* @typedef {(pathOrFileDescriptor: PathOrFileDescriptor, callback: ReadJsonCallback) => void} ReadJson
*/
/**
+ * Defines the read json sync type used by this module.
* @typedef {(pathOrFileDescriptor: PathOrFileDescriptor) => JsonObject} ReadJsonSync
*/
/**
+ * Defines the purge type used by this module.
* @typedef {(value?: string | string[] | Set<string>) => void} Purge
*/
/**
+ * Defines the input file system type used by this module.
* @typedef {object} InputFileSystem
* @property {ReadFile} readFile
* @property {ReadFileSync=} readFileSync
@@ -303,61 +335,65 @@
*/
/**
+ * Defines the mode type used by this module.
* @typedef {number | string} Mode
*/
/**
+ * Defines the write file options type used by this module.
* @typedef {(ObjectEncodingOptions & import("events").Abortable & { mode?: Mode | undefined, flag?: string | undefined, flush?: boolean | undefined }) | BufferEncoding | null} WriteFileOptions
*/
/**
+ * Describes the write file shape.
* @typedef {{
- * (file: PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, options: WriteFileOptions, callback: NoParamCallback): void;
- * (file: PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, callback: NoParamCallback): void;
+ * (file: PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, options: WriteFileOptions, callback: NoParamCallback): void,
+ * (file: PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, callback: NoParamCallback): void,
* }} WriteFile
*/
/**
+ * Defines the make directory options type used by this module.
* @typedef {{ recursive?: boolean | undefined, mode?: Mode | undefined }} MakeDirectoryOptions
*/
/**
+ * Describes the mkdir shape.
* @typedef {{
- * (file: PathLike, options: MakeDirectoryOptions & { recursive: true }, callback: StringCallback): void;
- * (file: PathLike, options: Mode | (MakeDirectoryOptions & { recursive?: false | undefined; }) | null | undefined, callback: NoParamCallback): void;
- * (file: PathLike, options: Mode | MakeDirectoryOptions | null | undefined, callback: StringCallback): void;
- * (file: PathLike, callback: NoParamCallback): void;
+ * (file: PathLike, options: MakeDirectoryOptions & { recursive: true }, callback: StringCallback): void,
+ * (file: PathLike, options: Mode | (MakeDirectoryOptions & { recursive?: false | undefined }) | null | undefined, callback: NoParamCallback): void,
+ * (file: PathLike, options: Mode | MakeDirectoryOptions | null | undefined, callback: StringCallback): void,
+ * (file: PathLike, callback: NoParamCallback): void,
* }} Mkdir
*/
/**
- * @typedef {{ maxRetries?: number | undefined, recursive?: boolean | undefined, retryDelay?: number | undefined }} RmDirOptions
+ * Defines the rmdir type used by this module.
+ * @typedef {{ (file: PathLike, callback: NoParamCallback): void }} Rmdir
*/
/**
- * @typedef {{
- * (file: PathLike, callback: NoParamCallback): void;
- * (file: PathLike, options: RmDirOptions, callback: NoParamCallback): void;
- * }} Rmdir
- */
-
-/**
+ * Defines the unlink type used by this module.
* @typedef {(pathLike: PathLike, callback: NoParamCallback) => void} Unlink
*/
/**
+ * Defines the create read stream fs implementation type used by this module.
* @typedef {FSImplementation & { read: (...args: EXPECTED_ANY[]) => EXPECTED_ANY }} CreateReadStreamFSImplementation
*/
/**
+ * Defines the read stream options type used by this module.
* @typedef {StreamOptions & { fs?: CreateReadStreamFSImplementation | null | undefined, end?: number | undefined }} ReadStreamOptions
*/
/**
+ * Defines the create read stream type used by this module.
* @typedef {(path: PathLike, options?: BufferEncoding | ReadStreamOptions) => NodeJS.ReadableStream} CreateReadStream
*/
/**
+ * Defines the output file system type used by this module.
* @typedef {object} OutputFileSystem
* @property {Mkdir} mkdir
* @property {Readdir=} readdir
@@ -374,19 +410,22 @@
*/
/**
+ * Defines the watch file system type used by this module.
* @typedef {object} WatchFileSystem
* @property {WatchMethod} watch
*/
/**
+ * Describes the mkdir sync shape.
* @typedef {{
- * (path: PathLike, options: MakeDirectoryOptions & { recursive: true }): string | undefined;
- * (path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false | undefined }) | null): void;
- * (path: PathLike, options?: Mode | MakeDirectoryOptions | null): string | undefined;
+ * (path: PathLike, options: MakeDirectoryOptions & { recursive: true }): string | undefined,
+ * (path: PathLike, options?: Mode | (MakeDirectoryOptions & { recursive?: false | undefined }) | null): void,
+ * (path: PathLike, options?: Mode | MakeDirectoryOptions | null): string | undefined,
* }} MkdirSync
*/
/**
+ * Defines the stream options type used by this module.
* @typedef {object} StreamOptions
* @property {(string | undefined)=} flags
* @property {(BufferEncoding | undefined)} encoding
@@ -399,40 +438,48 @@
*/
/**
+ * Defines the fs implementation type used by this module.
* @typedef {object} FSImplementation
* @property {((...args: EXPECTED_ANY[]) => EXPECTED_ANY)=} open
* @property {((...args: EXPECTED_ANY[]) => EXPECTED_ANY)=} close
*/
/**
- * @typedef {FSImplementation & { write: (...args: EXPECTED_ANY[]) => EXPECTED_ANY; close?: (...args: EXPECTED_ANY[]) => EXPECTED_ANY }} CreateWriteStreamFSImplementation
+ * Defines the create write stream fs implementation type used by this module.
+ * @typedef {FSImplementation & { write: (...args: EXPECTED_ANY[]) => EXPECTED_ANY, close?: (...args: EXPECTED_ANY[]) => EXPECTED_ANY }} CreateWriteStreamFSImplementation
*/
/**
+ * Defines the write stream options type used by this module.
* @typedef {StreamOptions & { fs?: CreateWriteStreamFSImplementation | null | undefined, flush?: boolean | undefined }} WriteStreamOptions
*/
/**
+ * Defines the create write stream type used by this module.
* @typedef {(pathLike: PathLike, result?: BufferEncoding | WriteStreamOptions) => NodeJS.WritableStream} CreateWriteStream
*/
/**
+ * Defines the open mode type used by this module.
* @typedef {number | string} OpenMode
*/
/**
+ * Describes the open shape.
* @typedef {{
- * (file: PathLike, flags: OpenMode | undefined, mode: Mode | undefined | null, callback: NumberCallback): void;
- * (file: PathLike, flags: OpenMode | undefined, callback: NumberCallback): void;
- * (file: PathLike, callback: NumberCallback): void;
+ * (file: PathLike, flags: OpenMode | undefined, mode: Mode | undefined | null, callback: NumberCallback): void,
+ * (file: PathLike, flags: OpenMode | undefined, callback: NumberCallback): void,
+ * (file: PathLike, callback: NumberCallback): void,
* }} Open
*/
/**
+ * Defines the read position type used by this module.
* @typedef {number | bigint} ReadPosition
*/
/**
+ * Defines the read sync options type used by this module.
* @typedef {object} ReadSyncOptions
* @property {(number | undefined)=} offset
* @property {(number | undefined)=} length
@@ -440,6 +487,7 @@
*/
/**
+ * Defines the read async options type used by this module.
* @template {NodeJS.ArrayBufferView} TBuffer
* @typedef {object} ReadAsyncOptions
* @property {(number | undefined)=} offset
@@ -449,11 +497,12 @@
*/
/**
+ * Defines the shared type used by this module.
* @template {NodeJS.ArrayBufferView} [TBuffer=NodeJS.ArrayBufferView]
* @typedef {{
- * (fd: number, buffer: TBuffer, offset: number, length: number, position: ReadPosition | null, callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void): void;
- * (fd: number, options: ReadAsyncOptions<TBuffer>, callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void): void;
- * (fd: number, callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NodeJS.ArrayBufferView) => void): void;
+ * (fd: number, buffer: TBuffer, offset: number, length: number, position: ReadPosition | null, callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void): void,
+ * (fd: number, options: ReadAsyncOptions<TBuffer>, callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void): void,
+ * (fd: number, callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NodeJS.ArrayBufferView) => void): void,
* }} Read
*/
@@ -462,6 +511,7 @@
/** @typedef {(a: PathLike, b: PathLike, callback: NoParamCallback) => void} Rename */
/**
+ * Defines the intermediate file system extras type used by this module.
* @typedef {object} IntermediateFileSystemExtras
* @property {MkdirSync} mkdirSync
* @property {CreateWriteStream} createWriteStream
@@ -474,7 +524,8 @@
/** @typedef {InputFileSystem & OutputFileSystem & IntermediateFileSystemExtras} IntermediateFileSystem */
/**
- * @param {InputFileSystem | OutputFileSystem|undefined} fs a file system
+ * Returns location of targetPath relative to rootPath.
+ * @param {InputFileSystem | OutputFileSystem | undefined} fs a file system
* @param {string} rootPath the root path
* @param {string} targetPath the target path
* @returns {string} location of targetPath relative to rootPath
@@ -493,7 +544,8 @@
};
/**
- * @param {InputFileSystem|OutputFileSystem|undefined} fs a file system
+ * Returns the joined path.
+ * @param {InputFileSystem | OutputFileSystem | undefined} fs a file system
* @param {string} rootPath a path
* @param {string} filename a filename
* @returns {string} the joined path
@@ -512,7 +564,8 @@
};
/**
- * @param {InputFileSystem|OutputFileSystem|undefined} fs a file system
+ * Returns the parent directory of the absolute path.
+ * @param {InputFileSystem | OutputFileSystem | undefined} fs a file system
* @param {string} absPath an absolute path
* @returns {string} the parent directory of the absolute path
*/
@@ -530,6 +583,7 @@
};
/**
+ * Processes the provided f.
* @param {OutputFileSystem} fs a file system
* @param {string} p an absolute path
* @param {(err?: Error) => void} callback callback function for the error
@@ -574,6 +628,7 @@
};
/**
+ * Processes the provided f.
* @param {IntermediateFileSystem} fs a file system
* @param {string} p an absolute path
* @returns {void}
@@ -600,6 +655,7 @@
};
/**
+ * Processes the provided f.
* @param {InputFileSystem} fs a file system
* @param {string} p an absolute path
* @param {ReadJsonCallback} callback callback
@@ -613,6 +669,7 @@
}
fs.readFile(p, (err, buf) => {
if (err) return callback(err);
+ /** @type {JsonObject} */
let data;
try {
data = JSON.parse(/** @type {Buffer} */ (buf).toString("utf8"));
@@ -624,6 +681,7 @@
};
/**
+ * Lstat readlink absolute.
* @param {InputFileSystem} fs a file system
* @param {string} p an absolute path
* @param {(err: NodeJS.ErrnoException | Error | null, stats?: IStats | string) => void} callback callback
@@ -663,6 +721,7 @@
};
/**
+ * Checks whether this object is absolute.
* @param {string} pathname a path
* @returns {boolean} is absolute
*/
--
Gitblit v1.9.3