@rspack/browser 2.0.0-rc.1 → 2.0.0-rc.2

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,7 +1,7 @@
1
- import { CIRCULAR_CONNECTION_SYMBOL, ModuleGraphConnection as BindingModuleGraphConnection, TRANSITIVE_ONLY_SYMBOL } from './binding';
1
+ import binding, { ModuleGraphConnection as BindingModuleGraphConnection } from './binding';
2
2
  type ModuleGraphConnectionConstructor = typeof BindingModuleGraphConnection & {
3
- readonly TRANSITIVE_ONLY: typeof TRANSITIVE_ONLY_SYMBOL;
4
- readonly CIRCULAR_CONNECTION: typeof CIRCULAR_CONNECTION_SYMBOL;
3
+ readonly TRANSITIVE_ONLY: typeof binding.TRANSITIVE_ONLY_SYMBOL;
4
+ readonly CIRCULAR_CONNECTION: typeof binding.CIRCULAR_CONNECTION_SYMBOL;
5
5
  };
6
6
  export interface ModuleGraphConnection extends BindingModuleGraphConnection {
7
7
  }
@@ -631,8 +631,30 @@ export type RuleSetLoaderWithOptions = {
631
631
  };
632
632
  export type RuleSetUseItem = RuleSetLoader | RuleSetLoaderWithOptions;
633
633
  export type RuleSetUse = RuleSetUseItem | RuleSetUseItem[] | ((data: RawFuncUseCtx) => RuleSetUseItem[]);
634
+ export type RuleSetRuleUseAndLoader = {
635
+ /** A loader name */
636
+ loader: RuleSetLoader;
637
+ /** A loader options */
638
+ options?: RuleSetLoaderOptions;
639
+ /** An array to pass the Loader package name and its options. */
640
+ use?: never;
641
+ } | {
642
+ /** A loader name */
643
+ loader?: never;
644
+ /** A loader options */
645
+ options?: never;
646
+ /** An array to pass the Loader package name and its options. */
647
+ use: RuleSetUse;
648
+ } | {
649
+ /** A loader name */
650
+ loader?: never;
651
+ /** A loader options */
652
+ options?: never;
653
+ /** An array to pass the Loader package name and its options. */
654
+ use?: never;
655
+ };
634
656
  /** Rule defines the conditions for matching a module and the behavior of handling those modules. */
635
- export type RuleSetRule = {
657
+ export type RuleSetRule = RuleSetRuleUseAndLoader & {
636
658
  /** Matches all modules that match this resource, and will match against Resource. */
637
659
  test?: RuleSetCondition;
638
660
  /** Excludes all modules that match this condition and will match against the absolute path of the resource */
@@ -663,12 +685,6 @@ export type RuleSetRule = {
663
685
  type?: string;
664
686
  /** Used to mark the layer of the matching module. */
665
687
  layer?: string;
666
- /** A loader name */
667
- loader?: RuleSetLoader;
668
- /** A loader options */
669
- options?: RuleSetLoaderOptions;
670
- /** An array to pass the Loader package name and its options. */
671
- use?: RuleSetUse;
672
688
  /**
673
689
  * Parser options for the specific modules that matched by the rule conditions
674
690
  * It will override the parser options in module.parser.
@@ -1358,6 +1374,8 @@ export type MemoryCacheOptions = {
1358
1374
  */
1359
1375
  export type CacheOptions = boolean | MemoryCacheOptions | PersistentCacheOptions;
1360
1376
  export type StatsPresets = 'normal' | 'none' | 'verbose' | 'errors-only' | 'errors-warnings' | 'minimal' | 'detailed' | 'summary';
1377
+ type AssetFilterItemTypes = RegExp | string | ((name: string, asset: any) => boolean);
1378
+ type AssetFilterTypes = boolean | AssetFilterItemTypes | AssetFilterItemTypes[];
1361
1379
  type ModuleFilterItemTypes = RegExp | string | ((name: string, module: any, type: any) => boolean);
1362
1380
  type ModuleFilterTypes = boolean | ModuleFilterItemTypes | ModuleFilterItemTypes[];
1363
1381
  export type StatsColorOptions = {
@@ -1642,7 +1660,7 @@ export type StatsOptions = {
1642
1660
  * Exclude the matching assets information.
1643
1661
  * @default false
1644
1662
  */
1645
- excludeAssets?: ModuleFilterTypes;
1663
+ excludeAssets?: AssetFilterTypes;
1646
1664
  /**
1647
1665
  * Specifies the sorting order for modules.
1648
1666
  * @default 'id'
@@ -1822,6 +1840,13 @@ type SharedOptimizationSplitChunksCacheGroup = {
1822
1840
  */
1823
1841
  minSize?: OptimizationSplitChunksSizes;
1824
1842
  minSizeReduction?: OptimizationSplitChunksSizes;
1843
+ /**
1844
+ * Size threshold at which splitting is enforced and other restrictions
1845
+ * (minRemainingSize, maxAsyncRequests, maxInitialRequests) are ignored.
1846
+ * The value is `50000` in production mode.
1847
+ * The value is `30000` in others mode.
1848
+ */
1849
+ enforceSizeThreshold?: OptimizationSplitChunksSizes;
1825
1850
  /** Maximum size, in bytes, for a chunk to be generated. */
1826
1851
  maxSize?: OptimizationSplitChunksSizes;
1827
1852
  /** Maximum size, in bytes, for a async chunk to be generated. */
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*! LICENSE: index.js.LICENSE.txt */
2
- import rspack_wasi_browser, { AsyncDependenciesBlock, BuiltinPluginName as external_rspack_wasi_browser_js_BuiltinPluginName, CIRCULAR_CONNECTION_SYMBOL, Chunk, ChunkGraph, Chunks as external_rspack_wasi_browser_js_Chunks, ConcatenatedModule, ContextModule, Dependency, EnforceExtension, EntryDependency, ExternalModule, JsCoordinator, JsLoaderState, JsRspackSeverity, Module, ModuleGraphConnection, NormalModule, RawRuleSetConditionType, RegisterJsTapKind, ResolverFactory as external_rspack_wasi_browser_js_ResolverFactory, TRANSITIVE_ONLY_SYMBOL, async as external_rspack_wasi_browser_js_async, cleanupGlobalTrace, formatDiagnostic, registerGlobalTrace, sync, syncTraceEvent, transformSync as external_rspack_wasi_browser_js_transformSync } from "./rspack.wasi-browser.js";
2
+ import rspack_wasi_browser, { AsyncDependenciesBlock, BuiltinPluginName as external_rspack_wasi_browser_js_BuiltinPluginName, Chunk, ChunkGraph, Chunks as external_rspack_wasi_browser_js_Chunks, ConcatenatedModule, ContextModule, Dependency, EnforceExtension, EntryDependency, ExternalModule, JsCoordinator, JsLoaderState, JsRspackSeverity, Module, ModuleGraphConnection, NormalModule, RawRuleSetConditionType, RegisterJsTapKind, ResolverFactory as external_rspack_wasi_browser_js_ResolverFactory, async as external_rspack_wasi_browser_js_async, cleanupGlobalTrace, formatDiagnostic, registerGlobalTrace, sync, syncTraceEvent, transformSync as external_rspack_wasi_browser_js_transformSync } from "./rspack.wasi-browser.js";
3
3
  import { AsyncParallelHook, AsyncSeriesBailHook, HookMap, SyncBailHook, SyncHook, SyncWaterfallHook } from "@rspack/lite-tapable";
4
4
  import * as __rspack_external__rspack_wasi_browser_js_bd433424 from "./rspack.wasi-browser.js";
5
5
  import * as __rspack_external__rspack_lite_tapable_c6bdf810 from "@rspack/lite-tapable";
@@ -2485,7 +2485,6 @@ __webpack_require__.add({
2485
2485
  if (y < x) return 1;
2486
2486
  return 0;
2487
2487
  }
2488
- var ONLY_ENUMERABLE = void 0;
2489
2488
  var kStrict = true;
2490
2489
  var kLoose = false;
2491
2490
  var kNoIterator = 0;
@@ -2535,8 +2534,8 @@ __webpack_require__.add({
2535
2534
  if (val1Tag !== val2Tag) return false;
2536
2535
  if (Array.isArray(val1)) {
2537
2536
  if (val1.length !== val2.length) return false;
2538
- var keys1 = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE);
2539
- var keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE);
2537
+ var keys1 = getOwnNonIndexProperties(val1);
2538
+ var keys2 = getOwnNonIndexProperties(val2);
2540
2539
  if (keys1.length !== keys2.length) return false;
2541
2540
  return keyCheck(val1, val2, strict, memos, kIsArray, keys1);
2542
2541
  }
@@ -2553,8 +2552,8 @@ __webpack_require__.add({
2553
2552
  if (!strict && (isFloat32Array(val1) || isFloat64Array(val1))) {
2554
2553
  if (!areSimilarFloatArrays(val1, val2)) return false;
2555
2554
  } else if (!areSimilarTypedArrays(val1, val2)) return false;
2556
- var _keys = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE);
2557
- var _keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE);
2555
+ var _keys = getOwnNonIndexProperties(val1);
2556
+ var _keys2 = getOwnNonIndexProperties(val2);
2558
2557
  if (_keys.length !== _keys2.length) return false;
2559
2558
  return keyCheck(val1, val2, strict, memos, kNoIterator, _keys);
2560
2559
  } else if (isSet(val1)) {
@@ -17867,7 +17866,7 @@ __webpack_require__.add({
17867
17866
  var c0_lo = hl;
17868
17867
  var c1_hi = s1_512_hi(eh, el);
17869
17868
  var c1_lo = s1_512_lo(eh, el);
17870
- var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl);
17869
+ var c2_hi = ch64_hi(eh, el, fh, fl, gh);
17871
17870
  var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl);
17872
17871
  var c3_hi = this.k[i];
17873
17872
  var c3_lo = this.k[i + 1];
@@ -17877,7 +17876,7 @@ __webpack_require__.add({
17877
17876
  var T1_lo = sum64_5_lo(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo, c4_hi, c4_lo);
17878
17877
  c0_hi = s0_512_hi(ah, al);
17879
17878
  c0_lo = s0_512_lo(ah, al);
17880
- c1_hi = maj64_hi(ah, al, bh, bl, ch, cl);
17879
+ c1_hi = maj64_hi(ah, al, bh, bl, ch);
17881
17880
  c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);
17882
17881
  var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo);
17883
17882
  var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);
@@ -35360,7 +35359,7 @@ __webpack_require__.add({
35360
35359
  __webpack_require__.d(__webpack_exports__, {
35361
35360
  Buffer: ()=>_napi_rs_wasm_runtime_fs__rspack_import_0.hp
35362
35361
  });
35363
- var _napi_rs_wasm_runtime_fs__rspack_import_0 = __webpack_require__("../../node_modules/.pnpm/@napi-rs+wasm-runtime@1.1.2_@emnapi+core@1.9.2_@emnapi+runtime@1.9.2/node_modules/@napi-rs/wasm-runtime/dist/fs.js");
35362
+ var _napi_rs_wasm_runtime_fs__rspack_import_0 = __webpack_require__("../../node_modules/.pnpm/@napi-rs+wasm-runtime@1.1.3_@emnapi+core@1.9.2_@emnapi+runtime@1.9.2/node_modules/@napi-rs/wasm-runtime/dist/fs.js");
35364
35363
  },
35365
35364
  "./src/browser/fs.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
35366
35365
  __webpack_require__.r(__webpack_exports__);
@@ -35376,15 +35375,15 @@ __webpack_require__.add({
35376
35375
  volume: ()=>volume,
35377
35376
  watch: ()=>watch
35378
35377
  });
35379
- var _napi_rs_wasm_runtime_fs__rspack_import_0 = __webpack_require__("../../node_modules/.pnpm/@napi-rs+wasm-runtime@1.1.2_@emnapi+core@1.9.2_@emnapi+runtime@1.9.2/node_modules/@napi-rs/wasm-runtime/dist/fs.js");
35380
- var _rspack_binding__rspack_import_1 = __webpack_require__("@rspack/binding?81b3");
35378
+ var _napi_rs_wasm_runtime_fs__rspack_import_0 = __webpack_require__("../../node_modules/.pnpm/@napi-rs+wasm-runtime@1.1.3_@emnapi+core@1.9.2_@emnapi+runtime@1.9.2/node_modules/@napi-rs/wasm-runtime/dist/fs.js");
35379
+ var _rspack_binding__rspack_import_1 = __webpack_require__("@rspack/binding?f5f3");
35381
35380
  const fs = _rspack_binding__rspack_import_1.__fs;
35382
35381
  const volume = _rspack_binding__rspack_import_1.__volume;
35383
35382
  const memfs = _napi_rs_wasm_runtime_fs__rspack_import_0.tO;
35384
35383
  const { readFileSync, readdirSync, lstat, existsSync, readdir, watch } = fs;
35385
35384
  const __rspack_default_export = fs;
35386
35385
  },
35387
- "@rspack/binding?81b3" (module) {
35386
+ "@rspack/binding?f5f3" (module) {
35388
35387
  module.exports = __rspack_external__rspack_wasi_browser_js_bd433424;
35389
35388
  },
35390
35389
  "?7763" () {},
@@ -35404,7 +35403,7 @@ __webpack_require__.add({
35404
35403
  return out;
35405
35404
  };
35406
35405
  },
35407
- "../../node_modules/.pnpm/@napi-rs+wasm-runtime@1.1.2_@emnapi+core@1.9.2_@emnapi+runtime@1.9.2/node_modules/@napi-rs/wasm-runtime/dist/fs.js" (__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
35406
+ "../../node_modules/.pnpm/@napi-rs+wasm-runtime@1.1.3_@emnapi+core@1.9.2_@emnapi+runtime@1.9.2/node_modules/@napi-rs/wasm-runtime/dist/fs.js" (__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
35408
35407
  __webpack_require__.d(__webpack_exports__, {
35409
35408
  hp: ()=>Buffer,
35410
35409
  tO: ()=>memfs
@@ -38551,7 +38550,7 @@ __webpack_require__.add({
38551
38550
  const getgid = ()=>process_1.default.getgid?.() ?? 0;
38552
38551
  const EMPTY_BUFFER = (0, buffer_1.bufferAllocUnsafe)(0);
38553
38552
  let Node$1 = class {
38554
- constructor(ino, mode = 0o666){
38553
+ constructor(ino, mode = 0o666, uid = getuid(), gid = getgid()){
38555
38554
  this.changes = new fanout_1.FanOut();
38556
38555
  this._uid = getuid();
38557
38556
  this._gid = getgid();
@@ -38565,6 +38564,8 @@ __webpack_require__.add({
38565
38564
  this._nlink = 1;
38566
38565
  this.mode = mode;
38567
38566
  this.ino = ino;
38567
+ this._uid = uid;
38568
+ this._gid = gid;
38568
38569
  }
38569
38570
  set ctime(ctime) {
38570
38571
  this._ctime = ctime;
@@ -42012,17 +42013,17 @@ __webpack_require__.add({
42012
42013
  const pathJoin = path_1.posix ? path_1.posix.join : path_1.join;
42013
42014
  const { O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_EXCL, O_TRUNC, O_APPEND, O_DIRECTORY } = fs_node_utils_1.constants;
42014
42015
  let Superblock$1 = class Superblock {
42015
- static fromJSON(json, cwd) {
42016
- const vol = new Superblock();
42016
+ static fromJSON(json, cwd, opts) {
42017
+ const vol = new Superblock(opts);
42017
42018
  vol.fromJSON(json, cwd);
42018
42019
  return vol;
42019
42020
  }
42020
- static fromNestedJSON(json, cwd) {
42021
- const vol = new Superblock();
42021
+ static fromNestedJSON(json, cwd, opts) {
42022
+ const vol = new Superblock(opts);
42022
42023
  vol.fromNestedJSON(json, cwd);
42023
42024
  return vol;
42024
42025
  }
42025
- constructor(props = {}){
42026
+ constructor(opts = {}){
42026
42027
  this.ino = 0;
42027
42028
  this.inodes = {};
42028
42029
  this.releasedInos = [];
@@ -42204,6 +42205,7 @@ __webpack_require__.add({
42204
42205
  const file = this.getFileByFdOrThrow(fd, 'close');
42205
42206
  this.closeFile(file);
42206
42207
  };
42208
+ this.process = opts.process ?? process_1.default;
42207
42209
  const root = this.createLink();
42208
42210
  root.setNode(this.createNode(0o777 | fs_node_utils_1.constants.S_IFDIR));
42209
42211
  root.setChild('.', root);
@@ -42240,7 +42242,9 @@ __webpack_require__.add({
42240
42242
  return 'number' == typeof releasedFd ? releasedFd : Superblock.fd--;
42241
42243
  }
42242
42244
  createNode(mode) {
42243
- const node = new Node_1.Node(this.newInoNumber(), mode);
42245
+ const uid = this.process.getuid?.() ?? 0;
42246
+ const gid = this.process.getgid?.() ?? 0;
42247
+ const node = new Node_1.Node(this.newInoNumber(), mode, uid, gid);
42244
42248
  this.inodes[node.ino] = node;
42245
42249
  return node;
42246
42250
  }
@@ -42264,10 +42268,12 @@ __webpack_require__.add({
42264
42268
  }
42265
42269
  let curr = this.root;
42266
42270
  let i = 0;
42271
+ const uid = this.process.getuid?.() ?? 0;
42272
+ const gid = this.process.getgid?.() ?? 0;
42267
42273
  while(i < steps.length){
42268
42274
  let node = curr.getNode();
42269
42275
  if (node.isDirectory()) {
42270
- if (checkAccess && !node.canExecute()) return (0, result_1.Err)((0, util_1.createStatError)("EACCES", funcName, filename));
42276
+ if (checkAccess && !node.canExecute(uid, gid)) return (0, result_1.Err)((0, util_1.createStatError)("EACCES", funcName, filename));
42271
42277
  } else if (i < steps.length - 1) return (0, result_1.Err)((0, util_1.createStatError)("ENOTDIR", funcName, filename));
42272
42278
  curr = curr.getChild(steps[i]) ?? null;
42273
42279
  if (!curr) if (checkExistence) return (0, result_1.Err)((0, util_1.createStatError)("ENOENT", funcName, filename));
@@ -42281,7 +42287,7 @@ __webpack_require__.add({
42281
42287
  continue;
42282
42288
  }
42283
42289
  if (checkExistence && !node.isDirectory() && i < steps.length - 1) {
42284
- const errorCode = 'win32' === process_1.default.platform ? "ENOENT" : "ENOTDIR";
42290
+ const errorCode = 'win32' === this.process.platform ? "ENOENT" : "ENOTDIR";
42285
42291
  return (0, result_1.Err)((0, util_1.createStatError)(errorCode, funcName, filename));
42286
42292
  }
42287
42293
  i++;
@@ -42385,7 +42391,7 @@ __webpack_require__.add({
42385
42391
  for (const link of links)this._toJSON(link, json, isRelative ? link.getPath() : '', asBuffer);
42386
42392
  return json;
42387
42393
  }
42388
- fromJSON(json, cwd = process_1.default.cwd()) {
42394
+ fromJSON(json, cwd = this.process.cwd()) {
42389
42395
  for(let filename in json){
42390
42396
  const data = json[filename];
42391
42397
  filename = (0, util_1.resolve)(filename, cwd);
@@ -52126,8 +52132,9 @@ __webpack_require__.add({
52126
52132
  });
52127
52133
  results.push(...dirResults.map((r)=>path_1.posix.resolve(dir, r)));
52128
52134
  } else {
52135
+ const normalizedPattern = pattern.replace(/^\.\//, '');
52129
52136
  const dirResults = walkDirectory(fs, resolvedCwd, [
52130
- pattern
52137
+ normalizedPattern
52131
52138
  ], globOptions);
52132
52139
  results.push(...dirResults);
52133
52140
  }
@@ -53300,8 +53307,8 @@ __webpack_require__.add({
53300
53307
  }
53301
53308
  }
53302
53309
  volume.Volume = Volume;
53303
- Volume.fromJSON = (json, cwd)=>new Volume(fs_core_1.Superblock.fromJSON(json, cwd));
53304
- Volume.fromNestedJSON = (json, cwd)=>new Volume(fs_core_1.Superblock.fromNestedJSON(json, cwd));
53310
+ Volume.fromJSON = (json, cwd, opts)=>new Volume(fs_core_1.Superblock.fromJSON(json, cwd, opts));
53311
+ Volume.fromNestedJSON = (json, cwd, opts)=>new Volume(fs_core_1.Superblock.fromNestedJSON(json, cwd, opts));
53305
53312
  function emitStop(self1) {
53306
53313
  self1.emit('stop');
53307
53314
  }
@@ -53358,6 +53365,7 @@ __webpack_require__.add({
53358
53365
  if (void 0 === options.highWaterMark) options.highWaterMark = 65536;
53359
53366
  stream_1.Readable.call(this, options);
53360
53367
  this.path = (0, util_3.pathToFilename)(path);
53368
+ this._fileHandle = options.fd && 'number' != typeof options.fd ? options.fd : null;
53361
53369
  this.fd = void 0 === options.fd ? null : 'number' != typeof options.fd ? options.fd.fd : options.fd;
53362
53370
  this.flags = void 0 === options.flags ? 'r' : options.flags;
53363
53371
  this.mode = void 0 === options.mode ? 0o666 : options.mode;
@@ -53437,7 +53445,8 @@ __webpack_require__.add({
53437
53445
  }
53438
53446
  if ('boolean' == typeof this._readableState?.closed) this._readableState.closed = true;
53439
53447
  else this.closed = true;
53440
- this._vol.close(this.fd, (er)=>{
53448
+ if (this._fileHandle) this._fileHandle.close().then(()=>this.emit('close'), (er)=>this.emit('error', er));
53449
+ else this._vol.close(this.fd, (er)=>{
53441
53450
  if (er) this.emit('error', er);
53442
53451
  else this.emit('close');
53443
53452
  });
@@ -53454,6 +53463,7 @@ __webpack_require__.add({
53454
53463
  options = Object.assign({}, (0, options_1.getOptions)(options, {}));
53455
53464
  stream_1.Writable.call(this, options);
53456
53465
  this.path = (0, util_3.pathToFilename)(path);
53466
+ this._fileHandle = options.fd && 'number' != typeof options.fd ? options.fd : null;
53457
53467
  this.fd = void 0 === options.fd ? null : 'number' != typeof options.fd ? options.fd.fd : options.fd;
53458
53468
  this.flags = void 0 === options.flags ? 'w' : options.flags;
53459
53469
  this.mode = void 0 === options.mode ? 0o666 : options.mode;
@@ -53533,7 +53543,8 @@ __webpack_require__.add({
53533
53543
  }
53534
53544
  if ('boolean' == typeof this._writableState?.closed) this._writableState.closed = true;
53535
53545
  else this.closed = true;
53536
- this._vol.close(this.fd, (er)=>{
53546
+ if (this._fileHandle) this._fileHandle.close().then(()=>this.emit('close'), (er)=>this.emit('error', er));
53547
+ else this._vol.close(this.fd, (er)=>{
53537
53548
  if (er) this.emit('error', er);
53538
53549
  else this.emit('close');
53539
53550
  });
@@ -53941,8 +53952,14 @@ __webpack_require__.add({
53941
53952
  return fs;
53942
53953
  }
53943
53954
  exports$1.fs = createFsFromVolume(exports$1.vol);
53944
- const memfs = (json = {}, cwd = '/')=>{
53945
- const vol = fs_node_1.Volume.fromNestedJSON(json, cwd);
53955
+ const memfs = (json = {}, cwdOrOpts = '/')=>{
53956
+ const opts = 'string' == typeof cwdOrOpts ? {
53957
+ cwd: cwdOrOpts
53958
+ } : cwdOrOpts;
53959
+ const cwd = opts.cwd ?? (opts.process ? void 0 : '/');
53960
+ const vol = fs_node_1.Volume.fromNestedJSON(json, cwd, {
53961
+ process: opts.process
53962
+ });
53946
53963
  const fs = createFsFromVolume(vol);
53947
53964
  return {
53948
53965
  fs,
@@ -55417,11 +55434,28 @@ function createDiagnosticArray(adm) {
55417
55434
  adm[$proxy] = proxy;
55418
55435
  return proxy;
55419
55436
  }
55420
- var _computedKey, _computedKey1, _computedKey2;
55437
+ function _to_primitive(input, hint) {
55438
+ if ("object" !== _type_of(input) || null === input) return input;
55439
+ var prim = input[Symbol.toPrimitive];
55440
+ if (void 0 !== prim) {
55441
+ var res = prim.call(input, hint || "default");
55442
+ if ("object" !== _type_of(res)) return res;
55443
+ throw new TypeError("@@toPrimitive must return a primitive value.");
55444
+ }
55445
+ return ("string" === hint ? String : Number)(input);
55446
+ }
55447
+ function _to_property_key(arg) {
55448
+ var key = _to_primitive(arg, "string");
55449
+ return "symbol" === _type_of(key) ? key : String(key);
55450
+ }
55451
+ function _type_of(obj) {
55452
+ return obj && "u" > typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj;
55453
+ }
55454
+ let _computedKey, _computedKey1, _computedKey2;
55421
55455
  const checkCompilation = (compilation)=>{
55422
55456
  if (!(compilation instanceof Compilation)) throw new TypeError('The \'compilation\' argument must be an instance of Compilation. This usually occurs when multiple versions of "@rspack/core" are used, or when the code in "@rspack/core" is executed multiple times.');
55423
55457
  };
55424
- _computedKey = rspack_wasi_browser.COMPILATION_HOOKS_MAP_SYMBOL;
55458
+ _computedKey = _to_property_key(rspack_wasi_browser.COMPILATION_HOOKS_MAP_SYMBOL);
55425
55459
  class Compilation {
55426
55460
  #inner;
55427
55461
  #shutdown;
@@ -56045,7 +56079,7 @@ class EntryData {
56045
56079
  this.options = binding.options;
56046
56080
  }
56047
56081
  }
56048
- _computedKey1 = Symbol.iterator, _computedKey2 = Symbol.toStringTag;
56082
+ _computedKey1 = _to_property_key(Symbol.iterator), _computedKey2 = _to_property_key(Symbol.toStringTag);
56049
56083
  class Entries {
56050
56084
  #data;
56051
56085
  constructor(data){
@@ -56557,7 +56591,7 @@ function SplitChunksPlugin_toRawSplitChunksOptions(sc, compiler) {
56557
56591
  if ('function' == typeof chunks) return (chunk)=>chunks(chunk);
56558
56592
  return chunks;
56559
56593
  }
56560
- const { name, chunks, defaultSizeTypes, cacheGroups = {}, fallbackCacheGroup, minSize, minSizeReduction, maxSize, maxAsyncSize, maxInitialSize, ...passThrough } = sc;
56594
+ const { name, chunks, defaultSizeTypes, cacheGroups = {}, fallbackCacheGroup, minSize, minSizeReduction, enforceSizeThreshold, maxSize, maxAsyncSize, maxInitialSize, ...passThrough } = sc;
56561
56595
  return {
56562
56596
  name: getName(name),
56563
56597
  chunks: getChunks(chunks),
@@ -56566,7 +56600,7 @@ function SplitChunksPlugin_toRawSplitChunksOptions(sc, compiler) {
56566
56600
  'unknown'
56567
56601
  ],
56568
56602
  cacheGroups: Object.entries(cacheGroups).filter(([_key, group])=>false !== group).map(([key, group])=>{
56569
- const { test, name, chunks, minSize, minSizeReduction, maxSize, maxAsyncSize, maxInitialSize, ...passThrough } = group;
56603
+ const { test, name, chunks, minSize, minSizeReduction, enforceSizeThreshold, maxSize, maxAsyncSize, maxInitialSize, ...passThrough } = group;
56570
56604
  const rawGroup = {
56571
56605
  key,
56572
56606
  test: getTest(test),
@@ -56574,6 +56608,7 @@ function SplitChunksPlugin_toRawSplitChunksOptions(sc, compiler) {
56574
56608
  chunks: getChunks(chunks),
56575
56609
  minSize: JsSplitChunkSizes.__to_binding(minSize),
56576
56610
  minSizeReduction: JsSplitChunkSizes.__to_binding(minSizeReduction),
56611
+ enforceSizeThreshold: JsSplitChunkSizes.__to_binding(enforceSizeThreshold),
56577
56612
  maxSize: JsSplitChunkSizes.__to_binding(maxSize),
56578
56613
  maxAsyncSize: JsSplitChunkSizes.__to_binding(maxAsyncSize),
56579
56614
  maxInitialSize: JsSplitChunkSizes.__to_binding(maxInitialSize),
@@ -56587,6 +56622,7 @@ function SplitChunksPlugin_toRawSplitChunksOptions(sc, compiler) {
56587
56622
  },
56588
56623
  minSize: JsSplitChunkSizes.__to_binding(minSize),
56589
56624
  minSizeReduction: JsSplitChunkSizes.__to_binding(minSizeReduction),
56625
+ enforceSizeThreshold: JsSplitChunkSizes.__to_binding(enforceSizeThreshold),
56590
56626
  maxSize: JsSplitChunkSizes.__to_binding(maxSize),
56591
56627
  maxAsyncSize: JsSplitChunkSizes.__to_binding(maxAsyncSize),
56592
56628
  maxInitialSize: JsSplitChunkSizes.__to_binding(maxInitialSize),
@@ -58354,11 +58390,7 @@ async function runLoaders(compiler, context) {
58354
58390
  resource: resource
58355
58391
  }
58356
58392
  });
58357
- if (parallelism) result = await service_run(loaderName, {
58358
- loaderContext: getWorkerLoaderContext(),
58359
- loaderState,
58360
- args
58361
- }, getWorkerLoaderHandlers(), 'object' == typeof currentLoaderObject?.parallel ? currentLoaderObject.parallel : void 0) || [];
58393
+ if (parallelism) result = await service_run(getWorkerLoaderContext(), getWorkerLoaderHandlers(), 'object' == typeof currentLoaderObject?.parallel && currentLoaderObject.parallel) || [];
58362
58394
  else {
58363
58395
  if (loaderState === JsLoaderState.Normal) convertArgs(args, !!currentLoaderObject?.raw);
58364
58396
  result = await utils_runSyncOrAsync(fn, loaderContext, args) || [];
@@ -58663,15 +58695,15 @@ function tryMatch(payload, condition) {
58663
58695
  return false;
58664
58696
  }
58665
58697
  const getRawModuleRule = (rule, path, options, upperType)=>{
58666
- if (rule.loader) rule.use = [
58698
+ const normalizedUse = rule.loader ? [
58667
58699
  {
58668
58700
  loader: rule.loader,
58669
58701
  options: rule.options
58670
58702
  }
58671
- ];
58703
+ ] : rule.use;
58672
58704
  let funcUse;
58673
- if ('function' == typeof rule.use) {
58674
- const use = rule.use;
58705
+ if ('function' == typeof normalizedUse) {
58706
+ const use = normalizedUse;
58675
58707
  funcUse = (rawContext)=>{
58676
58708
  const context = {
58677
58709
  ...rawContext,
@@ -58702,7 +58734,7 @@ const getRawModuleRule = (rule, path, options, upperType)=>{
58702
58734
  scheme: rule.scheme ? getRawRuleSetCondition(rule.scheme) : void 0,
58703
58735
  mimetype: rule.mimetype ? getRawRuleSetCondition(rule.mimetype) : void 0,
58704
58736
  sideEffects: rule.sideEffects,
58705
- use: 'function' == typeof rule.use ? funcUse : createRawModuleRuleUses(rule.use ?? [], `${path}.use`, options),
58737
+ use: 'function' == typeof normalizedUse ? funcUse : createRawModuleRuleUses(normalizedUse ?? [], `${path}.use`, options),
58706
58738
  type: rule.type,
58707
58739
  layer: rule.layer,
58708
58740
  parser: rule.parser ? getRawParserOptions(rule.parser, rule.type ?? upperType) : void 0,
@@ -60248,7 +60280,8 @@ const _cleverMerge = (first, second, internalCaching = false)=>{
60248
60280
  const { static: firstInfo, dynamic: firstDynamicInfo } = firstObject;
60249
60281
  let secondObj = second;
60250
60282
  if (void 0 !== firstDynamicInfo) {
60251
- let { byProperty, fn } = firstDynamicInfo;
60283
+ let { fn } = firstDynamicInfo;
60284
+ const { byProperty } = firstDynamicInfo;
60252
60285
  const fnInfo = fn[DYNAMIC_INFO];
60253
60286
  if (fnInfo) {
60254
60287
  secondObj = internalCaching ? cachedCleverMerge(fnInfo[1], second) : cleverMerge(fnInfo[1], second);
@@ -61851,7 +61884,7 @@ const applyOutputDefaults = (options, { context, targetProperties: tp, isAffecte
61851
61884
  });
61852
61885
  D(output, 'bundlerInfo', {});
61853
61886
  if ('object' == typeof output.bundlerInfo) {
61854
- D(output.bundlerInfo, 'version', "2.0.0-rc.1");
61887
+ D(output.bundlerInfo, 'version', "2.0.0-rc.2");
61855
61888
  D(output.bundlerInfo, 'bundler', 'rspack');
61856
61889
  D(output.bundlerInfo, 'force', false);
61857
61890
  }
@@ -61949,6 +61982,7 @@ const applyOptimizationDefaults = (optimization, { production, development })=>{
61949
61982
  D(splitChunks, 'usedExports', true === optimization.usedExports);
61950
61983
  D(splitChunks, 'minChunks', 1);
61951
61984
  F(splitChunks, 'minSize', ()=>production ? 20000 : 10000);
61985
+ F(splitChunks, 'enforceSizeThreshold', ()=>production ? 50000 : 30000);
61952
61986
  F(splitChunks, 'maxAsyncRequests', ()=>production ? 30 : 1 / 0);
61953
61987
  F(splitChunks, 'maxInitialRequests', ()=>production ? 30 : 1 / 0);
61954
61988
  D(splitChunks, 'automaticNameDelimiter', '-');
@@ -63508,7 +63542,7 @@ class MultiStats {
63508
63542
  return obj;
63509
63543
  });
63510
63544
  if (childOptions.version) {
63511
- obj.rspackVersion = "2.0.0-rc.1";
63545
+ obj.rspackVersion = "2.0.0-rc.2";
63512
63546
  obj.version = "5.75.0";
63513
63547
  }
63514
63548
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join('');
@@ -63623,8 +63657,25 @@ class MultiWatching {
63623
63657
  }
63624
63658
  }
63625
63659
  const src_MultiWatching = MultiWatching;
63626
- var ArrayQueue_computedKey;
63627
- ArrayQueue_computedKey = Symbol.iterator;
63660
+ function ArrayQueue_to_primitive(input, hint) {
63661
+ if ("object" !== ArrayQueue_type_of(input) || null === input) return input;
63662
+ var prim = input[Symbol.toPrimitive];
63663
+ if (void 0 !== prim) {
63664
+ var res = prim.call(input, hint || "default");
63665
+ if ("object" !== ArrayQueue_type_of(res)) return res;
63666
+ throw new TypeError("@@toPrimitive must return a primitive value.");
63667
+ }
63668
+ return ("string" === hint ? String : Number)(input);
63669
+ }
63670
+ function ArrayQueue_to_property_key(arg) {
63671
+ var key = ArrayQueue_to_primitive(arg, "string");
63672
+ return "symbol" === ArrayQueue_type_of(key) ? key : String(key);
63673
+ }
63674
+ function ArrayQueue_type_of(obj) {
63675
+ return obj && "u" > typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj;
63676
+ }
63677
+ let ArrayQueue_computedKey;
63678
+ ArrayQueue_computedKey = ArrayQueue_to_property_key(Symbol.iterator);
63628
63679
  class ArrayQueue {
63629
63680
  _list;
63630
63681
  _listReversed;
@@ -65194,7 +65245,7 @@ const SIMPLE_EXTRACTORS = {
65194
65245
  },
65195
65246
  version: (object)=>{
65196
65247
  object.version = "5.75.0";
65197
- object.rspackVersion = "2.0.0-rc.1";
65248
+ object.rspackVersion = "2.0.0-rc.2";
65198
65249
  },
65199
65250
  env: (object, _compilation, _context, { _env })=>{
65200
65251
  object.env = _env;
@@ -67261,7 +67312,7 @@ const createCompilationHooksRegisters = (getCompiler, createTap, createMapTap)=>
67261
67312
  return 'function' == typeof value ? value.bind(target) : value;
67262
67313
  },
67263
67314
  set (_target, prop, value) {
67264
- if ('id' === prop && null !== value) {
67315
+ if ('id' === prop && ('string' == typeof value || 'number' == typeof value)) {
67265
67316
  assignments.set(m.identifier, value);
67266
67317
  return true;
67267
67318
  }
@@ -67271,10 +67322,7 @@ const createCompilationHooksRegisters = (getCompiler, createTap, createMapTap)=>
67271
67322
  });
67272
67323
  queried.call(proxiedModules);
67273
67324
  return {
67274
- assignments: Object.fromEntries(Array.from(assignments.entries()).map(([k, v])=>[
67275
- k,
67276
- String(v)
67277
- ]))
67325
+ assignments: Object.fromEntries(assignments.entries())
67278
67326
  };
67279
67327
  };
67280
67328
  }),
@@ -68440,7 +68488,7 @@ class Compiler {
68440
68488
  const rawOptions = getRawOptions(options, this);
68441
68489
  rawOptions.__references = Object.fromEntries(this.#ruleSet.builtinReferences.entries());
68442
68490
  rawOptions.__virtual_files = VirtualModulesPlugin.__internal__take_virtual_files(this);
68443
- const instanceBinding = __webpack_require__("@rspack/binding?81b3");
68491
+ const instanceBinding = __webpack_require__("@rspack/binding?f5f3");
68444
68492
  this.#registers = this.#createHooksRegisters();
68445
68493
  const inputFileSystem = this.inputFileSystem && ThreadsafeInputNodeFS.needsBinding(options.experiments.useInputFileSystem) ? ThreadsafeInputNodeFS.__to_binding(this.inputFileSystem) : void 0;
68446
68494
  try {
@@ -68459,14 +68507,14 @@ class Compiler {
68459
68507
  const createTap = this.#createHookRegisterTaps.bind(this);
68460
68508
  const createMapTap = this.#createHookMapRegisterTaps.bind(this);
68461
68509
  return {
68462
- ...createCompilerHooksRegisters(getCompiler, createTap, createMapTap),
68510
+ ...createCompilerHooksRegisters(getCompiler, createTap),
68463
68511
  ...createCompilationHooksRegisters(getCompiler, createTap, createMapTap),
68464
68512
  ...createNormalModuleFactoryHooksRegisters(getCompiler, createTap, createMapTap),
68465
- ...createContextModuleFactoryHooksRegisters(getCompiler, createTap, createMapTap),
68466
- ...createJavaScriptModulesHooksRegisters(getCompiler, createTap, createMapTap),
68467
- ...createHtmlPluginHooksRegisters(getCompiler, createTap, createMapTap),
68468
- ...createRuntimePluginHooksRegisters(getCompiler, createTap, createMapTap),
68469
- ...createRsdoctorPluginHooksRegisters(getCompiler, createTap, createMapTap)
68513
+ ...createContextModuleFactoryHooksRegisters(getCompiler, createTap),
68514
+ ...createJavaScriptModulesHooksRegisters(getCompiler, createTap),
68515
+ ...createHtmlPluginHooksRegisters(getCompiler, createTap),
68516
+ ...createRuntimePluginHooksRegisters(getCompiler, createTap),
68517
+ ...createRsdoctorPluginHooksRegisters(getCompiler, createTap)
68470
68518
  };
68471
68519
  }
68472
68520
  #updateNonSkippableRegisters() {
@@ -68650,11 +68698,11 @@ Object.defineProperty(rspack_wasi_browser.ExternalModule.prototype, 'emitFile',
68650
68698
  const ModuleGraphConnection_ModuleGraphConnection = ModuleGraphConnection;
68651
68699
  Object.defineProperties(ModuleGraphConnection_ModuleGraphConnection, {
68652
68700
  TRANSITIVE_ONLY: {
68653
- value: TRANSITIVE_ONLY_SYMBOL,
68701
+ value: rspack_wasi_browser.TRANSITIVE_ONLY_SYMBOL,
68654
68702
  enumerable: true
68655
68703
  },
68656
68704
  CIRCULAR_CONNECTION: {
68657
- value: CIRCULAR_CONNECTION_SYMBOL,
68705
+ value: rspack_wasi_browser.CIRCULAR_CONNECTION_SYMBOL,
68658
68706
  enumerable: true
68659
68707
  }
68660
68708
  });
@@ -70016,7 +70064,7 @@ function transformSync(source, options) {
70016
70064
  const _options = JSON.stringify(options || {});
70017
70065
  return rspack_wasi_browser.transformSync(source, _options);
70018
70066
  }
70019
- const exports_rspackVersion = "2.0.0-rc.1";
70067
+ const exports_rspackVersion = "2.0.0-rc.2";
70020
70068
  const exports_version = "5.75.0";
70021
70069
  const exports_WebpackError = Error;
70022
70070
  const exports_config = {
@@ -732,7 +732,7 @@ export interface JsBeforeModuleIdsArg {
732
732
  }
733
733
 
734
734
  export interface JsBeforeModuleIdsResult {
735
- assignments: Record<string, string>
735
+ assignments: Record<string, string | number>
736
736
  }
737
737
 
738
738
  export interface JsBuildMeta {
@@ -740,15 +740,11 @@ export interface JsBuildMeta {
740
740
  hasTopLevelAwait?: boolean
741
741
  esm?: boolean
742
742
  exportsType?: undefined | 'unset' | 'default' | 'namespace' | 'flagged' | 'dynamic'
743
- defaultObject?: undefined | 'false' | 'redirect' | JsBuildMetaDefaultObjectRedirectWarn
743
+ defaultObject?: undefined | 'false' | 'redirect' | 'redirect-warn'
744
744
  sideEffectFree?: boolean
745
745
  exportsFinalName?: Array<[string, string]> | undefined
746
746
  }
747
747
 
748
- export interface JsBuildMetaDefaultObjectRedirectWarn {
749
- redirectWarn: JsDefaultObjectRedirectWarnObject
750
- }
751
-
752
748
  export interface JsBuildTimeExecutionOption {
753
749
  publicPath?: string
754
750
  baseUri?: string
@@ -810,10 +806,6 @@ export interface JsCreateScriptData {
810
806
  chunk: Chunk
811
807
  }
812
808
 
813
- export interface JsDefaultObjectRedirectWarnObject {
814
- ignore: boolean
815
- }
816
-
817
809
  export interface JsDiagnostic {
818
810
  message: string
819
811
  help?: string
@@ -1893,6 +1885,7 @@ export interface RawCacheGroupOptions {
1893
1885
  minChunks?: number
1894
1886
  minSize?: number | RawSplitChunkSizes
1895
1887
  minSizeReduction?: number | RawSplitChunkSizes
1888
+ enforceSizeThreshold?: number | RawSplitChunkSizes
1896
1889
  maxSize?: number | RawSplitChunkSizes
1897
1890
  maxAsyncSize?: number | RawSplitChunkSizes
1898
1891
  maxInitialSize?: number | RawSplitChunkSizes
@@ -3008,7 +3001,7 @@ export interface RawSplitChunksOptions {
3008
3001
  hidePathInfo?: boolean
3009
3002
  minSize?: number | RawSplitChunkSizes
3010
3003
  minSizeReduction?: number | RawSplitChunkSizes
3011
- enforceSizeThreshold?: number
3004
+ enforceSizeThreshold?: number | RawSplitChunkSizes
3012
3005
  minRemainingSize?: number | RawSplitChunkSizes
3013
3006
  maxSize?: number | RawSplitChunkSizes
3014
3007
  maxAsyncSize?: number | RawSplitChunkSizes
@@ -17,13 +17,14 @@ const __wasi = new __WASI({
17
17
  },
18
18
  })
19
19
 
20
- const __wasmUrl = window.RSPACK_WASM_URL || new URL('./rspack.wasm32-wasi.wasm', import.meta.url).href
20
+ const __wasmUrl = globalThis.RSPACK_WASM_URL || new URL('./rspack.wasm32-wasi.wasm', import.meta.url).href
21
21
  const __emnapiContext = __emnapiGetDefaultContext()
22
22
  __emnapiContext.feature.Buffer = Buffer
23
23
 
24
+ // Allocate 2GB fixed shared memory (initial == maximum to disable memory.grow).
24
25
  const __sharedMemory = new WebAssembly.Memory({
25
- initial: 16384,
26
- maximum: 65536,
26
+ initial: 32768,
27
+ maximum: 32768,
27
28
  shared: true,
28
29
  })
29
30
 
@@ -57,6 +58,10 @@ const {
57
58
  ...importObject.napi,
58
59
  ...importObject.emnapi,
59
60
  memory: __sharedMemory,
61
+ // Override emnapi's napi_adjust_external_memory to a no-op.
62
+ // emnapi implements this by calling memory.grow, but we've disabled memory.grow
63
+ // (initial == maximum).
64
+ napi_adjust_external_memory() { return 0 },
60
65
  }
61
66
  return importObject
62
67
  },
Binary file
@@ -12358,7 +12358,7 @@
12358
12358
  const getgid = ()=>process_1.default.getgid?.() ?? 0;
12359
12359
  const EMPTY_BUFFER = (0, buffer_1.bufferAllocUnsafe)(0);
12360
12360
  let Node$1 = class {
12361
- constructor(ino, mode = 0o666){
12361
+ constructor(ino, mode = 0o666, uid = getuid(), gid = getgid()){
12362
12362
  this.changes = new fanout_1.FanOut();
12363
12363
  this._uid = getuid();
12364
12364
  this._gid = getgid();
@@ -12372,6 +12372,8 @@
12372
12372
  this._nlink = 1;
12373
12373
  this.mode = mode;
12374
12374
  this.ino = ino;
12375
+ this._uid = uid;
12376
+ this._gid = gid;
12375
12377
  }
12376
12378
  set ctime(ctime) {
12377
12379
  this._ctime = ctime;
@@ -15819,17 +15821,17 @@
15819
15821
  const pathJoin = path_1.posix ? path_1.posix.join : path_1.join;
15820
15822
  const { O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_EXCL, O_TRUNC, O_APPEND, O_DIRECTORY } = fs_node_utils_1.constants;
15821
15823
  let Superblock$1 = class Superblock {
15822
- static fromJSON(json, cwd) {
15823
- const vol = new Superblock();
15824
+ static fromJSON(json, cwd, opts) {
15825
+ const vol = new Superblock(opts);
15824
15826
  vol.fromJSON(json, cwd);
15825
15827
  return vol;
15826
15828
  }
15827
- static fromNestedJSON(json, cwd) {
15828
- const vol = new Superblock();
15829
+ static fromNestedJSON(json, cwd, opts) {
15830
+ const vol = new Superblock(opts);
15829
15831
  vol.fromNestedJSON(json, cwd);
15830
15832
  return vol;
15831
15833
  }
15832
- constructor(props = {}){
15834
+ constructor(opts = {}){
15833
15835
  this.ino = 0;
15834
15836
  this.inodes = {};
15835
15837
  this.releasedInos = [];
@@ -16011,6 +16013,7 @@
16011
16013
  const file = this.getFileByFdOrThrow(fd, 'close');
16012
16014
  this.closeFile(file);
16013
16015
  };
16016
+ this.process = opts.process ?? process_1.default;
16014
16017
  const root = this.createLink();
16015
16018
  root.setNode(this.createNode(0o777 | fs_node_utils_1.constants.S_IFDIR));
16016
16019
  root.setChild('.', root);
@@ -16047,7 +16050,9 @@
16047
16050
  return 'number' == typeof releasedFd ? releasedFd : Superblock.fd--;
16048
16051
  }
16049
16052
  createNode(mode) {
16050
- const node = new Node_1.Node(this.newInoNumber(), mode);
16053
+ const uid = this.process.getuid?.() ?? 0;
16054
+ const gid = this.process.getgid?.() ?? 0;
16055
+ const node = new Node_1.Node(this.newInoNumber(), mode, uid, gid);
16051
16056
  this.inodes[node.ino] = node;
16052
16057
  return node;
16053
16058
  }
@@ -16071,10 +16076,12 @@
16071
16076
  }
16072
16077
  let curr = this.root;
16073
16078
  let i = 0;
16079
+ const uid = this.process.getuid?.() ?? 0;
16080
+ const gid = this.process.getgid?.() ?? 0;
16074
16081
  while(i < steps.length){
16075
16082
  let node = curr.getNode();
16076
16083
  if (node.isDirectory()) {
16077
- if (checkAccess && !node.canExecute()) return (0, result_1.Err)((0, util_1.createStatError)("EACCES", funcName, filename));
16084
+ if (checkAccess && !node.canExecute(uid, gid)) return (0, result_1.Err)((0, util_1.createStatError)("EACCES", funcName, filename));
16078
16085
  } else if (i < steps.length - 1) return (0, result_1.Err)((0, util_1.createStatError)("ENOTDIR", funcName, filename));
16079
16086
  curr = curr.getChild(steps[i]) ?? null;
16080
16087
  if (!curr) if (checkExistence) return (0, result_1.Err)((0, util_1.createStatError)("ENOENT", funcName, filename));
@@ -16088,7 +16095,7 @@
16088
16095
  continue;
16089
16096
  }
16090
16097
  if (checkExistence && !node.isDirectory() && i < steps.length - 1) {
16091
- const errorCode = 'win32' === process_1.default.platform ? "ENOENT" : "ENOTDIR";
16098
+ const errorCode = 'win32' === this.process.platform ? "ENOENT" : "ENOTDIR";
16092
16099
  return (0, result_1.Err)((0, util_1.createStatError)(errorCode, funcName, filename));
16093
16100
  }
16094
16101
  i++;
@@ -16192,7 +16199,7 @@
16192
16199
  for (const link of links)this._toJSON(link, json, isRelative ? link.getPath() : '', asBuffer);
16193
16200
  return json;
16194
16201
  }
16195
- fromJSON(json, cwd = process_1.default.cwd()) {
16202
+ fromJSON(json, cwd = this.process.cwd()) {
16196
16203
  for(let filename in json){
16197
16204
  const data = json[filename];
16198
16205
  filename = (0, util_1.resolve)(filename, cwd);
@@ -25933,8 +25940,9 @@
25933
25940
  });
25934
25941
  results.push(...dirResults.map((r)=>path_1.posix.resolve(dir, r)));
25935
25942
  } else {
25943
+ const normalizedPattern = pattern.replace(/^\.\//, '');
25936
25944
  const dirResults = walkDirectory(fs, resolvedCwd, [
25937
- pattern
25945
+ normalizedPattern
25938
25946
  ], globOptions);
25939
25947
  results.push(...dirResults);
25940
25948
  }
@@ -27107,8 +27115,8 @@
27107
27115
  }
27108
27116
  }
27109
27117
  volume.Volume = Volume;
27110
- Volume.fromJSON = (json, cwd)=>new Volume(fs_core_1.Superblock.fromJSON(json, cwd));
27111
- Volume.fromNestedJSON = (json, cwd)=>new Volume(fs_core_1.Superblock.fromNestedJSON(json, cwd));
27118
+ Volume.fromJSON = (json, cwd, opts)=>new Volume(fs_core_1.Superblock.fromJSON(json, cwd, opts));
27119
+ Volume.fromNestedJSON = (json, cwd, opts)=>new Volume(fs_core_1.Superblock.fromNestedJSON(json, cwd, opts));
27112
27120
  function emitStop(self1) {
27113
27121
  self1.emit('stop');
27114
27122
  }
@@ -27165,6 +27173,7 @@
27165
27173
  if (void 0 === options.highWaterMark) options.highWaterMark = 65536;
27166
27174
  stream_1.Readable.call(this, options);
27167
27175
  this.path = (0, util_3.pathToFilename)(path);
27176
+ this._fileHandle = options.fd && 'number' != typeof options.fd ? options.fd : null;
27168
27177
  this.fd = void 0 === options.fd ? null : 'number' != typeof options.fd ? options.fd.fd : options.fd;
27169
27178
  this.flags = void 0 === options.flags ? 'r' : options.flags;
27170
27179
  this.mode = void 0 === options.mode ? 0o666 : options.mode;
@@ -27244,7 +27253,8 @@
27244
27253
  }
27245
27254
  if ('boolean' == typeof this._readableState?.closed) this._readableState.closed = true;
27246
27255
  else this.closed = true;
27247
- this._vol.close(this.fd, (er)=>{
27256
+ if (this._fileHandle) this._fileHandle.close().then(()=>this.emit('close'), (er)=>this.emit('error', er));
27257
+ else this._vol.close(this.fd, (er)=>{
27248
27258
  if (er) this.emit('error', er);
27249
27259
  else this.emit('close');
27250
27260
  });
@@ -27261,6 +27271,7 @@
27261
27271
  options = Object.assign({}, (0, options_1.getOptions)(options, {}));
27262
27272
  stream_1.Writable.call(this, options);
27263
27273
  this.path = (0, util_3.pathToFilename)(path);
27274
+ this._fileHandle = options.fd && 'number' != typeof options.fd ? options.fd : null;
27264
27275
  this.fd = void 0 === options.fd ? null : 'number' != typeof options.fd ? options.fd.fd : options.fd;
27265
27276
  this.flags = void 0 === options.flags ? 'w' : options.flags;
27266
27277
  this.mode = void 0 === options.mode ? 0o666 : options.mode;
@@ -27340,7 +27351,8 @@
27340
27351
  }
27341
27352
  if ('boolean' == typeof this._writableState?.closed) this._writableState.closed = true;
27342
27353
  else this.closed = true;
27343
- this._vol.close(this.fd, (er)=>{
27354
+ if (this._fileHandle) this._fileHandle.close().then(()=>this.emit('close'), (er)=>this.emit('error', er));
27355
+ else this._vol.close(this.fd, (er)=>{
27344
27356
  if (er) this.emit('error', er);
27345
27357
  else this.emit('close');
27346
27358
  });
@@ -27748,8 +27760,14 @@
27748
27760
  return fs;
27749
27761
  }
27750
27762
  exports$1.fs = createFsFromVolume(exports$1.vol);
27751
- const memfs = (json = {}, cwd = '/')=>{
27752
- const vol = fs_node_1.Volume.fromNestedJSON(json, cwd);
27763
+ const memfs = (json = {}, cwdOrOpts = '/')=>{
27764
+ const opts = 'string' == typeof cwdOrOpts ? {
27765
+ cwd: cwdOrOpts
27766
+ } : cwdOrOpts;
27767
+ const cwd = opts.cwd ?? (opts.process ? void 0 : '/');
27768
+ const vol = fs_node_1.Volume.fromNestedJSON(json, cwd, {
27769
+ process: opts.process
27770
+ });
27753
27771
  const fs = createFsFromVolume(vol);
27754
27772
  return {
27755
27773
  fs,
@@ -27801,7 +27819,10 @@
27801
27819
  ...importObject.env,
27802
27820
  ...importObject.napi,
27803
27821
  ...importObject.emnapi,
27804
- memory: wasmMemory
27822
+ memory: wasmMemory,
27823
+ napi_adjust_external_memory () {
27824
+ return 0;
27825
+ }
27805
27826
  };
27806
27827
  }
27807
27828
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/browser",
3
- "version": "2.0.0-rc.1",
3
+ "version": "2.0.0-rc.2",
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.",
@@ -29,7 +29,9 @@
29
29
  "directory": "packages/rspack-browser"
30
30
  },
31
31
  "dependencies": {
32
- "@napi-rs/wasm-runtime": "1.1.2",
32
+ "@emnapi/core": "1.9.2",
33
+ "@emnapi/runtime": "1.9.2",
34
+ "@napi-rs/wasm-runtime": "1.1.3",
33
35
  "@rspack/lite-tapable": "1.1.0",
34
36
  "@swc/types": "0.1.26",
35
37
  "@types/watchpack": "^2.4.5",