Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@rspack/core

Package Overview
Dependencies
Maintainers
2
Versions
1211
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rspack/core - npm Package Compare versions

Comparing version
2.0.1
to
2.0.2
+333
compiled/watchpack/types/DirectoryWatcher.d.ts
export = DirectoryWatcher;
/** @typedef {Set<string>} InitialScanRemoved */
/**
* @typedef {object} WatchpackEvents
* @property {(target: string, mtime: string, type: EventType, initial: boolean) => void} change change event
* @property {() => void} closed closed event
*/
/**
* @typedef {object} DirectoryWatcherOptions
* @property {boolean=} followSymlinks true when need to resolve symlinks and watch symlink and real file, otherwise false
* @property {IgnoredFunction=} ignored ignore some files from watching (glob pattern or regexp)
* @property {number | boolean=} poll true when need to enable polling mode for watching, otherwise false
*/
/**
* @extends {EventEmitter<{ [K in keyof WatchpackEvents]: Parameters<WatchpackEvents[K]> }>}
*/
declare class DirectoryWatcher extends EventEmitter<{
/**
* change event
*/
change: [
target: string,
mtime: string,
type: import("./index").EventType,
initial: boolean,
];
/**
* closed event
*/
closed: [];
}> {
/**
* @param {WatcherManager} watcherManager a watcher manager
* @param {string} directoryPath directory path
* @param {DirectoryWatcherOptions=} options options
*/
constructor(
watcherManager: WatcherManager,
directoryPath: string,
options?: DirectoryWatcherOptions | undefined,
);
watcherManager: import("./getWatcherManager").WatcherManager;
options: DirectoryWatcherOptions;
path: string;
/** @type {Map<string, Entry>} */
files: Map<string, Entry>;
/** @type {Map<string, number>} */
filesWithoutCase: Map<string, number>;
/** @type {Map<string, Watcher<DirectoryWatcherEvents> | boolean>} */
directories: Map<string, Watcher<DirectoryWatcherEvents> | boolean>;
lastWatchEvent: number;
initialScan: boolean;
ignored: import("./index").IgnoredFunction;
nestedWatching: boolean;
/** @type {number | false} */
polledWatching: number | false;
/** @type {undefined | NodeJS.Timeout} */
timeout: undefined | NodeJS.Timeout;
/** @type {null | InitialScanRemoved} */
initialScanRemoved: null | InitialScanRemoved;
/** @type {undefined | number} */
initialScanFinished: undefined | number;
/** @type {Map<string, Set<Watcher<DirectoryWatcherEvents> | Watcher<FileWatcherEvents>>>} */
watchers: Map<
string,
Set<Watcher<DirectoryWatcherEvents> | Watcher<FileWatcherEvents>>
>;
/** @type {Watcher<FileWatcherEvents> | null} */
parentWatcher: Watcher<FileWatcherEvents> | null;
refs: number;
/** @type {Map<string, boolean>} */
_activeEvents: Map<string, boolean>;
closed: boolean;
scanning: boolean;
scanAgain: boolean;
scanAgainInitial: boolean;
createWatcher(): void;
watcher: watchEventSource.Watcher | null | undefined;
/**
* @template {(watcher: Watcher<EventMap>) => void} T
* @param {string} path path
* @param {T} fn function
*/
forEachWatcher<T extends (watcher: Watcher<EventMap>) => void>(
path: string,
fn: T,
): void;
/**
* @param {string} itemPath an item path
* @param {boolean} initial true when initial, otherwise false
* @param {EventType} type even type
*/
setMissing(itemPath: string, initial: boolean, type: EventType): void;
/**
* @param {string} target a target to set file time
* @param {number} mtime mtime
* @param {boolean} initial true when initial, otherwise false
* @param {boolean} ignoreWhenEqual true to ignore when equal, otherwise false
* @param {EventType} type type
*/
setFileTime(
target: string,
mtime: number,
initial: boolean,
ignoreWhenEqual: boolean,
type: EventType,
): void;
/**
* @param {string} directoryPath directory path
* @param {number} birthtime birthtime
* @param {boolean} initial true when initial, otherwise false
* @param {EventType} type even type
*/
setDirectory(
directoryPath: string,
birthtime: number,
initial: boolean,
type: EventType,
): void;
/**
* @param {string} directoryPath directory path
*/
createNestedWatcher(directoryPath: string): void;
/**
* @param {boolean} flag true when nested, otherwise false
*/
setNestedWatching(flag: boolean): void;
/**
* @param {string} target a target to watch
* @param {number=} startTime start time
* @returns {Watcher<DirectoryWatcherEvents> | Watcher<FileWatcherEvents>} watcher
*/
watch(
target: string,
startTime?: number | undefined,
): Watcher<DirectoryWatcherEvents> | Watcher<FileWatcherEvents>;
/**
* @param {EventType} eventType event type
* @param {string=} filename filename
*/
onWatchEvent(eventType: EventType, filename?: string | undefined): void;
/**
* @param {unknown=} err error
*/
onWatcherError(err?: unknown | undefined): void;
/**
* @param {Error | NodeJS.ErrnoException=} err error
*/
onStatsError(err?: (Error | NodeJS.ErrnoException) | undefined): void;
/**
* @param {Error | NodeJS.ErrnoException=} err error
*/
onScanError(err?: (Error | NodeJS.ErrnoException) | undefined): void;
onScanFinished(): void;
/**
* @param {string} reason a reason
*/
onDirectoryRemoved(reason: string): void;
watchInParentDirectory(): void;
/**
* @param {boolean} initial true when initial, otherwise false
*/
doScan(initial: boolean): void;
/**
* @returns {Record<string, number>} times
*/
getTimes(): Record<string, number>;
/**
* @param {TimeInfoEntries} fileTimestamps file timestamps
* @param {TimeInfoEntries} directoryTimestamps directory timestamps
* @returns {number} safe time
*/
collectTimeInfoEntries(
fileTimestamps: TimeInfoEntries,
directoryTimestamps: TimeInfoEntries,
): number;
close(): void;
}
declare namespace DirectoryWatcher {
export {
EXISTANCE_ONLY_TIME_ENTRY,
Watcher,
IgnoredFunction,
EventType,
TimeInfoEntries,
Entry,
ExistenceOnlyTimeEntry,
OnlySafeTimeEntry,
EventMap,
WatcherManager,
EventSourceWatcher,
FileWatcherEvents,
DirectoryWatcherEvents,
InitialScanRemoved,
WatchpackEvents,
DirectoryWatcherOptions,
};
}
import { EventEmitter } from "events";
/**
* @typedef {object} FileWatcherEvents
* @property {(type: EventType) => void} initial-missing initial missing event
* @property {(mtime: number, type: EventType, initial: boolean) => void} change change event
* @property {(type: EventType) => void} remove remove event
* @property {() => void} closed closed event
*/
/**
* @typedef {object} DirectoryWatcherEvents
* @property {(type: EventType) => void} initial-missing initial missing event
* @property {((file: string, mtime: number, type: EventType, initial: boolean) => void)} change change event
* @property {(type: EventType) => void} remove remove event
* @property {() => void} closed closed event
*/
/**
* @template {EventMap} T
* @extends {EventEmitter<{ [K in keyof T]: Parameters<T[K]> }>}
*/
declare class Watcher<T extends EventMap> extends EventEmitter<{
[K in keyof T]: Parameters<T[K]>;
}> {
/**
* @param {DirectoryWatcher} directoryWatcher a directory watcher
* @param {string} target a target to watch
* @param {number=} startTime start time
*/
constructor(
directoryWatcher: DirectoryWatcher,
target: string,
startTime?: number | undefined,
);
directoryWatcher: DirectoryWatcher;
path: string;
startTime: number | undefined;
/**
* @param {number} mtime mtime
* @param {boolean} initial true when initial, otherwise false
* @returns {boolean} true of start time less than mtile, otherwise false
*/
checkStartTime(mtime: number, initial: boolean): boolean;
close(): void;
}
import watchEventSource = require("./watchEventSource");
/** @typedef {import("./index").IgnoredFunction} IgnoredFunction */
/** @typedef {import("./index").EventType} EventType */
/** @typedef {import("./index").TimeInfoEntries} TimeInfoEntries */
/** @typedef {import("./index").Entry} Entry */
/** @typedef {import("./index").ExistenceOnlyTimeEntry} ExistenceOnlyTimeEntry */
/** @typedef {import("./index").OnlySafeTimeEntry} OnlySafeTimeEntry */
/** @typedef {import("./index").EventMap} EventMap */
/** @typedef {import("./getWatcherManager").WatcherManager} WatcherManager */
/** @typedef {import("./watchEventSource").Watcher} EventSourceWatcher */
/** @type {ExistenceOnlyTimeEntry} */
declare const EXISTANCE_ONLY_TIME_ENTRY: ExistenceOnlyTimeEntry;
type IgnoredFunction = import("./index").IgnoredFunction;
type EventType = import("./index").EventType;
type TimeInfoEntries = import("./index").TimeInfoEntries;
type Entry = import("./index").Entry;
type ExistenceOnlyTimeEntry = import("./index").ExistenceOnlyTimeEntry;
type OnlySafeTimeEntry = import("./index").OnlySafeTimeEntry;
type EventMap = import("./index").EventMap;
type WatcherManager = import("./getWatcherManager").WatcherManager;
type EventSourceWatcher = import("./watchEventSource").Watcher;
type FileWatcherEvents = {
/**
* initial missing event
*/
"initial-missing": (type: EventType) => void;
/**
* change event
*/
change: (mtime: number, type: EventType, initial: boolean) => void;
/**
* remove event
*/
remove: (type: EventType) => void;
/**
* closed event
*/
closed: () => void;
};
type DirectoryWatcherEvents = {
/**
* initial missing event
*/
"initial-missing": (type: EventType) => void;
/**
* change event
*/
change: (
file: string,
mtime: number,
type: EventType,
initial: boolean,
) => void;
/**
* remove event
*/
remove: (type: EventType) => void;
/**
* closed event
*/
closed: () => void;
};
type InitialScanRemoved = Set<string>;
type WatchpackEvents = {
/**
* change event
*/
change: (
target: string,
mtime: string,
type: EventType,
initial: boolean,
) => void;
/**
* closed event
*/
closed: () => void;
};
type DirectoryWatcherOptions = {
/**
* true when need to resolve symlinks and watch symlink and real file, otherwise false
*/
followSymlinks?: boolean | undefined;
/**
* ignore some files from watching (glob pattern or regexp)
*/
ignored?: IgnoredFunction | undefined;
/**
* true when need to enable polling mode for watching, otherwise false
*/
poll?: (number | boolean) | undefined;
};
declare namespace _exports {
export {
EventMap,
DirectoryWatcherOptions,
DirectoryWatcherEvents,
FileWatcherEvents,
Watcher,
};
}
declare function _exports(options: DirectoryWatcherOptions): WatcherManager;
declare namespace _exports {
export { WatcherManager };
}
export = _exports;
type EventMap = import("./index").EventMap;
type DirectoryWatcherOptions =
import("./DirectoryWatcher").DirectoryWatcherOptions;
type DirectoryWatcherEvents =
import("./DirectoryWatcher").DirectoryWatcherEvents;
type FileWatcherEvents = import("./DirectoryWatcher").FileWatcherEvents;
type Watcher<T extends EventMap> = import("./DirectoryWatcher").Watcher<T>;
/** @typedef {import("./index").EventMap} EventMap */
/** @typedef {import("./DirectoryWatcher").DirectoryWatcherOptions} DirectoryWatcherOptions */
/** @typedef {import("./DirectoryWatcher").DirectoryWatcherEvents} DirectoryWatcherEvents */
/** @typedef {import("./DirectoryWatcher").FileWatcherEvents} FileWatcherEvents */
/**
* @template {EventMap} T
* @typedef {import("./DirectoryWatcher").Watcher<T>} Watcher
*/
declare class WatcherManager {
/**
* @param {DirectoryWatcherOptions=} options options
*/
constructor(options?: DirectoryWatcherOptions | undefined);
options: DirectoryWatcher.DirectoryWatcherOptions;
/** @type {Map<string, DirectoryWatcher>} */
directoryWatchers: Map<string, DirectoryWatcher>;
/**
* @param {string} directory a directory
* @returns {DirectoryWatcher} a directory watcher
*/
getDirectoryWatcher(directory: string): DirectoryWatcher;
/**
* @param {string} file file
* @param {number=} startTime start time
* @returns {Watcher<FileWatcherEvents> | null} watcher or null if file has no directory
*/
watchFile(
file: string,
startTime?: number | undefined,
): Watcher<FileWatcherEvents> | null;
/**
* @param {string} directory directory
* @param {number=} startTime start time
* @returns {Watcher<DirectoryWatcherEvents>} watcher
*/
watchDirectory(
directory: string,
startTime?: number | undefined,
): Watcher<DirectoryWatcherEvents>;
}
import DirectoryWatcher = require("./DirectoryWatcher");
export = Watchpack;
/**
* @typedef {object} WatchpackEvents
* @property {(file: string, mtime: number, type: EventType) => void} change change event
* @property {(file: string, type: EventType) => void} remove remove event
* @property {(changes: Changes, removals: Removals) => void} aggregated aggregated event
*/
/**
* @extends {EventEmitter<{ [K in keyof WatchpackEvents]: Parameters<WatchpackEvents[K]> }>}
*/
declare class Watchpack extends EventEmitter<{
/**
* change event
*/
change: [file: string, mtime: number, type: EventType];
/**
* remove event
*/
remove: [file: string, type: EventType];
/**
* aggregated event
*/
aggregated: [changes: Changes, removals: Removals];
}> {
/**
* @param {WatchOptions=} options options
*/
constructor(options?: WatchOptions | undefined);
/** @type {WatchOptions} */
options: WatchOptions;
aggregateTimeout: number;
/** @type {NormalizedWatchOptions} */
watcherOptions: NormalizedWatchOptions;
/** @type {WatcherManager} */
watcherManager: WatcherManager;
/** @type {Map<string, WatchpackFileWatcher>} */
fileWatchers: Map<string, WatchpackFileWatcher>;
/** @type {Map<string, WatchpackDirectoryWatcher>} */
directoryWatchers: Map<string, WatchpackDirectoryWatcher>;
/** @type {Set<string>} */
_missing: Set<string>;
startTime: number | undefined;
paused: boolean;
/** @type {Changes} */
aggregatedChanges: Changes;
/** @type {Removals} */
aggregatedRemovals: Removals;
/** @type {undefined | NodeJS.Timeout} */
aggregateTimer: undefined | NodeJS.Timeout;
_onTimeout(): void;
/**
* @overload
* @param {Iterable<string>} arg1 files
* @param {Iterable<string>} arg2 directories
* @param {number=} arg3 startTime
* @returns {void}
*/
watch(
arg1: Iterable<string>,
arg2: Iterable<string>,
arg3?: number | undefined,
): void;
/**
* @overload
* @param {WatchMethodOptions} arg1 watch options
* @returns {void}
*/
watch(arg1: WatchMethodOptions): void;
close(): void;
pause(): void;
/**
* @returns {Record<string, number>} times
*/
getTimes(): Record<string, number>;
/**
* @returns {TimeInfoEntries} time info entries
*/
getTimeInfoEntries(): TimeInfoEntries;
/**
* @param {TimeInfoEntries} fileTimestamps file timestamps
* @param {TimeInfoEntries} directoryTimestamps directory timestamps
*/
collectTimeInfoEntries(
fileTimestamps: TimeInfoEntries,
directoryTimestamps: TimeInfoEntries,
): void;
/**
* @returns {Aggregated} aggregated info
*/
getAggregated(): Aggregated;
/**
* @param {string} item item
* @param {number} mtime mtime
* @param {string} file file
* @param {EventType} type type
*/
_onChange(item: string, mtime: number, file: string, type: EventType): void;
/**
* @param {string} item item
* @param {string} file file
* @param {EventType} type type
*/
_onRemove(item: string, file: string, type: EventType): void;
}
declare namespace Watchpack {
export {
WatcherManager,
DirectoryWatcher,
DirectoryWatcherEvents,
FileWatcherEvents,
EventMap,
Watcher,
IgnoredFunction,
Ignored,
WatcherOptions,
WatchOptions,
NormalizedWatchOptions,
EventType,
Entry,
OnlySafeTimeEntry,
ExistenceOnlyTimeEntry,
TimeInfoEntries,
Changes,
Removals,
Aggregated,
WatchMethodOptions,
Times,
WatchpackEvents,
};
}
import { EventEmitter } from "events";
declare class WatchpackFileWatcher {
/**
* @param {Watchpack} watchpack watchpack
* @param {Watcher<FileWatcherEvents>} watcher watcher
* @param {string | string[]} files files
*/
constructor(
watchpack: Watchpack,
watcher: Watcher<FileWatcherEvents>,
files: string | string[],
);
/** @type {string[]} */
files: string[];
watcher: import("./DirectoryWatcher").Watcher<
import("./DirectoryWatcher").FileWatcherEvents
>;
/**
* @param {string | string[]} files files
*/
update(files: string | string[]): void;
close(): void;
}
declare class WatchpackDirectoryWatcher {
/**
* @param {Watchpack} watchpack watchpack
* @param {Watcher<DirectoryWatcherEvents>} watcher watcher
* @param {string} directories directories
*/
constructor(
watchpack: Watchpack,
watcher: Watcher<DirectoryWatcherEvents>,
directories: string,
);
/** @type {string[]} */
directories: string[];
watcher: import("./DirectoryWatcher").Watcher<
import("./DirectoryWatcher").DirectoryWatcherEvents
>;
/**
* @param {string | string[]} directories directories
*/
update(directories: string | string[]): void;
close(): void;
}
type WatcherManager = import("./getWatcherManager").WatcherManager;
type DirectoryWatcher = import("./DirectoryWatcher");
type DirectoryWatcherEvents =
import("./DirectoryWatcher").DirectoryWatcherEvents;
type FileWatcherEvents = import("./DirectoryWatcher").FileWatcherEvents;
type EventMap = Record<string, (...args: any[]) => any>;
type Watcher<T extends EventMap> = import("./DirectoryWatcher").Watcher<T>;
type IgnoredFunction = (item: string) => boolean;
type Ignored = string[] | RegExp | string | IgnoredFunction;
type WatcherOptions = {
/**
* true when need to resolve symlinks and watch symlink and real file, otherwise false
*/
followSymlinks?: boolean | undefined;
/**
* ignore some files from watching (glob pattern or regexp)
*/
ignored?: Ignored | undefined;
/**
* true when need to enable polling mode for watching, otherwise false
*/
poll?: (number | boolean) | undefined;
};
type WatchOptions = WatcherOptions & {
aggregateTimeout?: number;
};
type NormalizedWatchOptions = {
/**
* true when need to resolve symlinks and watch symlink and real file, otherwise false
*/
followSymlinks: boolean;
/**
* ignore some files from watching (glob pattern or regexp)
*/
ignored: IgnoredFunction;
/**
* true when need to enable polling mode for watching, otherwise false
*/
poll?: (number | boolean) | undefined;
};
type EventType =
| `scan (${string})`
| "change"
| "rename"
| `watch ${string}`
| `directory-removed ${string}`;
type Entry = {
safeTime: number;
timestamp: number;
accuracy: number;
};
type OnlySafeTimeEntry = {
safeTime: number;
};
type ExistenceOnlyTimeEntry = {};
type TimeInfoEntries = Map<
string,
Entry | OnlySafeTimeEntry | ExistenceOnlyTimeEntry | null
>;
type Changes = Set<string>;
type Removals = Set<string>;
type Aggregated = {
changes: Changes;
removals: Removals;
};
type WatchMethodOptions = {
files?: Iterable<string>;
directories?: Iterable<string>;
missing?: Iterable<string>;
startTime?: number;
};
type Times = Record<string, number>;
type WatchpackEvents = {
/**
* change event
*/
change: (file: string, mtime: number, type: EventType) => void;
/**
* remove event
*/
remove: (file: string, type: EventType) => void;
/**
* aggregated event
*/
aggregated: (changes: Changes, removals: Removals) => void;
};
export = LinkResolver;
declare class LinkResolver {
/** @type {Map<string, readonly string[]>} */
cache: Map<string, readonly string[]>;
/**
* @param {string} file path to file or directory
* @returns {readonly string[]} array of file and all symlinks contributed in the resolving process (first item is the resolved file)
*/
resolve(file: string): readonly string[];
}
declare namespace _exports {
export { TreeNode };
}
declare function _exports<T>(
plan: Map<string, T[] | T>,
limit: number,
): Map<string, Map<T, string>>;
export = _exports;
type TreeNode<T> = {
/**
* target
*/
target: string;
/**
* parent
*/
parent: TreeNode<T>;
/**
* children
*/
children: TreeNode<T>[];
/**
* number of entries
*/
entries: number;
/**
* true when active, otherwise false
*/
active: boolean;
/**
* value
*/
value: T[] | T | undefined;
};
export function batch(fn: () => void): void;
export function getNumberOfWatchers(): number;
export function watch(filePath: string): Watcher;
export type FSWatcher = import("fs").FSWatcher;
export type EventType = import("./index").EventType;
export type WatcherSet = Set<Watcher>;
export type WatcherEvents = {
/**
* change event
*/
change: (eventType: EventType, filename?: string) => void;
/**
* error event
*/
error: (err: unknown) => void;
};
/**
* @typedef {object} WatcherEvents
* @property {(eventType: EventType, filename?: string) => void} change change event
* @property {(err: unknown) => void} error error event
*/
/**
* @extends {EventEmitter<{ [K in keyof WatcherEvents]: Parameters<WatcherEvents[K]> }>}
*/
export class Watcher extends EventEmitter<{
/**
* change event
*/
change: [
eventType: import("./index").EventType,
filename?: string | undefined,
];
/**
* error event
*/
error: [err: unknown];
}> {
constructor();
close(): void;
}
/**
* @param {FSWatcher} watcher watcher
* @param {string} filePath a file path
* @param {(type: "rename" | "change", filename: string) => void} handleChangeEvent function to handle change
* @returns {(type: "rename" | "change", filename: string) => void} handler of change event
*/
export function createHandleChangeEvent(
watcher: FSWatcher,
filePath: string,
handleChangeEvent: (type: "rename" | "change", filename: string) => void,
): (type: "rename" | "change", filename: string) => void;
export const watcherLimit: number;
import { EventEmitter } from "events";
declare const _exports: typeof import("./index");
export = _exports;
+1
-26

@@ -8,4 +8,2 @@ import * as http from 'node:http';

import * as stream from 'node:stream';
import { HttpBindings } from '@hono/node-server';
import { MiddlewareHandler } from 'hono';

@@ -334,25 +332,2 @@ interface ProxyTargetDetailed {

/**
* Creates a Hono middleware that proxies requests using http-proxy-middleware.
*
* `@remarks`
* This middleware requires Hono to be running on Node.js via `@hono/node-server`.
* It uses `c.env.incoming` and `c.env.outgoing` which are only available with `HttpBindings`.
*
* `@experimental` This API is experimental and may change without a major version bump.
*
* `@example`
* ```ts
* import { serve } from '@hono/node-server';
* import { Hono } from 'hono';
* import { createHonoProxyMiddleware } from 'http-proxy-middleware';
*
* const app = new Hono();
* app.use('/api', createHonoProxyMiddleware({ target: 'http://example.com', changeOrigin: true }));
* serve(app);
*/
declare function createHonoProxyMiddleware(options: Options): MiddlewareHandler<{
Bindings: HttpBindings;
}>;
type Interceptor<TReq = http.IncomingMessage, TRes = http.ServerResponse> = (buffer: Buffer, proxyRes: http.IncomingMessage, req: TReq, res: TRes) => Promise<Buffer | string>;

@@ -408,3 +383,3 @@ /**

export { createHonoProxyMiddleware, createProxyMiddleware, debugProxyErrorsPlugin, errorResponsePlugin, fixRequestBody, loggerPlugin, proxyEventsPlugin, responseInterceptor };
export { createProxyMiddleware, debugProxyErrorsPlugin, errorResponsePlugin, fixRequestBody, loggerPlugin, proxyEventsPlugin, responseInterceptor };
export type { Filter, Options, Plugin, RequestHandler };

@@ -1,1 +0,1 @@

{"name":"http-proxy-middleware","author":"Steven Chim","version":"4.0.0-beta.5","license":"MIT","types":"index.d.ts","type":"module"}
{"name":"http-proxy-middleware","author":"Steven Chim","version":"4.0.0-beta.6","license":"MIT","types":"index.d.ts","type":"module"}

@@ -1,219 +0,3 @@

/// <reference types="node" />
import { EventEmitter } from 'events';
// @ts-ignore
import fs from 'graceful-fs';
declare class DirectoryWatcher extends EventEmitter {
options: Watchpack.WatcherOptions;
directories: {
[path: string]: Watcher | true;
};
files: {
[path: string]: [number, number];
};
initialScan: boolean;
initialScanRemoved: string[];
nestedWatching: boolean;
path: string;
refs: number;
watcher: fs.FSWatcher;
watchers: {
[path: string]: Watcher[];
};
constructor(directoryPath: string, options: Watchpack.WatcherOptions);
setFileTime(filePath: string, mtime: number, initial: boolean, type?: string | boolean): void;
setDirectory(directoryPath: string, exist: boolean, initial: boolean): void;
createNestedWatcher(directoryPath: string): void;
setNestedWatching(flag: boolean): void;
watch(filePath: string, startTime: number): Watcher;
onFileAdded(filePath: string, stat: fs.Stats): void;
onDirectoryAdded(directoryPath: string): void;
onChange(filePath: string, stat: fs.Stats): void;
onFileUnlinked(filePath: string): void;
onDirectoryUnlinked(directoryPath: string): void;
onWatcherError(): void;
doInitialScan(): void;
getTimes(): {
[path: string]: number;
};
close(): void;
}
declare class Watcher extends EventEmitter {
data: number;
directoryWatcher: DirectoryWatcher;
path: string;
startTime: number;
constructor(directoryWatcher: DirectoryWatcher, filePath: string, startTime: number);
checkStartTime(mtime: number, initial: boolean): boolean;
close(): void;
}
interface Entry {
/** A point in time at which is it safe to say all changes happened before that */
safeTime: number;
/** Only for file entries: the last modified timestamp of the file */
timestamp: number;
}
declare class Watchpack extends EventEmitter {
aggregatedChanges: Set<string>;
aggregatedRemovals: Set<string>;
aggregateTimeout: number;
dirWatchers: Watcher[];
fileWatchers: Watcher[];
/** Last modified times for files by path */
mtimes: {
[path: string]: number;
};
options: Watchpack.WatchOptions;
paused: boolean;
watcherOptions: Watchpack.WatcherOptions;
constructor(options: Watchpack.WatchOptions);
/**
* Starts watching these files and directories
* Calling this again will override the files and directories
*/
watch(options: {
/**
* Can be files or directories
* For files: content and existence changes are tracked
* For directories: only existence and timestamp changes are tracked
*/
files?: Iterable<string>;
/**
* Can only be directories
* Directory content (and content of children, ...) and existence changes are tracked.
* For files: content and existence changes are tracked
* Assumed to exist, when directory is not found without further information a remove event is emitted
*/
directories?: Iterable<string>;
/**
* Can be files or directories
* Only existence changes are tracked
* Assued to not exist, no remove event is emitted when not found initially
*/
missing?: Iterable<string>;
startTime?: number;
}): void;
on(
eventName: "change",
listener: (
/** The changed file or directory */
filePath: string,
/** The last modified time of the changed file */
modifiedTime: number,
/** Textual information how this change was detected */
explanation: string,
) => void,
): this;
on(
eventName: "remove",
listener: (
/** The removed file or directory */
filePath: string,
/** Textual information how this change was detected */
explanation: string,
) => void,
): this;
on(
eventName: "aggregated",
listener: (
/** Set of all changed files */
changes: Set<string>,
/** Set of all removed files */
removals: Set<string>,
) => void,
): this;
/**
* Stops emitting events, but keeps watchers open
* The next "watch" call can reuse the watchers
* The watcher will keep aggregating events which can be received with `getAggregated()`
*/
pause(): void;
/**
* Stops emitting events and closes all watchers
*/
close(): void;
/**
* Returns the current aggregated info and removes that from the watcher
* The next aggregated event won't include that info and will only emitted when futher changes happen
* Can be used when paused
*/
getAggregated(): {
changes: Set<string>;
removals: Set<string>;
};
/**
* Collects time info objects for all known files and directories
* This includes info from files not directly watched
*/
collectTimeInfoEntries(fileInfoEntries: Map<string, Entry>, directoryInfoEntries: Map<string, Entry>): void;
/**
* Returns a `Map` with all known time info objects for files and directories
* Similar to `collectTimeInfoEntries()` but returns a single map with all entries
*/
getTimeInfoEntries(): Map<string, Entry>;
/**
* Returns an object with all known change times for files
* This include timestamps from files not directly watched
* Key: absolute path, value: timestamp as number
* @deprecated
*/
getTimes(): {
[path: string]: number;
};
_fileWatcher(file: string, watcher: Watcher): Watcher;
_dirWatcher(item: string, watcher: Watcher): Watcher;
_onChange(item: string, mtime: number, file?: string): void;
_onTimeout(): void;
}
declare namespace Watchpack {
interface WatcherOptions {
ignored?: string[] | string | RegExp | ((path: string) => boolean) | undefined;
poll?: boolean | number | undefined;
followSymlinks?: boolean;
}
interface WatchOptions extends WatcherOptions {
aggregateTimeout?: number | undefined;
}
}
export { Watchpack as default };
import Watchpack = require("./types/index");
export default Watchpack;
export type WatchOptions = Watchpack.WatchOptions;

@@ -1,1 +0,8 @@

{"name":"watchpack","author":"Tobias Koppers @sokra","version":"2.4.4","license":"MIT","types":"index.d.ts","type":"commonjs"}
{
"name": "watchpack",
"author": "Tobias Koppers @sokra",
"version": "2.5.1",
"license": "MIT",
"types": "index.d.ts",
"type": "commonjs"
}

@@ -1,5 +0,5 @@

import { RscClientPlugin, type RscClientPluginOptions } from './RscClientPlugin.js';
import { RscServerPlugin } from './RscServerPlugin.js';
import { RscClientPlugin } from './RscClientPlugin.js';
import { RscServerPlugin, type RscServerPluginOptions } from './RscServerPlugin.js';
declare class ServerPlugin extends RscServerPlugin {
constructor(options?: Omit<RscClientPluginOptions, 'coordinator'>);
constructor(options?: Omit<RscServerPluginOptions, 'coordinator'>);
}

@@ -10,3 +10,3 @@ declare class ClientPlugin extends RscClientPlugin {

createPlugins: () => {
ServerPlugin: new (options?: Omit<RscClientPluginOptions, "coordinator">) => ServerPlugin;
ServerPlugin: new (options?: Omit<RscServerPluginOptions, "coordinator">) => ServerPlugin;
ClientPlugin: new () => ClientPlugin;

@@ -13,0 +13,0 @@ };

@@ -32,3 +32,3 @@ import type binding from '@rspack/binding';

coordinator: Coordinator;
onServerComponentChanges?: () => Promise<void>;
onServerComponentChanges?: () => void | Promise<void>;
onManifest?: (manifest: RscManifest) => void | Promise<void>;

@@ -35,0 +35,0 @@ };

@@ -48,3 +48,3 @@ /**

export type ChunkPathData = {
id?: string;
id?: string | number;
name?: string;

@@ -60,3 +60,3 @@ hash?: string;

url?: string;
id?: string;
id?: string | number;
chunk?: Chunk | ChunkPathData;

@@ -63,0 +63,0 @@ contentHashType?: string;

@@ -80,5 +80,5 @@ import type binding from '@rspack/binding';

chunkIdHints?: (string | number)[];
chunks?: (string | null | undefined)[];
chunks?: (string | number | null | undefined)[];
auxiliaryChunkNames?: (string | number)[];
auxiliaryChunks?: (string | null | undefined)[];
auxiliaryChunks?: (string | number | null | undefined)[];
auxiliaryChunkIdHints?: (string | number)[];

@@ -112,3 +112,3 @@ filteredRelated?: number;

issuerId?: string | number | null;
chunks?: string[];
chunks?: (string | number)[];
assets?: string[];

@@ -115,0 +115,0 @@ dependent?: boolean;

{
"name": "@rspack/core",
"version": "2.0.1",
"version": "2.0.2",
"webpackVersion": "5.75.0",

@@ -47,3 +47,2 @@ "license": "MIT",

"@types/node": "^20.19.39",
"@types/watchpack": "^2.4.5",
"browserslist-load-config": "^1.0.1",

@@ -53,4 +52,4 @@ "browserslist-to-es-version": "^1.4.1",

"enhanced-resolve": "5.21.0",
"http-proxy-middleware": "^4.0.0-beta.5",
"memfs": "4.53.0",
"http-proxy-middleware": "^4.0.0-beta.6",
"memfs": "4.57.2",
"open": "^11.0.0",

@@ -60,7 +59,7 @@ "prebundle": "^1.6.4",

"typescript": "^6.0.3",
"watchpack": "2.4.4",
"watchpack": "2.5.1",
"webpack-sources": "3.3.4"
},
"dependencies": {
"@rspack/binding": "2.0.1"
"@rspack/binding": "2.0.2"
},

@@ -67,0 +66,0 @@ "peerDependencies": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display