@embedpdf/pdfium 2.0.0 → 2.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.
package/dist/index.cjs CHANGED
@@ -15,7 +15,7 @@ var hasRequiredPdfium;
15
15
  function requirePdfium () {
16
16
  if (hasRequiredPdfium) return pdfium.exports;
17
17
  hasRequiredPdfium = 1;
18
- (function (module, exports) {
18
+ (function (module, exports$1) {
19
19
  var createPdfium = (() => {
20
20
  var _scriptName = typeof document != 'undefined' ? document.currentScript?.src : undefined;
21
21
  if (typeof __filename != 'undefined') _scriptName = _scriptName || __filename;
@@ -1212,10 +1212,10 @@ function requirePdfium () {
1212
1212
  };
1213
1213
  /** @type {function(string, boolean=, number=)} */
1214
1214
  function intArrayFromString(stringy, dontAddNull, length) {
1215
- var len = length > 0 ? length : lengthBytesUTF8(stringy)+1;
1215
+ var len = lengthBytesUTF8(stringy)+1;
1216
1216
  var u8array = new Array(len);
1217
1217
  var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length);
1218
- if (dontAddNull) u8array.length = numBytesWritten;
1218
+ u8array.length = numBytesWritten;
1219
1219
  return u8array;
1220
1220
  }
1221
1221
  var FS_stdin_getChar = () => {
@@ -1269,7 +1269,7 @@ function requirePdfium () {
1269
1269
  if (!result) {
1270
1270
  return null;
1271
1271
  }
1272
- FS_stdin_getChar_buffer = intArrayFromString(result, true);
1272
+ FS_stdin_getChar_buffer = intArrayFromString(result);
1273
1273
  }
1274
1274
  return FS_stdin_getChar_buffer.shift();
1275
1275
  };
@@ -1763,7 +1763,7 @@ function requirePdfium () {
1763
1763
 
1764
1764
  /** @param {boolean=} noRunDep */
1765
1765
  var asyncLoad = (url, onload, onerror, noRunDep) => {
1766
- var dep = !noRunDep ? getUniqueRunDependency(`al ${url}`) : '';
1766
+ var dep = getUniqueRunDependency(`al ${url}`) ;
1767
1767
  readAsync(url).then(
1768
1768
  (arrayBuffer) => {
1769
1769
  assert(arrayBuffer, `Loading data file "${url}" failed (no arrayBuffer).`);
@@ -2762,7 +2762,7 @@ function requirePdfium () {
2762
2762
  throw new FS.ErrnoError(63);
2763
2763
  }
2764
2764
  node.node_ops.setattr(node, {
2765
- mode: (mode & 4095) | (node.mode & ~4095),
2765
+ mode: (mode & 4095) | (node.mode & -4096),
2766
2766
  timestamp: Date.now()
2767
2767
  });
2768
2768
  },
@@ -2883,7 +2883,7 @@ function requirePdfium () {
2883
2883
  }
2884
2884
  // can't truncate a device
2885
2885
  if (FS.isChrdev(node.mode)) {
2886
- flags &= ~512;
2886
+ flags &= -513;
2887
2887
  }
2888
2888
  // if asked only for a directory, then this must be one
2889
2889
  if ((flags & 65536) && !FS.isDir(node.mode)) {
@@ -2903,7 +2903,7 @@ function requirePdfium () {
2903
2903
  FS.truncate(node, 0);
2904
2904
  }
2905
2905
  // we've already handled these, don't pass down to the underlying vfs
2906
- flags &= ~(128 | 512 | 131072);
2906
+ flags &= -131713;
2907
2907
 
2908
2908
  // register the stream with the filesystem
2909
2909
  var stream = FS.createStream({
@@ -3460,7 +3460,7 @@ function requirePdfium () {
3460
3460
  if (xhr.response !== undefined) {
3461
3461
  return new Uint8Array(/** @type{Array<number>} */(xhr.response || []));
3462
3462
  }
3463
- return intArrayFromString(xhr.responseText || '', true);
3463
+ return intArrayFromString(xhr.responseText || '');
3464
3464
  };
3465
3465
  var lazyArray = this;
3466
3466
  lazyArray.setDataGetter((chunkNum) => {
@@ -4250,9 +4250,6 @@ function requirePdfium () {
4250
4250
  if (curr < 0) return -1;
4251
4251
  ret += curr;
4252
4252
  if (curr < len) break; // nothing more to read
4253
- if (typeof offset != 'undefined') {
4254
- offset += curr;
4255
- }
4256
4253
  }
4257
4254
  return ret;
4258
4255
  };
@@ -4317,9 +4314,6 @@ function requirePdfium () {
4317
4314
  // No more space to write.
4318
4315
  break;
4319
4316
  }
4320
- if (typeof offset != 'undefined') {
4321
- offset += curr;
4322
- }
4323
4317
  }
4324
4318
  return ret;
4325
4319
  };
@@ -6702,7 +6696,7 @@ const functions = {
6702
6696
  PDFiumExt_SaveAsCopy: [['number', 'number'], 'number'],
6703
6697
  };
6704
6698
 
6705
- const DEFAULT_PDFIUM_WASM_URL = 'https://cdn.jsdelivr.net/npm/@embedpdf/pdfium@2.0.0/dist/pdfium.wasm';
6699
+ const DEFAULT_PDFIUM_WASM_URL = 'https://cdn.jsdelivr.net/npm/@embedpdf/pdfium@2.0.1/dist/pdfium.wasm';
6706
6700
  async function createWrappedModule(pdfium) {
6707
6701
  const module = {
6708
6702
  pdfium,