@rspack/browser 2.1.0-beta.0 → 2.1.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.
@@ -19,7 +19,6 @@ export declare class HookWebpackError extends WebpackError {
19
19
  */
20
20
  constructor(error: Error, hook: string);
21
21
  }
22
- export default HookWebpackError;
23
22
  /**
24
23
  * @param error an error
25
24
  * @param hook name of the hook
@@ -32,4 +32,4 @@ declare class LazyHashedEtag {
32
32
  * @returns etag
33
33
  */
34
34
  export declare const getter: (obj: HashableObject, hashFunction?: string | HashConstructor) => LazyHashedEtag;
35
- export default getter;
35
+ export {};
@@ -14,4 +14,3 @@ import type { Etag } from '../Cache';
14
14
  * @returns result
15
15
  */
16
16
  export declare const mergeEtags: (first: Etag, second: Etag) => Etag;
17
- export default mergeEtags;
@@ -464,7 +464,7 @@ export declare class ModuleGraphConnection {
464
464
 
465
465
  export declare class NativeWatcher {
466
466
  constructor(options: NativeWatcherOptions)
467
- watch(files: [Array<string>, Array<string>], directories: [Array<string>, Array<string>], missing: [Array<string>, Array<string>], startTime: bigint, callback: (err: Error | null, result: NativeWatchResult) => void, callbackUndelayed: (path: string) => void): void
467
+ watch(files: [Array<string>, Array<string>], directories: [Array<string>, Array<string>], missing: [Array<string>, Array<string>], startTime: bigint, callback: (err: Error | null, result: NativeWatchResult) => void, callbackUndelayed: (event: NativeWatchUndelayedEvent) => void): void
468
468
  triggerEvent(kind: 'change' | 'remove' | 'create', path: string): void
469
469
  /**
470
470
  * # Safety
@@ -1797,6 +1797,16 @@ export interface NativeWatcherOptions {
1797
1797
  ignored?: string | string[] | RegExp
1798
1798
  }
1799
1799
 
1800
+ /**
1801
+ * A single, undelayed file system event delivered to the `callbackUndelayed`
1802
+ * callback. Passed as one object so napi-rs delivers it as a single JS
1803
+ * argument unambiguously (a tuple would arrive as an array).
1804
+ */
1805
+ export interface NativeWatchUndelayedEvent {
1806
+ kind: string
1807
+ path: string
1808
+ }
1809
+
1800
1810
  export interface NodeFsStats {
1801
1811
  isFile: boolean
1802
1812
  isDirectory: boolean
@@ -1916,6 +1926,8 @@ export interface RawCacheOptionsMemory {
1916
1926
  export interface RawCacheOptionsPersistent {
1917
1927
  buildDependencies?: Array<string>
1918
1928
  version?: string
1929
+ maxAge: number
1930
+ maxVersions: number
1919
1931
  snapshot?: RawSnapshotOptions
1920
1932
  storage?: RawStorageOptions
1921
1933
  portable?: boolean
@@ -3086,8 +3098,6 @@ export interface RawStatsOptions {
3086
3098
  export interface RawStorageOptions {
3087
3099
  type: "filesystem"
3088
3100
  directory: string
3089
- maxAge?: number
3090
- maxGenerations?: number
3091
3101
  }
3092
3102
 
3093
3103
  export interface RawSubresourceIntegrityPluginOptions {
@@ -9,10 +9,22 @@
9
9
  */
10
10
  import type Watchpack from 'watchpack';
11
11
  import type { FileSystemInfoEntry, InputFileSystem, Watcher, WatchFileSystem } from '../util/fs';
12
+ type WatchpackInstance = InstanceType<typeof Watchpack>;
12
13
  export default class NodeWatchFileSystem implements WatchFileSystem {
14
+ #private;
13
15
  inputFileSystem: InputFileSystem;
14
16
  watcherOptions: Watchpack.WatchOptions;
15
- watcher?: Watchpack;
17
+ watcher?: WatchpackInstance;
16
18
  constructor(inputFileSystem: InputFileSystem);
17
19
  watch(files: Iterable<string>, directories: Iterable<string>, missing: Iterable<string>, startTime: number, options: Watchpack.WatchOptions, callback: (error: Error | null, fileTimeInfoEntries: Map<string, FileSystemInfoEntry | 'ignore'>, contextTimeInfoEntries: Map<string, FileSystemInfoEntry | 'ignore'>, changedFiles: Set<string>, removedFiles: Set<string>) => void, callbackUndelayed: (fileName: string, changeTime: number) => void): Watcher;
20
+ on(event: 'change', listener: (filename: string, mtime: number) => void): this;
21
+ on(event: 'remove', listener: (filename: string) => void): this;
22
+ on(event: 'aggregated', listener: (changes: Set<string>, removals: Set<string>) => void): this;
23
+ once(event: 'change', listener: (filename: string, mtime: number) => void): this;
24
+ once(event: 'remove', listener: (filename: string) => void): this;
25
+ once(event: 'aggregated', listener: (changes: Set<string>, removals: Set<string>) => void): this;
26
+ emit(event: 'change', filename: string, mtime: number): boolean;
27
+ emit(event: 'remove', filename: string): boolean;
28
+ emit(event: 'aggregated', changes: Set<string>, removals: Set<string>): boolean;
18
29
  }
30
+ export {};
package/dist/rspack.d.ts CHANGED
@@ -22,4 +22,3 @@ declare function rspack(options: MultiRspackOptions, callback?: Callback<Error,
22
22
  declare function rspack(options: RspackOptions, callback?: Callback<Error, Stats>): null | Compiler;
23
23
  declare function rspack(options: MultiRspackOptions | RspackOptions, callback?: Callback<Error, MultiStats | Stats>): null | MultiCompiler | Compiler;
24
24
  export { createCompiler, createMultiCompiler, MultiStats, rspack, Stats };
25
- export default rspack;
Binary file
@@ -2,7 +2,6 @@ import type { Compiler } from '../Compiler';
2
2
  import type { LibraryOptions, Plugins } from '../config';
3
3
  import { type ModuleFederationManifestPluginOptions } from '../container/ModuleFederationManifestPlugin';
4
4
  import type { Shared, SharedConfig } from './SharePlugin';
5
- export type MakeRequired<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;
6
5
  export interface IndependentSharePluginOptions {
7
6
  name: string;
8
7
  shared: Shared;
@@ -126,11 +126,6 @@ export type KnownStatsModule = {
126
126
  filteredModules?: number;
127
127
  source?: string | Buffer;
128
128
  };
129
- export type KnownStatsProfile = {
130
- total: number;
131
- resolving: number;
132
- building: number;
133
- };
134
129
  export type StatsModule = KnownStatsModule & Record<string, any>;
135
130
  export type KnownStatsModuleIssuer = {
136
131
  identifier?: string;
@@ -334,5 +329,4 @@ export declare const errorsSpaceLimit: (errors: StatsError[], max: number) => {
334
329
  errors: StatsError[];
335
330
  filtered: number;
336
331
  };
337
- export declare const warningFromStatsWarning: (warning: binding.JsStatsError) => Error;
338
332
  export {};
@@ -11,6 +11,6 @@ export type Comparator = <T>(arg0: T, arg1: T) => -1 | 0 | 1;
11
11
  type Selector<A, B> = (input: A) => B;
12
12
  export declare const concatComparators: (...comps: Comparator[]) => Comparator;
13
13
  export declare const compareIds: <T = string | number>(a: T, b: T) => -1 | 0 | 1;
14
- export declare const compareSelect: <T, R>(getter: Selector<T, R>, comparator: Comparator) => Comparator;
15
14
  export declare const compareNumbers: (a: number, b: number) => -1 | 0 | 1;
15
+ export declare const compareSelect: <T, R>(getter: Selector<T, R>, comparator: Comparator) => Comparator;
16
16
  export {};
@@ -1,6 +1,3 @@
1
- export type FakeHook<T> = T & {
2
- _fakeHook: true;
3
- };
4
1
  export declare function createFakeCompilationDependencies(getDeps: () => string[], addDeps: (deps: string[]) => void): {
5
2
  [Symbol.iterator](): Generator<string, void, unknown>;
6
3
  has: (dep: string) => boolean;
package/dist/util/fs.d.ts CHANGED
@@ -113,7 +113,6 @@ export type JsonObject = {
113
113
  } & {
114
114
  [Key in string]?: JsonValue | undefined;
115
115
  };
116
- export type NoParamCallback = (err: NodeJS.ErrnoException | null) => void;
117
116
  export type StringCallback = (err: NodeJS.ErrnoException | null, data?: string) => void;
118
117
  export type BufferCallback = (err: NodeJS.ErrnoException | null, data?: Buffer) => void;
119
118
  export type StringOrBufferCallback = (err: NodeJS.ErrnoException | null, data?: string | Buffer) => void;
@@ -124,7 +123,6 @@ export type ReaddirDirentCallback = (err: NodeJS.ErrnoException | null, files?:
124
123
  export type StatsCallback = (err: NodeJS.ErrnoException | null, stats?: IStats) => void;
125
124
  export type BigIntStatsCallback = (err: NodeJS.ErrnoException | null, stats?: IBigIntStats) => void;
126
125
  export type StatsOrBigIntStatsCallback = (err: NodeJS.ErrnoException | null, stats?: IStats | IBigIntStats) => void;
127
- export type NumberCallback = (err: NodeJS.ErrnoException | null, data?: number) => void;
128
126
  export type ReadJsonCallback = (err: NodeJS.ErrnoException | Error | null, data?: JsonObject) => void;
129
127
  export type PathLike = string | Buffer | URL;
130
128
  export type PathOrFileDescriptor = PathLike | number;
@@ -320,12 +318,6 @@ export type InputFileSystem = {
320
318
  dirname?: (path: string) => string;
321
319
  };
322
320
  export type IntermediateFileSystem = InputFileSystem & OutputFileSystem & IntermediateFileSystemExtras;
323
- export type WriteStreamOptions = {
324
- flags?: string;
325
- encoding?: 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'utf-16le' | 'ucs2' | 'ucs-2' | 'latin1' | 'binary' | 'base64' | 'base64url' | 'hex';
326
- fd?: any;
327
- mode?: number;
328
- };
329
321
  export type MakeDirectoryOptions = {
330
322
  recursive?: boolean;
331
323
  mode?: string | number;
@@ -371,5 +363,14 @@ export interface WatchFileSystem {
371
363
  added?: Iterable<String>;
372
364
  removed?: Iterable<String>;
373
365
  }, startTime: number, options: WatchOptions, callback: (error: Error | null, fileTimeInfoEntries: Map<string, FileSystemInfoEntry | 'ignore'>, contextTimeInfoEntries: Map<string, FileSystemInfoEntry | 'ignore'>, changedFiles: Set<string>, removedFiles: Set<string>) => void, callbackUndelayed: (fileName: string, changeTime: number) => void): Watcher;
366
+ on?(event: 'change', listener: (filename: string, mtime: number) => void): this;
367
+ on?(event: 'remove', listener: (filename: string) => void): this;
368
+ on?(event: 'aggregated', listener: (changes: Set<string>, removals: Set<string>) => void): this;
369
+ once?(event: 'change', listener: (filename: string, mtime: number) => void): this;
370
+ once?(event: 'remove', listener: (filename: string) => void): this;
371
+ once?(event: 'aggregated', listener: (changes: Set<string>, removals: Set<string>) => void): this;
372
+ emit?(event: 'change', filename: string, mtime: number): boolean;
373
+ emit?(event: 'remove', filename: string): boolean;
374
+ emit?(event: 'aggregated', changes: Set<string>, removals: Set<string>): boolean;
374
375
  }
375
376
  export {};
@@ -1,7 +1,7 @@
1
1
  /*! LICENSE: wasi-worker-browser.mjs.LICENSE.txt */
2
2
  (()=>{
3
3
  var __webpack_modules__ = {
4
- "../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js" (module) {
4
+ 409 (module) {
5
5
  var process = module.exports = {};
6
6
  var cachedSetTimeout;
7
7
  var cachedClearTimeout;
@@ -139,7 +139,7 @@
139
139
  return module.exports;
140
140
  }
141
141
  (()=>{
142
- var wasi_threads_esm_bundler_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
142
+ var wasi_threads_esm_bundler_process = __webpack_require__(409);
143
143
  var _WebAssembly = "u" > typeof WebAssembly ? WebAssembly : "u" > typeof WXWebAssembly ? WXWebAssembly : void 0;
144
144
  var wasi_threads_esm_bundler_ENVIRONMENT_IS_NODE = 'object' == typeof wasi_threads_esm_bundler_process && null !== wasi_threads_esm_bundler_process && 'object' == typeof wasi_threads_esm_bundler_process.versions && null !== wasi_threads_esm_bundler_process.versions && 'string' == typeof wasi_threads_esm_bundler_process.versions.node;
145
145
  function getPostMessage(options) {
@@ -893,7 +893,7 @@
893
893
  };
894
894
  return tslib_es6_assign.apply(this, arguments);
895
895
  };
896
- var emnapi_core_esm_bundler_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
896
+ var emnapi_core_esm_bundler_process = __webpack_require__(409);
897
897
  var emnapi_core_esm_bundler_WebAssembly = "u" > typeof WebAssembly ? WebAssembly : "u" > typeof WXWebAssembly ? WXWebAssembly : void 0;
898
898
  function validateImports(imports) {
899
899
  if (imports && 'object' != typeof imports) throw new TypeError('imports must be an object or undefined');
@@ -7075,7 +7075,7 @@
7075
7075
  };
7076
7076
  return MessageHandler;
7077
7077
  }(wasi_threads_esm_bundler_ThreadMessageHandler);
7078
- var wasm_util_esm_bundler_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
7078
+ var wasm_util_esm_bundler_process = __webpack_require__(409);
7079
7079
  const wasm_util_esm_bundler_WebAssembly = "u" > typeof WebAssembly ? WebAssembly : "u" > typeof WXWebAssembly ? WXWebAssembly : void 0;
7080
7080
  if (!wasm_util_esm_bundler_WebAssembly) throw new Error('WebAssembly is not supported in this environment');
7081
7081
  function wasm_util_esm_bundler_validateObject(value, name) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/browser",
3
- "version": "2.1.0-beta.0",
3
+ "version": "2.1.0",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "Rspack for running in the browser. This is still in early stage and may not follow the semver.",
@@ -35,7 +35,7 @@
35
35
  "@rspack/lite-tapable": "1.1.2",
36
36
  "@swc/types": "0.1.27",
37
37
  "memfs": "4.57.7",
38
- "webpack-sources": "3.3.4"
38
+ "webpack-sources": "3.5.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@swc/helpers": "^0.5.23"