@rspack/browser 2.1.1 → 2.1.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.
@@ -1020,13 +1020,13 @@ export interface JsPathData {
1020
1020
  runtime?: string
1021
1021
  url?: string
1022
1022
  id?: string
1023
- chunk?: JsPathDataChunkLike
1023
+ chunk?: Chunk | JsPathDataChunkLike
1024
1024
  }
1025
1025
 
1026
1026
  export interface JsPathDataChunkLike {
1027
+ id?: string | number
1027
1028
  name?: string
1028
1029
  hash?: string
1029
- id?: string
1030
1030
  }
1031
1031
 
1032
1032
  export interface JsResolveData {
@@ -2119,6 +2119,7 @@ export interface RawCopyRspackPluginOptions {
2119
2119
  }
2120
2120
 
2121
2121
  export interface RawCssAutoOrModuleParserOptions {
2122
+ exportType?: "link" | "text" | "css-style-sheet" | "style"
2122
2123
  namedExports?: boolean
2123
2124
  url?: boolean
2124
2125
  import?: boolean
@@ -2176,6 +2177,7 @@ export interface RawCssModuleGeneratorOptions {
2176
2177
  }
2177
2178
 
2178
2179
  export interface RawCssModuleParserOptions {
2180
+ exportType?: "link" | "text" | "css-style-sheet" | "style"
2179
2181
  namedExports?: boolean
2180
2182
  url?: boolean
2181
2183
  import?: boolean
@@ -2189,6 +2191,7 @@ export interface RawCssModuleParserOptions {
2189
2191
  }
2190
2192
 
2191
2193
  export interface RawCssParserOptions {
2194
+ exportType?: "link" | "text" | "css-style-sheet" | "style"
2192
2195
  namedExports?: boolean
2193
2196
  url?: boolean
2194
2197
  import?: boolean
Binary file
@@ -7,5 +7,5 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- declare const _default: () => import("./wasm-hash").WasmHash;
11
10
  export default _default;
11
+ declare function _default(): import("./wasm-hash").WasmHash;
@@ -7,5 +7,5 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- declare const _default: () => import("./wasm-hash").WasmHash;
11
10
  export default _default;
11
+ declare function _default(): import("./wasm-hash").WasmHash;
@@ -7851,8 +7851,18 @@
7851
7851
  const _memory = new WeakMap();
7852
7852
  const _wasi = new WeakMap();
7853
7853
  const _fs = new WeakMap();
7854
- function wasm_util_esm_bundler_getMemory(wasi) {
7855
- return _memory.get(wasi);
7854
+ function ensureMemoryFor(memory, end) {
7855
+ let buffer = memory.buffer;
7856
+ if (end > buffer.byteLength) {
7857
+ memory.grow(0);
7858
+ buffer = memory.buffer;
7859
+ }
7860
+ return buffer;
7861
+ }
7862
+ function wasm_util_esm_bundler_getMemory(wasi, end = 0) {
7863
+ const memory = _memory.get(wasi);
7864
+ ensureMemoryFor(memory, end);
7865
+ return memory;
7856
7866
  }
7857
7867
  function getFs(wasi) {
7858
7868
  const fs = _fs.get(wasi);
@@ -7965,9 +7975,10 @@
7965
7975
  argv = Number(argv);
7966
7976
  argv_buf = Number(argv_buf);
7967
7977
  if (0 === argv || 0 === argv_buf) return 28;
7968
- const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this);
7969
7978
  const wasi = _wasi.get(this);
7970
7979
  const args = wasi.args;
7980
+ const argsSize = wasm_util_esm_bundler_encoder.encode(args.join('\0') + '\0').length;
7981
+ const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this, Math.max(argv + 4 * args.length, argv_buf + argsSize));
7971
7982
  for(let i = 0; i < args.length; ++i){
7972
7983
  const arg = args[i];
7973
7984
  view.setInt32(argv, argv_buf, true);
@@ -7982,7 +7993,7 @@
7982
7993
  argc = Number(argc);
7983
7994
  argv_buf_size = Number(argv_buf_size);
7984
7995
  if (0 === argc || 0 === argv_buf_size) return 28;
7985
- const { view } = wasm_util_esm_bundler_getMemory(this);
7996
+ const { view } = wasm_util_esm_bundler_getMemory(this, Math.max(argc + 4, argv_buf_size + 4));
7986
7997
  const wasi = _wasi.get(this);
7987
7998
  const args = wasi.args;
7988
7999
  view.setUint32(argc, args.length, true);
@@ -7993,9 +8004,10 @@
7993
8004
  environ = Number(environ);
7994
8005
  environ_buf = Number(environ_buf);
7995
8006
  if (0 === environ || 0 === environ_buf) return 28;
7996
- const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this);
7997
8007
  const wasi = _wasi.get(this);
7998
8008
  const env = wasi.env;
8009
+ const envSize = wasm_util_esm_bundler_encoder.encode(env.join('\0') + '\0').length;
8010
+ const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this, Math.max(environ + 4 * env.length, environ_buf + envSize));
7999
8011
  for(let i = 0; i < env.length; ++i){
8000
8012
  const pair = env[i];
8001
8013
  view.setInt32(environ, environ_buf, true);
@@ -8010,7 +8022,7 @@
8010
8022
  len = Number(len);
8011
8023
  buflen = Number(buflen);
8012
8024
  if (0 === len || 0 === buflen) return 28;
8013
- const { view } = wasm_util_esm_bundler_getMemory(this);
8025
+ const { view } = wasm_util_esm_bundler_getMemory(this, Math.max(len + 4, buflen + 4));
8014
8026
  const wasi = _wasi.get(this);
8015
8027
  view.setUint32(len, wasi.env.length, true);
8016
8028
  view.setUint32(buflen, wasm_util_esm_bundler_encoder.encode(wasi.env.join('\0') + '\0').length, true);
@@ -8019,7 +8031,7 @@
8019
8031
  this.clock_res_get = syscallWrap(this, 'clock_res_get', function(id, resolution) {
8020
8032
  resolution = Number(resolution);
8021
8033
  if (0 === resolution) return 28;
8022
- const { view } = wasm_util_esm_bundler_getMemory(this);
8034
+ const { view } = wasm_util_esm_bundler_getMemory(this, resolution + 8);
8023
8035
  switch(id){
8024
8036
  case 0:
8025
8037
  view.setBigUint64(resolution, BigInt(1000000), true);
@@ -8036,7 +8048,7 @@
8036
8048
  this.clock_time_get = syscallWrap(this, 'clock_time_get', function(id, _percision, time) {
8037
8049
  time = Number(time);
8038
8050
  if (0 === time) return 28;
8039
- const { view } = wasm_util_esm_bundler_getMemory(this);
8051
+ const { view } = wasm_util_esm_bundler_getMemory(this, time + 8);
8040
8052
  switch(id){
8041
8053
  case 0:
8042
8054
  view.setBigUint64(time, BigInt(Date.now()) * BigInt(1000000), true);
@@ -8064,7 +8076,7 @@
8064
8076
  if (0 === fdstat) return 28;
8065
8077
  const wasi = _wasi.get(this);
8066
8078
  const fileDescriptor = wasi.fds.get(fd, BigInt(0), BigInt(0));
8067
- const { view } = wasm_util_esm_bundler_getMemory(this);
8079
+ const { view } = wasm_util_esm_bundler_getMemory(this, fdstat + 24);
8068
8080
  view.setUint16(fdstat, fileDescriptor.type, true);
8069
8081
  view.setUint16(fdstat + 2, 0, true);
8070
8082
  view.setBigUint64(fdstat + 8, fileDescriptor.rightsBase, true);
@@ -8095,7 +8107,7 @@
8095
8107
  throw err;
8096
8108
  }
8097
8109
  if (1 !== fileDescriptor.preopen) return 28;
8098
- const { view } = wasm_util_esm_bundler_getMemory(this);
8110
+ const { view } = wasm_util_esm_bundler_getMemory(this, prestat + 8);
8099
8111
  view.setUint32(prestat, 0, true);
8100
8112
  view.setUint32(prestat + 4, wasm_util_esm_bundler_encoder.encode(fileDescriptor.path).length, true);
8101
8113
  return 0;
@@ -8110,7 +8122,7 @@
8110
8122
  const buffer = wasm_util_esm_bundler_encoder.encode(fileDescriptor.path);
8111
8123
  const size = buffer.length;
8112
8124
  if (size > path_len) return 42;
8113
- const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this);
8125
+ const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this, path + size);
8114
8126
  HEAPU8.set(buffer, path);
8115
8127
  return 0;
8116
8128
  });
@@ -8121,7 +8133,7 @@
8121
8133
  const wasi = _wasi.get(this);
8122
8134
  const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_SEEK, BigInt(0));
8123
8135
  const r = fileDescriptor.seek(offset, whence);
8124
- const { view } = wasm_util_esm_bundler_getMemory(this);
8136
+ const { view } = wasm_util_esm_bundler_getMemory(this, newOffset + 8);
8125
8137
  view.setBigUint64(newOffset, r, true);
8126
8138
  return 0;
8127
8139
  });
@@ -8129,7 +8141,7 @@
8129
8141
  const wasi = _wasi.get(this);
8130
8142
  const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_TELL, BigInt(0));
8131
8143
  const pos = BigInt(fileDescriptor.pos);
8132
- const { view } = wasm_util_esm_bundler_getMemory(this);
8144
+ const { view } = wasm_util_esm_bundler_getMemory(this, Number(offset) + 8);
8133
8145
  view.setBigUint64(Number(offset), pos, true);
8134
8146
  return 0;
8135
8147
  });
@@ -8140,7 +8152,7 @@
8140
8152
  nsubscriptions = Number(nsubscriptions);
8141
8153
  nsubscriptions >>>= 0;
8142
8154
  if (0 === in_ptr || 0 === out_ptr || 0 === nsubscriptions || 0 === nevents) return 28;
8143
- const { view } = wasm_util_esm_bundler_getMemory(this);
8155
+ const { view } = wasm_util_esm_bundler_getMemory(this, Math.max(in_ptr + 48 * nsubscriptions, out_ptr + 32 * nsubscriptions, nevents + 4));
8144
8156
  view.setUint32(nevents, 0, true);
8145
8157
  let i = 0;
8146
8158
  let timer_userdata = BigInt(0);
@@ -8235,7 +8247,7 @@
8235
8247
  buf = Number(buf);
8236
8248
  if (0 === buf) return 28;
8237
8249
  buf_len = Number(buf_len);
8238
- const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this);
8250
+ const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this, buf + buf_len);
8239
8251
  if ('function' == typeof SharedArrayBuffer && HEAPU8.buffer instanceof SharedArrayBuffer || '[object SharedArrayBuffer]' === Object.prototype.toString.call(HEAPU8.buffer)) {
8240
8252
  for(let i = buf; i < buf + buf_len; ++i)view.setUint8(i, Math.floor(256 * Math.random()));
8241
8253
  return 0;
@@ -8249,7 +8261,7 @@
8249
8261
  buf = Number(buf);
8250
8262
  if (0 === buf) return 28;
8251
8263
  buf_len = Number(buf_len);
8252
- const { view } = wasm_util_esm_bundler_getMemory(this);
8264
+ const { view } = wasm_util_esm_bundler_getMemory(this, buf + buf_len);
8253
8265
  for(let i = buf; i < buf + buf_len; ++i)view.setUint8(i, Math.floor(256 * Math.random()));
8254
8266
  return 0;
8255
8267
  });
@@ -8345,7 +8357,7 @@
8345
8357
  const stat = fs.fstatSync(fileDescriptor.fd, {
8346
8358
  bigint: true
8347
8359
  });
8348
- const { view } = wasm_util_esm_bundler_getMemory(this);
8360
+ const { view } = wasm_util_esm_bundler_getMemory(this, buf + 64);
8349
8361
  toFileStat(view, buf, stat);
8350
8362
  return 0;
8351
8363
  }, async function(fd, buf) {
@@ -8357,7 +8369,7 @@
8357
8369
  const stat = await h.stat({
8358
8370
  bigint: true
8359
8371
  });
8360
- const { view } = wasm_util_esm_bundler_getMemory(this);
8372
+ const { view } = wasm_util_esm_bundler_getMemory(this, buf + 64);
8361
8373
  toFileStat(view, buf, stat);
8362
8374
  return 0;
8363
8375
  }, [
@@ -8419,7 +8431,7 @@
8419
8431
  iovs = Number(iovs);
8420
8432
  size = Number(size);
8421
8433
  if (0 === iovs && iovslen || 0 === size || offset > INT64_MAX) return 28;
8422
- const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this);
8434
+ const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this, Math.max(iovs + 8 * Number(iovslen), size + 4));
8423
8435
  const wasi = _wasi.get(this);
8424
8436
  const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_READ | WasiRights.FD_SEEK, BigInt(0));
8425
8437
  if (!iovslen) {
@@ -8454,7 +8466,7 @@
8454
8466
  iovs = Number(iovs);
8455
8467
  size = Number(size);
8456
8468
  if (0 === iovs && iovslen || 0 === size || offset > INT64_MAX) return 28;
8457
- const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this);
8469
+ const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this, Math.max(iovs + 8 * Number(iovslen), size + 4));
8458
8470
  const wasi = _wasi.get(this);
8459
8471
  const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_READ | WasiRights.FD_SEEK, BigInt(0));
8460
8472
  if (!iovslen) {
@@ -8491,7 +8503,7 @@
8491
8503
  iovs = Number(iovs);
8492
8504
  size = Number(size);
8493
8505
  if (0 === iovs && iovslen || 0 === size || offset > INT64_MAX) return 28;
8494
- const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this);
8506
+ const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this, Math.max(iovs + 8 * Number(iovslen), size + 4));
8495
8507
  const wasi = _wasi.get(this);
8496
8508
  const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_WRITE | WasiRights.FD_SEEK, BigInt(0));
8497
8509
  if (!iovslen) {
@@ -8514,7 +8526,7 @@
8514
8526
  iovs = Number(iovs);
8515
8527
  size = Number(size);
8516
8528
  if (0 === iovs && iovslen || 0 === size || offset > INT64_MAX) return 28;
8517
- const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this);
8529
+ const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this, Math.max(iovs + 8 * Number(iovslen), size + 4));
8518
8530
  const wasi = _wasi.get(this);
8519
8531
  const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_WRITE | WasiRights.FD_SEEK, BigInt(0));
8520
8532
  if (!iovslen) {
@@ -8545,7 +8557,7 @@
8545
8557
  iovs = Number(iovs);
8546
8558
  size = Number(size);
8547
8559
  if (0 === iovs && iovslen || 0 === size) return 28;
8548
- const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this);
8560
+ const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this, Math.max(iovs + 8 * Number(iovslen), size + 4));
8549
8561
  const wasi = _wasi.get(this);
8550
8562
  const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_READ, BigInt(0));
8551
8563
  if (!iovslen) {
@@ -8588,7 +8600,7 @@
8588
8600
  iovs = Number(iovs);
8589
8601
  size = Number(size);
8590
8602
  if (0 === iovs && iovslen || 0 === size) return 28;
8591
- const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this);
8603
+ const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this, Math.max(iovs + 8 * Number(iovslen), size + 4));
8592
8604
  const wasi = _wasi.get(this);
8593
8605
  const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_READ, BigInt(0));
8594
8606
  if (!iovslen) {
@@ -8639,7 +8651,7 @@
8639
8651
  const entries = fs.readdirSync(fileDescriptor.realPath, {
8640
8652
  withFileTypes: true
8641
8653
  });
8642
- const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this);
8654
+ const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this, Math.max(buf + buf_len, bufused + 4));
8643
8655
  let bufferUsed = 0;
8644
8656
  for(let i = Number(cookie); i < entries.length; i++){
8645
8657
  const nameData = wasm_util_esm_bundler_encoder.encode(entries[i].name);
@@ -8672,7 +8684,7 @@
8672
8684
  const entries = await fs.promises.readdir(fileDescriptor.realPath, {
8673
8685
  withFileTypes: true
8674
8686
  });
8675
- const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this);
8687
+ const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this, Math.max(buf + buf_len, bufused + 4));
8676
8688
  let bufferUsed = 0;
8677
8689
  for(let i = Number(cookie); i < entries.length; i++){
8678
8690
  const nameData = wasm_util_esm_bundler_encoder.encode(entries[i].name);
@@ -8737,7 +8749,7 @@
8737
8749
  iovs = Number(iovs);
8738
8750
  size = Number(size);
8739
8751
  if (0 === iovs && iovslen || 0 === size) return 28;
8740
- const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this);
8752
+ const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this, Math.max(iovs + 8 * Number(iovslen), size + 4));
8741
8753
  const wasi = _wasi.get(this);
8742
8754
  const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_WRITE, BigInt(0));
8743
8755
  if (!iovslen) {
@@ -8765,7 +8777,7 @@
8765
8777
  iovs = Number(iovs);
8766
8778
  size = Number(size);
8767
8779
  if (0 === iovs && iovslen || 0 === size) return 28;
8768
- const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this);
8780
+ const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this, Math.max(iovs + 8 * Number(iovslen), size + 4));
8769
8781
  const wasi = _wasi.get(this);
8770
8782
  const fileDescriptor = wasi.fds.get(fd, WasiRights.FD_WRITE, BigInt(0));
8771
8783
  if (!iovslen) {
@@ -8800,7 +8812,7 @@
8800
8812
  path = Number(path);
8801
8813
  path_len = Number(path_len);
8802
8814
  if (0 === path) return 28;
8803
- const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this);
8815
+ const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this, path + path_len);
8804
8816
  const wasi = _wasi.get(this);
8805
8817
  const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_CREATE_DIRECTORY, BigInt(0));
8806
8818
  let pathString = wasm_util_esm_bundler_decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
@@ -8812,7 +8824,7 @@
8812
8824
  path = Number(path);
8813
8825
  path_len = Number(path_len);
8814
8826
  if (0 === path) return 28;
8815
- const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this);
8827
+ const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this, path + path_len);
8816
8828
  const wasi = _wasi.get(this);
8817
8829
  const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_CREATE_DIRECTORY, BigInt(0));
8818
8830
  let pathString = wasm_util_esm_bundler_decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
@@ -8832,7 +8844,7 @@
8832
8844
  path_len = Number(path_len);
8833
8845
  filestat = Number(filestat);
8834
8846
  if (0 === path || 0 === filestat) return 28;
8835
- const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this);
8847
+ const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this, Math.max(path + path_len, filestat + 64));
8836
8848
  const wasi = _wasi.get(this);
8837
8849
  const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_FILESTAT_GET, BigInt(0));
8838
8850
  let pathString = wasm_util_esm_bundler_decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
@@ -8851,7 +8863,7 @@
8851
8863
  path_len = Number(path_len);
8852
8864
  filestat = Number(filestat);
8853
8865
  if (0 === path || 0 === filestat) return 28;
8854
- const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this);
8866
+ const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this, Math.max(path + path_len, filestat + 64));
8855
8867
  const wasi = _wasi.get(this);
8856
8868
  const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_FILESTAT_GET, BigInt(0));
8857
8869
  let pathString = wasm_util_esm_bundler_decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
@@ -8878,7 +8890,7 @@
8878
8890
  path = Number(path);
8879
8891
  path_len = Number(path_len);
8880
8892
  if (0 === path) return 28;
8881
- const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this);
8893
+ const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this, path + path_len);
8882
8894
  const wasi = _wasi.get(this);
8883
8895
  const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_FILESTAT_SET_TIMES, BigInt(0));
8884
8896
  if (validateFstFlagsOrReturn(fst_flags)) return 28;
@@ -8892,7 +8904,7 @@
8892
8904
  path = Number(path);
8893
8905
  path_len = Number(path_len);
8894
8906
  if (0 === path) return 28;
8895
- const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this);
8907
+ const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this, path + path_len);
8896
8908
  const wasi = _wasi.get(this);
8897
8909
  const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_FILESTAT_SET_TIMES, BigInt(0));
8898
8910
  if (validateFstFlagsOrReturn(fst_flags)) return 28;
@@ -8927,7 +8939,7 @@
8927
8939
  oldWrap = wasi.fds.get(old_fd, WasiRights.PATH_LINK_SOURCE, BigInt(0));
8928
8940
  newWrap = wasi.fds.get(new_fd, WasiRights.PATH_LINK_TARGET, BigInt(0));
8929
8941
  }
8930
- const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this);
8942
+ const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this, Math.max(old_path + old_path_len, new_path + new_path_len));
8931
8943
  const fs = getFs(this);
8932
8944
  const resolvedOldPath = resolvePathSync(fs, oldWrap, wasm_util_esm_bundler_decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len)), old_flags);
8933
8945
  const resolvedNewPath = wasm_util_esm_bundler_resolve(newWrap.realPath, wasm_util_esm_bundler_decoder.decode(unsharedSlice(HEAPU8, new_path, new_path + new_path_len)));
@@ -8947,7 +8959,7 @@
8947
8959
  oldWrap = wasi.fds.get(old_fd, WasiRights.PATH_LINK_SOURCE, BigInt(0));
8948
8960
  newWrap = wasi.fds.get(new_fd, WasiRights.PATH_LINK_TARGET, BigInt(0));
8949
8961
  }
8950
- const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this);
8962
+ const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this, Math.max(old_path + old_path_len, new_path + new_path_len));
8951
8963
  const fs = getFs(this);
8952
8964
  const resolvedOldPath = await resolvePathAsync(fs, oldWrap, wasm_util_esm_bundler_decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len)), old_flags);
8953
8965
  const resolvedNewPath = wasm_util_esm_bundler_resolve(newWrap.realPath, wasm_util_esm_bundler_decoder.decode(unsharedSlice(HEAPU8, new_path, new_path + new_path_len)));
@@ -9008,7 +9020,7 @@
9008
9020
  const { flags: flagsRes, needed_base: neededBase, needed_inheriting: neededInheriting } = pathOpen(o_flags, fs_rights_base, fs_rights_inheriting, fs_flags);
9009
9021
  const wasi = _wasi.get(this);
9010
9022
  const fileDescriptor = wasi.fds.get(dirfd, neededBase, neededInheriting);
9011
- const memory = wasm_util_esm_bundler_getMemory(this);
9023
+ const memory = wasm_util_esm_bundler_getMemory(this, Math.max(path + path_len, fd + 4));
9012
9024
  const HEAPU8 = memory.HEAPU8;
9013
9025
  const pathString = wasm_util_esm_bundler_decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
9014
9026
  const fs = getFs(this);
@@ -9038,7 +9050,7 @@
9038
9050
  const { flags: flagsRes, needed_base: neededBase, needed_inheriting: neededInheriting } = pathOpen(o_flags, fs_rights_base, fs_rights_inheriting, fs_flags);
9039
9051
  const wasi = _wasi.get(this);
9040
9052
  const fileDescriptor = wasi.fds.get(dirfd, neededBase, neededInheriting);
9041
- const memory = wasm_util_esm_bundler_getMemory(this);
9053
+ const memory = wasm_util_esm_bundler_getMemory(this, Math.max(path + path_len, fd + 4));
9042
9054
  const HEAPU8 = memory.HEAPU8;
9043
9055
  const pathString = wasm_util_esm_bundler_decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
9044
9056
  const fs = getFs(this);
@@ -9078,7 +9090,7 @@
9078
9090
  buf_len = Number(buf_len);
9079
9091
  bufused = Number(bufused);
9080
9092
  if (0 === path || 0 === buf || 0 === bufused) return 28;
9081
- const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this);
9093
+ const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this, Math.max(path + path_len, buf + buf_len, bufused + 4));
9082
9094
  const wasi = _wasi.get(this);
9083
9095
  const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_READLINK, BigInt(0));
9084
9096
  let pathString = wasm_util_esm_bundler_decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
@@ -9099,7 +9111,7 @@
9099
9111
  buf_len = Number(buf_len);
9100
9112
  bufused = Number(bufused);
9101
9113
  if (0 === path || 0 === buf || 0 === bufused) return 28;
9102
- const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this);
9114
+ const { HEAPU8, view } = wasm_util_esm_bundler_getMemory(this, Math.max(path + path_len, buf + buf_len, bufused + 4));
9103
9115
  const wasi = _wasi.get(this);
9104
9116
  const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_READLINK, BigInt(0));
9105
9117
  let pathString = wasm_util_esm_bundler_decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
@@ -9127,7 +9139,7 @@
9127
9139
  path = Number(path);
9128
9140
  path_len = Number(path_len);
9129
9141
  if (0 === path) return 28;
9130
- const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this);
9142
+ const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this, path + path_len);
9131
9143
  const wasi = _wasi.get(this);
9132
9144
  const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_REMOVE_DIRECTORY, BigInt(0));
9133
9145
  let pathString = wasm_util_esm_bundler_decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
@@ -9139,7 +9151,7 @@
9139
9151
  path = Number(path);
9140
9152
  path_len = Number(path_len);
9141
9153
  if (0 === path) return 28;
9142
- const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this);
9154
+ const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this, path + path_len);
9143
9155
  const wasi = _wasi.get(this);
9144
9156
  const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_REMOVE_DIRECTORY, BigInt(0));
9145
9157
  let pathString = wasm_util_esm_bundler_decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
@@ -9168,7 +9180,7 @@
9168
9180
  oldWrap = wasi.fds.get(old_fd, WasiRights.PATH_RENAME_SOURCE, BigInt(0));
9169
9181
  newWrap = wasi.fds.get(new_fd, WasiRights.PATH_RENAME_TARGET, BigInt(0));
9170
9182
  }
9171
- const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this);
9183
+ const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this, Math.max(old_path + old_path_len, new_path + new_path_len));
9172
9184
  const resolvedOldPath = wasm_util_esm_bundler_resolve(oldWrap.realPath, wasm_util_esm_bundler_decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len)));
9173
9185
  const resolvedNewPath = wasm_util_esm_bundler_resolve(newWrap.realPath, wasm_util_esm_bundler_decoder.decode(unsharedSlice(HEAPU8, new_path, new_path + new_path_len)));
9174
9186
  const fs = getFs(this);
@@ -9188,7 +9200,7 @@
9188
9200
  oldWrap = wasi.fds.get(old_fd, WasiRights.PATH_RENAME_SOURCE, BigInt(0));
9189
9201
  newWrap = wasi.fds.get(new_fd, WasiRights.PATH_RENAME_TARGET, BigInt(0));
9190
9202
  }
9191
- const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this);
9203
+ const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this, Math.max(old_path + old_path_len, new_path + new_path_len));
9192
9204
  const resolvedOldPath = wasm_util_esm_bundler_resolve(oldWrap.realPath, wasm_util_esm_bundler_decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len)));
9193
9205
  const resolvedNewPath = wasm_util_esm_bundler_resolve(newWrap.realPath, wasm_util_esm_bundler_decoder.decode(unsharedSlice(HEAPU8, new_path, new_path + new_path_len)));
9194
9206
  const fs = getFs(this);
@@ -9210,7 +9222,7 @@
9210
9222
  new_path = Number(new_path);
9211
9223
  new_path_len = Number(new_path_len);
9212
9224
  if (0 === old_path || 0 === new_path) return 28;
9213
- const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this);
9225
+ const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this, Math.max(old_path + old_path_len, new_path + new_path_len));
9214
9226
  const wasi = _wasi.get(this);
9215
9227
  const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_SYMLINK, BigInt(0));
9216
9228
  const oldPath = wasm_util_esm_bundler_decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len));
@@ -9226,7 +9238,7 @@
9226
9238
  new_path = Number(new_path);
9227
9239
  new_path_len = Number(new_path_len);
9228
9240
  if (0 === old_path || 0 === new_path) return 28;
9229
- const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this);
9241
+ const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this, Math.max(old_path + old_path_len, new_path + new_path_len));
9230
9242
  const wasi = _wasi.get(this);
9231
9243
  const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_SYMLINK, BigInt(0));
9232
9244
  const oldPath = wasm_util_esm_bundler_decoder.decode(unsharedSlice(HEAPU8, old_path, old_path + old_path_len));
@@ -9248,7 +9260,7 @@
9248
9260
  path = Number(path);
9249
9261
  path_len = Number(path_len);
9250
9262
  if (0 === path) return 28;
9251
- const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this);
9263
+ const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this, path + path_len);
9252
9264
  const wasi = _wasi.get(this);
9253
9265
  const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_UNLINK_FILE, BigInt(0));
9254
9266
  let pathString = wasm_util_esm_bundler_decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
@@ -9260,7 +9272,7 @@
9260
9272
  path = Number(path);
9261
9273
  path_len = Number(path_len);
9262
9274
  if (0 === path) return 28;
9263
- const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this);
9275
+ const { HEAPU8 } = wasm_util_esm_bundler_getMemory(this, path + path_len);
9264
9276
  const wasi = _wasi.get(this);
9265
9277
  const fileDescriptor = wasi.fds.get(fd, WasiRights.PATH_UNLINK_FILE, BigInt(0));
9266
9278
  let pathString = wasm_util_esm_bundler_decoder.decode(unsharedSlice(HEAPU8, path, path + path_len));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/browser",
3
- "version": "2.1.1",
3
+ "version": "2.1.3",
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.",
@@ -31,10 +31,10 @@
31
31
  "dependencies": {
32
32
  "@emnapi/core": "1.11.1",
33
33
  "@emnapi/runtime": "1.11.1",
34
- "@napi-rs/wasm-runtime": "1.1.5",
34
+ "@napi-rs/wasm-runtime": "1.1.6",
35
35
  "@rspack/lite-tapable": "1.1.2",
36
36
  "@swc/types": "0.1.27",
37
- "memfs": "4.57.7",
37
+ "memfs": "4.57.8",
38
38
  "webpack-sources": "3.5.0"
39
39
  },
40
40
  "peerDependencies": {