@bobfrankston/rmfmail 1.0.707 → 1.0.708

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/rmfmail",
3
- "version": "1.0.707",
3
+ "version": "1.0.708",
4
4
  "description": "Local-first email client with IMAP sync and standalone native app",
5
5
  "type": "module",
6
6
  "main": "bin/mailx.js",
@@ -36,7 +36,7 @@
36
36
  "@bobfrankston/iflow-direct": "^0.1.44",
37
37
  "@bobfrankston/mailx-host": "^0.1.12",
38
38
  "@bobfrankston/mailx-imap": "^0.1.44",
39
- "@bobfrankston/mailx-store-web": "^0.1.6",
39
+ "@bobfrankston/mailx-store-web": "^0.1.7",
40
40
  "@bobfrankston/mailx-sync": "^0.1.16",
41
41
  "@bobfrankston/miscinfo": "^1.0.10",
42
42
  "@bobfrankston/msger": "^0.1.378",
@@ -116,7 +116,7 @@
116
116
  "@bobfrankston/iflow-direct": "^0.1.44",
117
117
  "@bobfrankston/mailx-host": "^0.1.12",
118
118
  "@bobfrankston/mailx-imap": "^0.1.44",
119
- "@bobfrankston/mailx-store-web": "^0.1.6",
119
+ "@bobfrankston/mailx-store-web": "^0.1.7",
120
120
  "@bobfrankston/mailx-sync": "^0.1.16",
121
121
  "@bobfrankston/miscinfo": "^1.0.10",
122
122
  "@bobfrankston/msger": "^0.1.378",
@@ -42,7 +42,23 @@ parentPort.on("message", async (msg) => {
42
42
  // worker since _warmupPromise is already resolved.
43
43
  await _warmupPromise;
44
44
  try {
45
- const result = await simpleParser(source);
45
+ // CRITICAL: `Buffer` sent across `worker_threads.postMessage` arrives
46
+ // as plain `Uint8Array` (Node docs: "Buffer instances passed to
47
+ // Worker.postMessage() are passed as Uint8Array instances when
48
+ // received"). mailparser's `simpleParser` uses `Buffer.isBuffer(input)`
49
+ // to discriminate Buffer / string / Stream. A Uint8Array fails that
50
+ // check and gets routed to the Stream branch, which calls
51
+ // `input.once("end", …)` and immediately throws
52
+ // `input.once is not a function`
53
+ // Re-wrap with `Buffer.from(src.buffer, src.byteOffset, src.byteLength)`
54
+ // — zero-copy view over the same memory, but with the Buffer prototype
55
+ // so `Buffer.isBuffer` is true.
56
+ let normalized = source;
57
+ if (source instanceof Uint8Array && !Buffer.isBuffer(source)) {
58
+ const u = source;
59
+ normalized = Buffer.from(u.buffer, u.byteOffset, u.byteLength);
60
+ }
61
+ const result = await simpleParser(normalized);
46
62
  parentPort.postMessage({ id, ok: true, result });
47
63
  }
48
64
  catch (e) {
@@ -1 +1 @@
1
- {"version":3,"file":"parse-worker.js","sourceRoot":"","sources":["parse-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAe,MAAM,YAAY,CAAC;AAEvD,IAAI,CAAC,UAAU,EAAE,CAAC;IACd,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;AACrF,CAAC;AAOD,0EAA0E;AAC1E,kEAAkE;AAClE,yEAAyE;AACzE,0EAA0E;AAC1E,qEAAqE;AACrE,uEAAuE;AACvE,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;AAC7B,MAAM,cAAc,GAAG,YAAY,CAAC,MAAM,CAAC,IAAI,CAC3C,wDAAwD;MACtD,0CAA0C;MAC1C,iDAAiD;MACjD,gDAAgD,EAClD,MAAM,CACT,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;IACT,kEAAkE;IAClE,UAAW,CAAC,WAAW,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC;AAClE,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAA8D,CAAC,CAAC,CAAC;AAE/E,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,EAAE,GAAi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,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACtD,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -53,7 +53,23 @@ parentPort.on("message", async (msg: ParseRequest) => {
53
53
  // worker since _warmupPromise is already resolved.
54
54
  await _warmupPromise;
55
55
  try {
56
- const result = await simpleParser(source);
56
+ // CRITICAL: `Buffer` sent across `worker_threads.postMessage` arrives
57
+ // as plain `Uint8Array` (Node docs: "Buffer instances passed to
58
+ // Worker.postMessage() are passed as Uint8Array instances when
59
+ // received"). mailparser's `simpleParser` uses `Buffer.isBuffer(input)`
60
+ // to discriminate Buffer / string / Stream. A Uint8Array fails that
61
+ // check and gets routed to the Stream branch, which calls
62
+ // `input.once("end", …)` and immediately throws
63
+ // `input.once is not a function`
64
+ // Re-wrap with `Buffer.from(src.buffer, src.byteOffset, src.byteLength)`
65
+ // — zero-copy view over the same memory, but with the Buffer prototype
66
+ // so `Buffer.isBuffer` is true.
67
+ let normalized: Source = source;
68
+ if (source instanceof Uint8Array && !Buffer.isBuffer(source)) {
69
+ const u = source as Uint8Array;
70
+ normalized = Buffer.from(u.buffer, u.byteOffset, u.byteLength);
71
+ }
72
+ const result = await simpleParser(normalized);
57
73
  parentPort!.postMessage({ id, ok: true, result });
58
74
  } catch (e: unknown) {
59
75
  const error = e instanceof Error ? e.message : String(e);