@rollup/wasm-node 5.0.0-0 → 5.0.0-1

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/dist/bin/rollup +3 -3
  2. package/dist/es/getLogFilter.js +2 -2
  3. package/dist/es/parseAst.js +2 -2
  4. package/dist/es/rollup.js +2 -2
  5. package/dist/es/shared/node-entry.js +893 -689
  6. package/dist/es/shared/parseAst.js +113 -29
  7. package/dist/es/shared/watch.js +2 -2
  8. package/dist/getLogFilter.js +2 -2
  9. package/dist/loadConfigFile.js +2 -2
  10. package/dist/native.js +19 -3
  11. package/dist/parseAst.js +2 -2
  12. package/dist/rollup.android-arm-eabi.node +0 -0
  13. package/dist/rollup.android-arm64.node +0 -0
  14. package/dist/rollup.darwin-arm64.node +0 -0
  15. package/dist/rollup.darwin-x64.node +0 -0
  16. package/dist/rollup.freebsd-arm64.node +0 -0
  17. package/dist/rollup.freebsd-x64.node +0 -0
  18. package/dist/rollup.js +2 -2
  19. package/dist/rollup.linux-arm-gnueabihf.node +0 -0
  20. package/dist/rollup.linux-arm-musleabihf.node +0 -0
  21. package/dist/rollup.linux-arm64-gnu.node +0 -0
  22. package/dist/rollup.linux-arm64-musl.node +0 -0
  23. package/dist/rollup.linux-loong64-gnu.node +0 -0
  24. package/dist/rollup.linux-loong64-musl.node +0 -0
  25. package/dist/rollup.linux-ppc64-gnu.node +0 -0
  26. package/dist/rollup.linux-ppc64-musl.node +0 -0
  27. package/dist/rollup.linux-riscv64-gnu.node +0 -0
  28. package/dist/rollup.linux-riscv64-musl.node +0 -0
  29. package/dist/rollup.linux-s390x-gnu.node +0 -0
  30. package/dist/rollup.linux-x64-gnu.node +0 -0
  31. package/dist/rollup.linux-x64-musl.node +0 -0
  32. package/dist/rollup.openbsd-x64.node +0 -0
  33. package/dist/rollup.openharmony-arm64.node +0 -0
  34. package/dist/rollup.win32-arm64-msvc.node +0 -0
  35. package/dist/rollup.win32-ia32-msvc.node +0 -0
  36. package/dist/rollup.win32-x64-gnu.node +0 -0
  37. package/dist/rollup.win32-x64-msvc.node +0 -0
  38. package/dist/shared/index.js +2 -2
  39. package/dist/shared/loadConfigFile.js +2 -2
  40. package/dist/shared/node-entry.js +2 -2
  41. package/dist/shared/parseAst.js +119 -35
  42. package/dist/shared/rollup.js +892 -688
  43. package/dist/shared/watch-cli.js +2 -2
  44. package/dist/shared/watch.js +2 -2
  45. package/dist/wasm-node/bindings_wasm.js +2 -18
  46. package/dist/wasm-node/bindings_wasm_bg.wasm +0 -0
  47. package/package.json +16 -16
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v5.0.0-0
4
- Tue, 06 Oct 2026 08:24:44 GMT - commit d78bf6bee48e411672e05d8977473f76e6758c35
3
+ Rollup.js v5.0.0-1
4
+ Sun, 18 Oct 2026 06:06:25 GMT - commit ed75a6895d5bc62fdbff91b9d48e22e6e281e3bc
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -153,10 +153,10 @@ function getCodeFrame(source, line, column) {
153
153
  .join('\n');
154
154
  }
155
155
 
156
- const ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Za-z]:)?[/\\|])/;
156
+ const ABSOLUTE_PATH_REGEX$1 = /^(?:\/|(?:[A-Za-z]:)?[/\\|])/;
157
157
  const RELATIVE_PATH_REGEX = /^\.?\.(\/|$)/;
158
- function isAbsolute(path) {
159
- return ABSOLUTE_PATH_REGEX.test(path);
158
+ function isAbsolute$1(path) {
159
+ return ABSOLUTE_PATH_REGEX$1.test(path);
160
160
  }
161
161
  function isRelative(path) {
162
162
  return RELATIVE_PATH_REGEX.test(path);
@@ -180,22 +180,40 @@ function printQuotedStringList(list, verbs) {
180
180
 
181
181
  // Replaces node:path in the browser build. Keep the behavior consistent with
182
182
  // the Node build so that both builds handle paths the same way.
183
+ const ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Za-z]:)?[/\\|])/;
183
184
  const ANY_SLASH_REGEX = /[/\\]/;
185
+ const DRIVE_REGEX = /^[A-Za-z]:$/;
186
+ function isAbsolute(path) {
187
+ return ABSOLUTE_PATH_REGEX.test(path);
188
+ }
189
+ function normalizePathSegments(parts, absolute) {
190
+ const normalized = [];
191
+ // A drive like "C:" is the root of the path, so ".." cannot climb above it
192
+ const root = DRIVE_REGEX.test(parts[0]) ? 1 : 0;
193
+ for (const part of parts) {
194
+ if (part === '..') {
195
+ if (normalized.length > root && normalized[normalized.length - 1] !== '..') {
196
+ normalized.pop();
197
+ }
198
+ else if (!absolute && root === 0) {
199
+ normalized.push('..');
200
+ }
201
+ }
202
+ else if (part !== '.' && part !== '') {
203
+ normalized.push(part);
204
+ }
205
+ }
206
+ return normalized;
207
+ }
184
208
  function relative(from, to) {
185
- const fromParts = from.split(ANY_SLASH_REGEX).filter(Boolean);
186
- const toParts = to.split(ANY_SLASH_REGEX).filter(Boolean);
187
- if (fromParts[0] === '.')
188
- fromParts.shift();
189
- if (toParts[0] === '.')
190
- toParts.shift();
209
+ // "." and ".." segments are collapsed on both sides first, as node:path
210
+ // does, so that "/a/./b" and "/a/b" describe the same location.
211
+ const fromParts = normalizePathSegments(from.split(ANY_SLASH_REGEX), isAbsolute(from));
212
+ const toParts = normalizePathSegments(to.split(ANY_SLASH_REGEX), isAbsolute(to));
191
213
  while (fromParts[0] && toParts[0] && fromParts[0] === toParts[0]) {
192
214
  fromParts.shift();
193
215
  toParts.shift();
194
216
  }
195
- while (toParts[0] === '..' && fromParts.length > 0) {
196
- toParts.shift();
197
- fromParts.pop();
198
- }
199
217
  while (fromParts.pop()) {
200
218
  toParts.unshift('..');
201
219
  }
@@ -207,13 +225,13 @@ function getAliasName(id) {
207
225
  return base.slice(0, Math.max(0, base.length - sp.extname(id).length));
208
226
  }
209
227
  function relativeId(id) {
210
- if (!isAbsolute(id))
228
+ if (!isAbsolute$1(id))
211
229
  return id;
212
230
  return relative(sp.resolve(), id);
213
231
  }
214
232
  function isPathFragment(name) {
215
233
  // starting with "/", "./", "../", "C:/"
216
- return (name[0] === '/' || (name[0] === '.' && (name[1] === '/' || name[1] === '.')) || isAbsolute(name));
234
+ return (name[0] === '/' || (name[0] === '.' && (name[1] === '/' || name[1] === '.')) || isAbsolute$1(name));
217
235
  }
218
236
  const UPPER_DIR_REGEX = /^(\.\.\/)*\.\.$/;
219
237
  function getImportPath(importerId, targetPath, stripJsExtension, ensureFileName) {
@@ -2517,7 +2535,7 @@ const nodeConverters$1 = [
2517
2535
  return result;
2518
2536
  },
2519
2537
  get value() {
2520
- const result = new DataView(buffer.buffer).getFloat64((position + 3) << 2, true);
2538
+ const result = buffer.convertFloat64(position + 3);
2521
2539
  Object.defineProperty(node, 'value', { value: result });
2522
2540
  return result;
2523
2541
  }
@@ -3116,13 +3134,61 @@ function convertNodeList$1(position, buffer) {
3116
3134
  return list;
3117
3135
  }
3118
3136
 
3137
+ // Buffers hold 32-bit words in host byte order. For words that represent
3138
+ // strings, the four string bytes are packed LSB-first into the word, which on
3139
+ // little-endian hosts leaves the raw encoded string bytes in memory while
3140
+ // big-endian hosts need the byte order of each word reversed.
3141
+ const isBigEndianHost = new Uint8Array(new Uint32Array([1]).buffer)[0] === 0;
3142
+ const scratchFloat64 = new DataView(new ArrayBuffer(8));
3143
+ let scratchStringBytes = new Uint8Array(0);
3144
+ const writeFloat64 = function (value, wordPosition) {
3145
+ scratchFloat64.setFloat64(0, value, true);
3146
+ this[wordPosition] = scratchFloat64.getUint32(0, true);
3147
+ this[wordPosition + 1] = scratchFloat64.getUint32(4, true);
3148
+ };
3149
+ function writeStringWordsBigEndian(buffer, byteBuffer, bytePosition, byteLength) {
3150
+ const firstWordPosition = bytePosition >> 2;
3151
+ const wordCount = (byteLength + 3) >> 2;
3152
+ for (let index = 0; index < wordCount; index++) {
3153
+ const offset = bytePosition + (index << 2);
3154
+ buffer[firstWordPosition + index] =
3155
+ byteBuffer[offset] |
3156
+ (byteBuffer[offset + 1] << 8) |
3157
+ (byteBuffer[offset + 2] << 16) |
3158
+ (byteBuffer[offset + 3] << 24);
3159
+ }
3160
+ }
3161
+ const expandPackedString = (array, position, length) => {
3162
+ const paddedByteLength = ((length + 3) >> 2) << 2;
3163
+ if (scratchStringBytes.length < paddedByteLength) {
3164
+ scratchStringBytes = new Uint8Array(paddedByteLength);
3165
+ }
3166
+ const firstStringWord = position + 1;
3167
+ for (let index = 0; index < paddedByteLength >> 2; index++) {
3168
+ const word = array[firstStringWord + index];
3169
+ scratchStringBytes[index << 2] = word & 0xff;
3170
+ scratchStringBytes[(index << 2) + 1] = (word >>> 8) & 0xff;
3171
+ scratchStringBytes[(index << 2) + 2] = (word >>> 16) & 0xff;
3172
+ scratchStringBytes[(index << 2) + 3] = (word >>> 24) & 0xff;
3173
+ }
3174
+ return scratchStringBytes.subarray(0, length);
3175
+ };
3176
+ const decodePackedString = (array, position, length) => {
3177
+ const bytes = expandPackedString(array, position, length);
3178
+ return typeof Buffer !== 'undefined'
3179
+ ? Buffer.from(bytes.buffer, bytes.byteOffset, bytes.length).toString('utf8')
3180
+ : new TextDecoder().decode(bytes);
3181
+ };
3119
3182
  function getAstBuffer(byteBuffer) {
3120
3183
  // Create an aligned copy for misaligned views, e.g. buffers restored by
3121
3184
  // v8.deserialize, as the Uint32Array below requires a 4-byte aligned offset
3122
3185
  const alignedByteBuffer = byteBuffer.byteOffset & 3 ? new Uint8Array(byteBuffer) : byteBuffer;
3123
3186
  const array = new Uint32Array(alignedByteBuffer.buffer, alignedByteBuffer.byteOffset, alignedByteBuffer.byteLength >> 2);
3124
3187
  let convertString;
3125
- if (typeof Buffer !== 'undefined' && byteBuffer instanceof Buffer) {
3188
+ if (isBigEndianHost) {
3189
+ convertString = position => decodePackedString(array, position, array[position]);
3190
+ }
3191
+ else if (typeof Buffer !== 'undefined' && byteBuffer instanceof Buffer) {
3126
3192
  convertString = position => {
3127
3193
  const length = array[position];
3128
3194
  const bytePosition = (position + 1) << 2;
@@ -3137,11 +3203,19 @@ function getAstBuffer(byteBuffer) {
3137
3203
  return textDecoder.decode(byteBuffer.subarray(bytePosition, bytePosition + length));
3138
3204
  };
3139
3205
  }
3140
- return Object.assign(array, { convertString });
3206
+ return Object.assign(array, {
3207
+ convertFloat64(position) {
3208
+ scratchFloat64.setUint32(0, this[position], true);
3209
+ scratchFloat64.setUint32(4, this[position + 1], true);
3210
+ return scratchFloat64.getFloat64(0, true);
3211
+ },
3212
+ convertString
3213
+ });
3141
3214
  }
3142
3215
  function createAstBufferUint8(uInt32Size) {
3143
3216
  const buffer = new Uint32Array(uInt32Size);
3144
3217
  const encoder = new TextEncoder();
3218
+ const byteBuffer = new Uint8Array(buffer.buffer);
3145
3219
  return Object.assign(buffer, {
3146
3220
  addStringToBuffer(text, referencePosition) {
3147
3221
  const insertPosition = buffer.position;
@@ -3152,10 +3226,14 @@ function createAstBufferUint8(uInt32Size) {
3152
3226
  const reservedSize = 1 + ((encodedByteLength + 3) >> 2);
3153
3227
  const extendedBuffer = buffer.reserve(reservedSize);
3154
3228
  extendedBuffer[insertPosition] = encodedByteLength;
3155
- extendedBuffer.byteBuffer.set(encoded, (insertPosition + 1) << 2);
3229
+ const stringBytePosition = (insertPosition + 1) << 2;
3230
+ extendedBuffer.byteBuffer.set(encoded, stringBytePosition);
3231
+ if (isBigEndianHost) {
3232
+ writeStringWordsBigEndian(extendedBuffer, extendedBuffer.byteBuffer, stringBytePosition, encodedByteLength);
3233
+ }
3156
3234
  return extendedBuffer;
3157
3235
  },
3158
- byteBuffer: new Uint8Array(buffer.buffer),
3236
+ byteBuffer,
3159
3237
  position: 0,
3160
3238
  reserve(size) {
3161
3239
  const newPosition = buffer.position + size;
@@ -3170,12 +3248,14 @@ function createAstBufferUint8(uInt32Size) {
3170
3248
  },
3171
3249
  toOutput() {
3172
3250
  const byteSize = buffer.position << 2;
3173
- return buffer.byteBuffer.slice(0, byteSize);
3174
- }
3251
+ return byteBuffer.slice(0, byteSize);
3252
+ },
3253
+ writeFloat64
3175
3254
  });
3176
3255
  }
3177
3256
  function createAstBufferNode(uInt32Size) {
3178
3257
  const buffer = new Uint32Array(uInt32Size);
3258
+ const byteBuffer = Buffer.from(buffer.buffer);
3179
3259
  return Object.assign(buffer, {
3180
3260
  addStringToBuffer(text, referencePosition) {
3181
3261
  let extendedBuffer = buffer;
@@ -3183,19 +3263,22 @@ function createAstBufferNode(uInt32Size) {
3183
3263
  if (requiredSize > buffer.length) {
3184
3264
  // Reserve more space if needed
3185
3265
  extendedBuffer = createAstBufferNode(requiredSize * 2);
3186
- buffer.byteBuffer.copy(extendedBuffer.byteBuffer, 0, 0, buffer.position << 2);
3266
+ byteBuffer.copy(extendedBuffer.byteBuffer, 0, 0, buffer.position << 2);
3187
3267
  extendedBuffer.position = buffer.position;
3188
3268
  }
3189
3269
  const insertPosition = extendedBuffer.position;
3190
3270
  extendedBuffer[referencePosition] = insertPosition;
3191
- const textBytePosition = (insertPosition + 1) << 2;
3192
- const encodedLength = extendedBuffer.byteBuffer.write(text, textBytePosition);
3271
+ const stringBytePosition = (insertPosition + 1) << 2;
3272
+ const encodedLength = extendedBuffer.byteBuffer.write(text, stringBytePosition);
3193
3273
  extendedBuffer[insertPosition] = encodedLength;
3274
+ if (isBigEndianHost) {
3275
+ writeStringWordsBigEndian(extendedBuffer, extendedBuffer.byteBuffer, stringBytePosition, encodedLength);
3276
+ }
3194
3277
  // Round up to the next 4-byte boundary
3195
- extendedBuffer.position = (textBytePosition + encodedLength + 3) >> 2;
3278
+ extendedBuffer.position = (stringBytePosition + encodedLength + 3) >> 2;
3196
3279
  return extendedBuffer;
3197
3280
  },
3198
- byteBuffer: Buffer.from(buffer.buffer),
3281
+ byteBuffer,
3199
3282
  position: 0,
3200
3283
  reserve(size) {
3201
3284
  const newPosition = buffer.position + size;
@@ -3204,7 +3287,7 @@ function createAstBufferNode(uInt32Size) {
3204
3287
  return buffer;
3205
3288
  }
3206
3289
  const newBuffer = createAstBufferNode(newPosition * 2);
3207
- buffer.byteBuffer.copy(newBuffer.byteBuffer, 0, 0, buffer.position << 2);
3290
+ byteBuffer.copy(newBuffer.byteBuffer, 0, 0, buffer.position << 2);
3208
3291
  newBuffer.position = newPosition;
3209
3292
  return newBuffer;
3210
3293
  },
@@ -3213,9 +3296,10 @@ function createAstBufferNode(uInt32Size) {
3213
3296
  // The "slow" version will allocate exactly the needed size and is preferable
3214
3297
  // for long-term memory usage.
3215
3298
  const truncatedBuffer = Buffer.allocUnsafeSlow(byteSize);
3216
- buffer.byteBuffer.copy(truncatedBuffer, 0, 0, byteSize);
3299
+ byteBuffer.copy(truncatedBuffer, 0, 0, byteSize);
3217
3300
  return truncatedBuffer;
3218
- }
3301
+ },
3302
+ writeFloat64
3219
3303
  });
3220
3304
  }
3221
3305
 
@@ -3943,7 +4027,7 @@ const nodeConverters = [
3943
4027
  start: buffer[position],
3944
4028
  end: buffer[position + 1],
3945
4029
  raw: rawPosition === 0 ? undefined : buffer.convertString(rawPosition),
3946
- value: new DataView(buffer.buffer).getFloat64((position + 3) << 2, true)
4030
+ value: buffer.convertFloat64(position + 3)
3947
4031
  };
3948
4032
  },
3949
4033
  function literalRegExp(position, buffer) {
@@ -5367,7 +5451,7 @@ const serializeLiteralNumber = (node, buffer) => {
5367
5451
  if (node.raw != null) {
5368
5452
  buffer = buffer.addStringToBuffer(node.raw, nodePosition + 3);
5369
5453
  }
5370
- new DataView(buffer.buffer).setFloat64((nodePosition + 4) << 2, node.value, true);
5454
+ buffer.writeFloat64(node.value, nodePosition + 4);
5371
5455
  return buffer;
5372
5456
  };
5373
5457
  const serializeLiteralRegExp = (node, buffer) => {
@@ -5523,7 +5607,7 @@ exports.getAstBuffer = getAstBuffer;
5523
5607
  exports.getImportPath = getImportPath;
5524
5608
  exports.getRollupError = getRollupError;
5525
5609
  exports.getRollupUrl = getRollupUrl;
5526
- exports.isAbsolute = isAbsolute;
5610
+ exports.isAbsolute = isAbsolute$1;
5527
5611
  exports.isPathFragment = isPathFragment;
5528
5612
  exports.isRelative = isRelative;
5529
5613
  exports.isValidUrl = isValidUrl;