@rspack/core 2.0.1 → 2.0.3

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 (47) hide show
  1. package/compiled/http-proxy-middleware/index.d.ts +5 -30
  2. package/compiled/http-proxy-middleware/package.json +1 -1
  3. package/compiled/watchpack/index.d.ts +2 -218
  4. package/compiled/watchpack/index.js +1387 -939
  5. package/compiled/watchpack/package.json +8 -1
  6. package/compiled/watchpack/types/DirectoryWatcher.d.ts +333 -0
  7. package/compiled/watchpack/types/LinkResolver.d.ts +10 -0
  8. package/compiled/watchpack/types/getWatcherManager.d.ts +62 -0
  9. package/compiled/watchpack/types/index.d.ts +261 -0
  10. package/compiled/watchpack/types/reducePlan.d.ts +34 -0
  11. package/compiled/watchpack/types/watchEventSource.d.ts +53 -0
  12. package/compiled/watchpack/types/watchpack.d.ts +2 -0
  13. package/dist/Compilation.d.ts +3 -3
  14. package/dist/MultiCompiler.d.ts +1 -1
  15. package/dist/RuntimeGlobals.d.ts +1 -1
  16. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -1
  17. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -1
  18. package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +1 -1
  19. package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -1
  20. package/dist/builtin-plugin/HttpUriPlugin.d.ts +1 -1
  21. package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +1 -1
  22. package/dist/builtin-plugin/MangleExportsPlugin.d.ts +1 -1
  23. package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +1 -1
  24. package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +1 -1
  25. package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +1 -1
  26. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -1
  27. package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +2 -2
  28. package/dist/builtin-plugin/SplitChunksPlugin.d.ts +1 -1
  29. package/dist/builtin-plugin/WorkerPlugin.d.ts +1 -1
  30. package/dist/builtin-plugin/rsc/RscServerPlugin.d.ts +8 -1
  31. package/dist/builtin-plugin/rsc/index.d.ts +6 -6
  32. package/dist/config/target.d.ts +1 -1
  33. package/dist/config/types.d.ts +4 -4
  34. package/dist/exports.d.ts +1 -1
  35. package/dist/index.js +35 -25
  36. package/dist/lib/CacheFacade.d.ts +1 -1
  37. package/dist/runtime/cssExtractHmr.d.ts +2 -2
  38. package/dist/runtime/moduleFederationDefaultRuntime.d.ts +1 -1
  39. package/dist/sharing/ConsumeSharedPlugin.d.ts +2 -2
  40. package/dist/sharing/ProvideSharedPlugin.d.ts +4 -4
  41. package/dist/sharing/SharePlugin.d.ts +4 -4
  42. package/dist/stats/statsFactoryUtils.d.ts +3 -3
  43. package/dist/util/comparators.d.ts +1 -1
  44. package/dist/util/createHash.d.ts +1 -1
  45. package/dist/util/identifier.d.ts +35 -8
  46. package/module.d.ts +6 -0
  47. package/package.json +8 -9
@@ -5,8 +5,6 @@ import net__default, { Socket } from 'node:net';
5
5
  import http2, { Http2ServerResponse, Http2ServerRequest } from 'node:http2';
6
6
  import { EventEmitter } from 'node:events';
7
7
  import * as stream from 'node:stream';
8
- import { HttpBindings } from '@hono/node-server';
9
- import { MiddlewareHandler } from 'hono';
10
8
 
11
9
  interface ProxyTargetDetailed {
12
10
  host?: string;
@@ -184,7 +182,7 @@ interface Options<TReq extends http.IncomingMessage = http.IncomingMessage, TRes
184
182
  */
185
183
  pathRewrite?: PathRewriteConfig<TReq>;
186
184
  /**
187
- * Access the internal http-proxy server instance to customize behavior
185
+ * Access the internal `httpxy` server instance to customize behavior
188
186
  *
189
187
  * @example
190
188
  * ```js
@@ -209,7 +207,7 @@ interface Options<TReq extends http.IncomingMessage = http.IncomingMessage, TRes
209
207
  */
210
208
  ejectPlugins?: boolean;
211
209
  /**
212
- * Listen to http-proxy events
210
+ * Listen to `httpxy` events
213
211
  * @see {@link OnProxyEvent} for available events
214
212
  * @example
215
213
  * ```js
@@ -330,29 +328,6 @@ interface Options<TReq extends http.IncomingMessage = http.IncomingMessage, TRes
330
328
  */
331
329
  declare function createProxyMiddleware<TReq extends http.IncomingMessage = http.IncomingMessage, TRes extends http.ServerResponse = http.ServerResponse, TNext = NextFunction>(options: Options<TReq, TRes>): RequestHandler<TReq, TRes, TNext>;
332
330
 
333
- /**
334
- * Creates a Hono middleware that proxies requests using http-proxy-middleware.
335
- *
336
- * `@remarks`
337
- * This middleware requires Hono to be running on Node.js via `@hono/node-server`.
338
- * It uses `c.env.incoming` and `c.env.outgoing` which are only available with `HttpBindings`.
339
- *
340
- * `@experimental` This API is experimental and may change without a major version bump.
341
- *
342
- * `@example`
343
- * ```ts
344
- * import { serve } from '@hono/node-server';
345
- * import { Hono } from 'hono';
346
- * import { createHonoProxyMiddleware } from 'http-proxy-middleware';
347
- *
348
- * const app = new Hono();
349
- * app.use('/api', createHonoProxyMiddleware({ target: 'http://example.com', changeOrigin: true }));
350
- * serve(app);
351
- */
352
- declare function createHonoProxyMiddleware(options: Options): MiddlewareHandler<{
353
- Bindings: HttpBindings;
354
- }>;
355
-
356
331
  type Interceptor<TReq = http.IncomingMessage, TRes = http.ServerResponse> = (buffer: Buffer, proxyRes: http.IncomingMessage, req: TReq, res: TRes) => Promise<Buffer | string>;
357
332
  /**
358
333
  * Intercept responses from upstream.
@@ -372,7 +347,7 @@ type BodyParserLikeRequest = http.IncomingMessage & {
372
347
  declare function fixRequestBody<TReq extends BodyParserLikeRequest = BodyParserLikeRequest>(proxyReq: http.ClientRequest, req: TReq): void;
373
348
 
374
349
  /**
375
- * Subscribe to {@link https://www.npmjs.com/package/http-proxy#listening-for-proxy-events http-proxy error events} to prevent server from crashing.
350
+ * Subscribe to {@link https://github.com/unjs/httpxy#events `httpxy` error events} to prevent server from crashing.
376
351
  * Errors are logged with {@link https://www.npmjs.com/package/debug debug} library.
377
352
  */
378
353
  declare const debugProxyErrorsPlugin: Plugin;
@@ -382,7 +357,7 @@ declare const errorResponsePlugin: Plugin;
382
357
  declare const loggerPlugin: Plugin;
383
358
 
384
359
  /**
385
- * Implements option.on object to subscribe to http-proxy events.
360
+ * Implements option.on object to subscribe to `httpxy` events.
386
361
  *
387
362
  * @example
388
363
  * ```js
@@ -403,5 +378,5 @@ declare const loggerPlugin: Plugin;
403
378
  */
404
379
  declare const proxyEventsPlugin: Plugin;
405
380
 
406
- export { createHonoProxyMiddleware, createProxyMiddleware, debugProxyErrorsPlugin, errorResponsePlugin, fixRequestBody, loggerPlugin, proxyEventsPlugin, responseInterceptor };
381
+ export { createProxyMiddleware, debugProxyErrorsPlugin, errorResponsePlugin, fixRequestBody, loggerPlugin, proxyEventsPlugin, responseInterceptor };
407
382
  export type { Filter, Options, Plugin, RequestHandler };
@@ -1 +1 @@
1
- {"name":"http-proxy-middleware","author":"Steven Chim","version":"4.0.0-beta.5","license":"MIT","types":"index.d.ts","type":"module"}
1
+ {"name":"http-proxy-middleware","author":"Steven Chim","version":"4.0.0","license":"MIT","types":"index.d.ts","type":"module"}
@@ -1,219 +1,3 @@
1
- /// <reference types="node" />
2
- import { EventEmitter } from 'events';
3
- // @ts-ignore
4
- import fs from 'graceful-fs';
5
-
6
- declare class DirectoryWatcher extends EventEmitter {
7
- options: Watchpack.WatcherOptions;
8
- directories: {
9
- [path: string]: Watcher | true;
10
- };
11
- files: {
12
- [path: string]: [number, number];
13
- };
14
- initialScan: boolean;
15
- initialScanRemoved: string[];
16
- nestedWatching: boolean;
17
- path: string;
18
- refs: number;
19
- watcher: fs.FSWatcher;
20
- watchers: {
21
- [path: string]: Watcher[];
22
- };
23
-
24
- constructor(directoryPath: string, options: Watchpack.WatcherOptions);
25
-
26
- setFileTime(filePath: string, mtime: number, initial: boolean, type?: string | boolean): void;
27
-
28
- setDirectory(directoryPath: string, exist: boolean, initial: boolean): void;
29
-
30
- createNestedWatcher(directoryPath: string): void;
31
-
32
- setNestedWatching(flag: boolean): void;
33
-
34
- watch(filePath: string, startTime: number): Watcher;
35
-
36
- onFileAdded(filePath: string, stat: fs.Stats): void;
37
-
38
- onDirectoryAdded(directoryPath: string): void;
39
-
40
- onChange(filePath: string, stat: fs.Stats): void;
41
-
42
- onFileUnlinked(filePath: string): void;
43
-
44
- onDirectoryUnlinked(directoryPath: string): void;
45
-
46
- onWatcherError(): void;
47
-
48
- doInitialScan(): void;
49
-
50
- getTimes(): {
51
- [path: string]: number;
52
- };
53
-
54
- close(): void;
55
- }
56
-
57
- declare class Watcher extends EventEmitter {
58
- data: number;
59
- directoryWatcher: DirectoryWatcher;
60
- path: string;
61
- startTime: number;
62
-
63
- constructor(directoryWatcher: DirectoryWatcher, filePath: string, startTime: number);
64
-
65
- checkStartTime(mtime: number, initial: boolean): boolean;
66
-
67
- close(): void;
68
- }
69
-
70
- interface Entry {
71
- /** A point in time at which is it safe to say all changes happened before that */
72
- safeTime: number;
73
- /** Only for file entries: the last modified timestamp of the file */
74
- timestamp: number;
75
- }
76
-
77
- declare class Watchpack extends EventEmitter {
78
- aggregatedChanges: Set<string>;
79
- aggregatedRemovals: Set<string>;
80
-
81
- aggregateTimeout: number;
82
- dirWatchers: Watcher[];
83
- fileWatchers: Watcher[];
84
- /** Last modified times for files by path */
85
- mtimes: {
86
- [path: string]: number;
87
- };
88
- options: Watchpack.WatchOptions;
89
- paused: boolean;
90
- watcherOptions: Watchpack.WatcherOptions;
91
-
92
- constructor(options: Watchpack.WatchOptions);
93
-
94
- /**
95
- * Starts watching these files and directories
96
- * Calling this again will override the files and directories
97
- */
98
- watch(options: {
99
- /**
100
- * Can be files or directories
101
- * For files: content and existence changes are tracked
102
- * For directories: only existence and timestamp changes are tracked
103
- */
104
- files?: Iterable<string>;
105
- /**
106
- * Can only be directories
107
- * Directory content (and content of children, ...) and existence changes are tracked.
108
- * For files: content and existence changes are tracked
109
- * Assumed to exist, when directory is not found without further information a remove event is emitted
110
- */
111
- directories?: Iterable<string>;
112
- /**
113
- * Can be files or directories
114
- * Only existence changes are tracked
115
- * Assued to not exist, no remove event is emitted when not found initially
116
- */
117
- missing?: Iterable<string>;
118
- startTime?: number;
119
- }): void;
120
-
121
- on(
122
- eventName: "change",
123
- listener: (
124
- /** The changed file or directory */
125
- filePath: string,
126
- /** The last modified time of the changed file */
127
- modifiedTime: number,
128
- /** Textual information how this change was detected */
129
- explanation: string,
130
- ) => void,
131
- ): this;
132
-
133
- on(
134
- eventName: "remove",
135
- listener: (
136
- /** The removed file or directory */
137
- filePath: string,
138
- /** Textual information how this change was detected */
139
- explanation: string,
140
- ) => void,
141
- ): this;
142
-
143
- on(
144
- eventName: "aggregated",
145
- listener: (
146
- /** Set of all changed files */
147
- changes: Set<string>,
148
- /** Set of all removed files */
149
- removals: Set<string>,
150
- ) => void,
151
- ): this;
152
-
153
- /**
154
- * Stops emitting events, but keeps watchers open
155
- * The next "watch" call can reuse the watchers
156
- * The watcher will keep aggregating events which can be received with `getAggregated()`
157
- */
158
- pause(): void;
159
-
160
- /**
161
- * Stops emitting events and closes all watchers
162
- */
163
- close(): void;
164
-
165
- /**
166
- * Returns the current aggregated info and removes that from the watcher
167
- * The next aggregated event won't include that info and will only emitted when futher changes happen
168
- * Can be used when paused
169
- */
170
- getAggregated(): {
171
- changes: Set<string>;
172
- removals: Set<string>;
173
- };
174
-
175
- /**
176
- * Collects time info objects for all known files and directories
177
- * This includes info from files not directly watched
178
- */
179
- collectTimeInfoEntries(fileInfoEntries: Map<string, Entry>, directoryInfoEntries: Map<string, Entry>): void;
180
-
181
- /**
182
- * Returns a `Map` with all known time info objects for files and directories
183
- * Similar to `collectTimeInfoEntries()` but returns a single map with all entries
184
- */
185
- getTimeInfoEntries(): Map<string, Entry>;
186
-
187
- /**
188
- * Returns an object with all known change times for files
189
- * This include timestamps from files not directly watched
190
- * Key: absolute path, value: timestamp as number
191
- * @deprecated
192
- */
193
- getTimes(): {
194
- [path: string]: number;
195
- };
196
-
197
- _fileWatcher(file: string, watcher: Watcher): Watcher;
198
-
199
- _dirWatcher(item: string, watcher: Watcher): Watcher;
200
-
201
- _onChange(item: string, mtime: number, file?: string): void;
202
-
203
- _onTimeout(): void;
204
- }
205
-
206
- declare namespace Watchpack {
207
- interface WatcherOptions {
208
- ignored?: string[] | string | RegExp | ((path: string) => boolean) | undefined;
209
- poll?: boolean | number | undefined;
210
- followSymlinks?: boolean;
211
- }
212
- interface WatchOptions extends WatcherOptions {
213
- aggregateTimeout?: number | undefined;
214
- }
215
- }
216
-
217
- export { Watchpack as default };
218
-
1
+ import Watchpack = require("./types/index");
2
+ export default Watchpack;
219
3
  export type WatchOptions = Watchpack.WatchOptions;