@salesforce/core-bundle 7.3.0 → 7.3.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.
package/lib/pino-file.js CHANGED
@@ -1893,7 +1893,7 @@ var require_package = __commonJS({
1893
1893
  "node_modules/thread-stream/package.json"(exports2, module2) {
1894
1894
  module2.exports = {
1895
1895
  name: "thread-stream",
1896
- version: "2.3.0",
1896
+ version: "2.7.0",
1897
1897
  description: "A streaming way to send data to a Node.js Worker Thread",
1898
1898
  main: "index.js",
1899
1899
  types: "index.d.ts",
@@ -1901,28 +1901,34 @@ var require_package = __commonJS({
1901
1901
  "real-require": "^0.2.0"
1902
1902
  },
1903
1903
  devDependencies: {
1904
- "@types/node": "^18.0.0",
1904
+ "@types/node": "^20.1.0",
1905
1905
  "@types/tap": "^15.0.0",
1906
+ "@yao-pkg/pkg": "^5.11.5",
1906
1907
  desm: "^1.3.0",
1907
1908
  fastbench: "^1.0.1",
1908
- husky: "^8.0.1",
1909
+ husky: "^9.0.6",
1910
+ "pino-elasticsearch": "^8.0.0",
1909
1911
  "sonic-boom": "^3.0.0",
1910
1912
  standard: "^17.0.0",
1911
1913
  tap: "^16.2.0",
1912
1914
  "ts-node": "^10.8.0",
1913
- typescript: "^4.7.2",
1915
+ typescript: "^5.3.2",
1914
1916
  "why-is-node-running": "^2.2.2"
1915
1917
  },
1916
1918
  scripts: {
1917
- test: "standard && npm run transpile && tap test/*.test.*js && tap --ts test/*.test.*ts",
1919
+ test: 'standard && npm run transpile && tap "test/**/*.test.*js" && tap --ts test/*.test.*ts',
1918
1920
  "test:ci": "standard && npm run transpile && npm run test:ci:js && npm run test:ci:ts",
1919
- "test:ci:js": 'tap --no-check-coverage --coverage-report=lcovonly "test/**/*.test.*js"',
1921
+ "test:ci:js": 'tap --no-check-coverage --timeout=120 --coverage-report=lcovonly "test/**/*.test.*js"',
1920
1922
  "test:ci:ts": 'tap --ts --no-check-coverage --coverage-report=lcovonly "test/**/*.test.*ts"',
1921
1923
  "test:yarn": 'npm run transpile && tap "test/**/*.test.js" --no-check-coverage',
1922
1924
  transpile: "sh ./test/ts/transpile.sh",
1923
1925
  prepare: "husky install"
1924
1926
  },
1925
- standard: { ignore: ["test/ts/**/*"] },
1927
+ standard: {
1928
+ ignore: [
1929
+ "test/ts/**/*"
1930
+ ]
1931
+ },
1926
1932
  repository: {
1927
1933
  type: "git",
1928
1934
  url: "git+https://github.com/mcollina/thread-stream.git"
@@ -2042,13 +2048,14 @@ var require_thread_stream = __commonJS({
2042
2048
  return this._value;
2043
2049
  }
2044
2050
  };
2045
- var FinalizationRegistry2 = global.FinalizationRegistry || class FakeFinalizationRegistry {
2051
+ var FakeFinalizationRegistry = class {
2046
2052
  register() {
2047
2053
  }
2048
2054
  unregister() {
2049
2055
  }
2050
2056
  };
2051
- var WeakRef2 = global.WeakRef || FakeWeakRef;
2057
+ var FinalizationRegistry2 = process.env.NODE_V8_COVERAGE ? FakeFinalizationRegistry : global.FinalizationRegistry || FakeFinalizationRegistry;
2058
+ var WeakRef2 = process.env.NODE_V8_COVERAGE ? FakeWeakRef : global.WeakRef || FakeWeakRef;
2052
2059
  var registry = new FinalizationRegistry2((worker) => {
2053
2060
  if (worker.exited) {
2054
2061
  return;
@@ -2159,6 +2166,9 @@ var require_thread_stream = __commonJS({
2159
2166
  stream.emit(msg.name, msg.args);
2160
2167
  }
2161
2168
  break;
2169
+ case "WARNING":
2170
+ process.emitWarning(msg.err);
2171
+ break;
2162
2172
  default:
2163
2173
  destroy(stream, new Error("this should not happen: " + msg.code));
2164
2174
  }
@@ -2196,6 +2206,9 @@ var require_thread_stream = __commonJS({
2196
2206
  this[kImpl].closed = false;
2197
2207
  this[kImpl].buf = "";
2198
2208
  this.worker = createWorker(this, opts);
2209
+ this.on("message", (message, transferList) => {
2210
+ this.worker.postMessage(message, transferList);
2211
+ });
2199
2212
  }
2200
2213
  write(data) {
2201
2214
  if (this[kImpl].destroyed) {
@@ -2519,6 +2532,7 @@ var require_transport = __commonJS({
2519
2532
  if (dedupe) {
2520
2533
  options.dedupe = dedupe;
2521
2534
  }
2535
+ options.pinoWillSendConfig = true;
2522
2536
  return buildStream(fixTarget(target), options, worker);
2523
2537
  function fixTarget(origin) {
2524
2538
  origin = bundlerOverrides[origin] || origin;
@@ -3093,7 +3107,7 @@ var require_levels = __commonJS({
3093
3107
  var require_meta = __commonJS({
3094
3108
  "node_modules/pino/lib/meta.js"(exports2, module2) {
3095
3109
  "use strict";
3096
- module2.exports = { version: "8.19.0" };
3110
+ module2.exports = { version: "8.21.0" };
3097
3111
  }
3098
3112
  });
3099
3113
 
@@ -3911,6 +3925,7 @@ var require_multistream = __commonJS({
3911
3925
  const res = {
3912
3926
  write,
3913
3927
  add,
3928
+ emit,
3914
3929
  flushSync,
3915
3930
  end,
3916
3931
  minLevel: 0,
@@ -3956,6 +3971,13 @@ var require_multistream = __commonJS({
3956
3971
  }
3957
3972
  }
3958
3973
  }
3974
+ function emit(...args) {
3975
+ for (const { stream } of this.streams) {
3976
+ if (typeof stream.emit === "function") {
3977
+ stream.emit(...args);
3978
+ }
3979
+ }
3980
+ }
3959
3981
  function flushSync() {
3960
3982
  for (const { stream } of this.streams) {
3961
3983
  if (typeof stream.flushSync === "function") {
@@ -4016,6 +4038,7 @@ var require_multistream = __commonJS({
4016
4038
  minLevel: level,
4017
4039
  streams,
4018
4040
  clone,
4041
+ emit,
4019
4042
  flushSync,
4020
4043
  [metadata]: true
4021
4044
  };
@@ -4198,6 +4221,9 @@ var require_pino = __commonJS({
4198
4221
  throw Error(`Unknown msgPrefix type "${typeof msgPrefix}" - expected "string"`);
4199
4222
  assertDefaultLevelFound(level, customLevels, useOnlyCustomLevels);
4200
4223
  const levels = mappings(customLevels, useOnlyCustomLevels);
4224
+ if (typeof stream.emit === "function") {
4225
+ stream.emit("message", { code: "PINO_CONFIG", config: { levels, messageKey, errorKey } });
4226
+ }
4201
4227
  assertLevelComparison(levelComparison);
4202
4228
  const levelCompFunc = genLevelComparison(levelComparison);
4203
4229
  Object.assign(instance, {
@@ -11982,7 +11982,20 @@ var require_pino_abstract_transport = __commonJS({
11982
11982
  var metadata = Symbol.for("pino.metadata");
11983
11983
  var split = require_split2();
11984
11984
  var { Duplex } = require_ours2();
11985
+ var { parentPort, workerData } = require("worker_threads");
11986
+ function createDeferred() {
11987
+ let resolve;
11988
+ let reject;
11989
+ const promise = new Promise((_resolve, _reject) => {
11990
+ resolve = _resolve;
11991
+ reject = _reject;
11992
+ });
11993
+ promise.resolve = resolve;
11994
+ promise.reject = reject;
11995
+ return promise;
11996
+ }
11985
11997
  module2.exports = function build2(fn, opts = {}) {
11998
+ const waitForConfig = opts.expectPinoConfig === true && workerData?.workerData?.pinoWillSendConfig === true;
11986
11999
  const parseLines = opts.parse === "lines";
11987
12000
  const parseLine = typeof opts.parseLine === "function" ? opts.parseLine : JSON.parse;
11988
12001
  const close = opts.close || defaultClose;
@@ -12020,22 +12033,59 @@ var require_pino_abstract_transport = __commonJS({
12020
12033
  promise.then(cb, cb);
12021
12034
  }
12022
12035
  };
12036
+ if (opts.expectPinoConfig === true && workerData?.workerData?.pinoWillSendConfig !== true) {
12037
+ setImmediate(() => {
12038
+ stream.emit("error", new Error("This transport is not compatible with the current version of pino. Please upgrade pino to the latest version."));
12039
+ });
12040
+ }
12023
12041
  if (opts.metadata !== false) {
12024
12042
  stream[metadata] = true;
12025
12043
  stream.lastTime = 0;
12026
12044
  stream.lastLevel = 0;
12027
12045
  stream.lastObj = null;
12028
12046
  }
12029
- let res = fn(stream);
12030
- if (res && typeof res.catch === "function") {
12031
- res.catch((err) => {
12032
- stream.destroy(err);
12047
+ if (waitForConfig) {
12048
+ let pinoConfig = {};
12049
+ const configReceived = createDeferred();
12050
+ parentPort.on("message", function handleMessage(message) {
12051
+ if (message.code === "PINO_CONFIG") {
12052
+ pinoConfig = message.config;
12053
+ configReceived.resolve();
12054
+ parentPort.off("message", handleMessage);
12055
+ }
12056
+ });
12057
+ Object.defineProperties(stream, {
12058
+ levels: {
12059
+ get() {
12060
+ return pinoConfig.levels;
12061
+ }
12062
+ },
12063
+ messageKey: {
12064
+ get() {
12065
+ return pinoConfig.messageKey;
12066
+ }
12067
+ },
12068
+ errorKey: {
12069
+ get() {
12070
+ return pinoConfig.errorKey;
12071
+ }
12072
+ }
12033
12073
  });
12034
- res = null;
12035
- } else if (opts.enablePipelining && res) {
12036
- return Duplex.from({ writable: stream, readable: res, objectMode: true });
12074
+ return configReceived.then(finish);
12075
+ }
12076
+ return finish();
12077
+ function finish() {
12078
+ let res = fn(stream);
12079
+ if (res && typeof res.catch === "function") {
12080
+ res.catch((err) => {
12081
+ stream.destroy(err);
12082
+ });
12083
+ res = null;
12084
+ } else if (opts.enablePipelining && res) {
12085
+ return Duplex.from({ writable: stream, readable: res });
12086
+ }
12087
+ return stream;
12037
12088
  }
12038
- return stream;
12039
12089
  };
12040
12090
  function defaultClose(err, cb) {
12041
12091
  process.nextTick(cb, err);
@@ -1893,7 +1893,7 @@ var require_package = __commonJS({
1893
1893
  "node_modules/thread-stream/package.json"(exports2, module2) {
1894
1894
  module2.exports = {
1895
1895
  name: "thread-stream",
1896
- version: "2.3.0",
1896
+ version: "2.7.0",
1897
1897
  description: "A streaming way to send data to a Node.js Worker Thread",
1898
1898
  main: "index.js",
1899
1899
  types: "index.d.ts",
@@ -1901,28 +1901,34 @@ var require_package = __commonJS({
1901
1901
  "real-require": "^0.2.0"
1902
1902
  },
1903
1903
  devDependencies: {
1904
- "@types/node": "^18.0.0",
1904
+ "@types/node": "^20.1.0",
1905
1905
  "@types/tap": "^15.0.0",
1906
+ "@yao-pkg/pkg": "^5.11.5",
1906
1907
  desm: "^1.3.0",
1907
1908
  fastbench: "^1.0.1",
1908
- husky: "^8.0.1",
1909
+ husky: "^9.0.6",
1910
+ "pino-elasticsearch": "^8.0.0",
1909
1911
  "sonic-boom": "^3.0.0",
1910
1912
  standard: "^17.0.0",
1911
1913
  tap: "^16.2.0",
1912
1914
  "ts-node": "^10.8.0",
1913
- typescript: "^4.7.2",
1915
+ typescript: "^5.3.2",
1914
1916
  "why-is-node-running": "^2.2.2"
1915
1917
  },
1916
1918
  scripts: {
1917
- test: "standard && npm run transpile && tap test/*.test.*js && tap --ts test/*.test.*ts",
1919
+ test: 'standard && npm run transpile && tap "test/**/*.test.*js" && tap --ts test/*.test.*ts',
1918
1920
  "test:ci": "standard && npm run transpile && npm run test:ci:js && npm run test:ci:ts",
1919
- "test:ci:js": 'tap --no-check-coverage --coverage-report=lcovonly "test/**/*.test.*js"',
1921
+ "test:ci:js": 'tap --no-check-coverage --timeout=120 --coverage-report=lcovonly "test/**/*.test.*js"',
1920
1922
  "test:ci:ts": 'tap --ts --no-check-coverage --coverage-report=lcovonly "test/**/*.test.*ts"',
1921
1923
  "test:yarn": 'npm run transpile && tap "test/**/*.test.js" --no-check-coverage',
1922
1924
  transpile: "sh ./test/ts/transpile.sh",
1923
1925
  prepare: "husky install"
1924
1926
  },
1925
- standard: { ignore: ["test/ts/**/*"] },
1927
+ standard: {
1928
+ ignore: [
1929
+ "test/ts/**/*"
1930
+ ]
1931
+ },
1926
1932
  repository: {
1927
1933
  type: "git",
1928
1934
  url: "git+https://github.com/mcollina/thread-stream.git"
@@ -2042,13 +2048,14 @@ var require_thread_stream = __commonJS({
2042
2048
  return this._value;
2043
2049
  }
2044
2050
  };
2045
- var FinalizationRegistry2 = global.FinalizationRegistry || class FakeFinalizationRegistry {
2051
+ var FakeFinalizationRegistry = class {
2046
2052
  register() {
2047
2053
  }
2048
2054
  unregister() {
2049
2055
  }
2050
2056
  };
2051
- var WeakRef2 = global.WeakRef || FakeWeakRef;
2057
+ var FinalizationRegistry2 = process.env.NODE_V8_COVERAGE ? FakeFinalizationRegistry : global.FinalizationRegistry || FakeFinalizationRegistry;
2058
+ var WeakRef2 = process.env.NODE_V8_COVERAGE ? FakeWeakRef : global.WeakRef || FakeWeakRef;
2052
2059
  var registry = new FinalizationRegistry2((worker) => {
2053
2060
  if (worker.exited) {
2054
2061
  return;
@@ -2159,6 +2166,9 @@ var require_thread_stream = __commonJS({
2159
2166
  stream.emit(msg.name, msg.args);
2160
2167
  }
2161
2168
  break;
2169
+ case "WARNING":
2170
+ process.emitWarning(msg.err);
2171
+ break;
2162
2172
  default:
2163
2173
  destroy(stream, new Error("this should not happen: " + msg.code));
2164
2174
  }
@@ -2196,6 +2206,9 @@ var require_thread_stream = __commonJS({
2196
2206
  this[kImpl].closed = false;
2197
2207
  this[kImpl].buf = "";
2198
2208
  this.worker = createWorker(this, opts);
2209
+ this.on("message", (message, transferList) => {
2210
+ this.worker.postMessage(message, transferList);
2211
+ });
2199
2212
  }
2200
2213
  write(data) {
2201
2214
  if (this[kImpl].destroyed) {
@@ -2519,6 +2532,7 @@ var require_transport = __commonJS({
2519
2532
  if (dedupe) {
2520
2533
  options.dedupe = dedupe;
2521
2534
  }
2535
+ options.pinoWillSendConfig = true;
2522
2536
  return buildStream(fixTarget(target), options, worker);
2523
2537
  function fixTarget(origin) {
2524
2538
  origin = bundlerOverrides[origin] || origin;
@@ -3093,7 +3107,7 @@ var require_levels = __commonJS({
3093
3107
  var require_meta = __commonJS({
3094
3108
  "node_modules/pino/lib/meta.js"(exports2, module2) {
3095
3109
  "use strict";
3096
- module2.exports = { version: "8.19.0" };
3110
+ module2.exports = { version: "8.21.0" };
3097
3111
  }
3098
3112
  });
3099
3113
 
@@ -3911,6 +3925,7 @@ var require_multistream = __commonJS({
3911
3925
  const res = {
3912
3926
  write,
3913
3927
  add,
3928
+ emit,
3914
3929
  flushSync,
3915
3930
  end,
3916
3931
  minLevel: 0,
@@ -3956,6 +3971,13 @@ var require_multistream = __commonJS({
3956
3971
  }
3957
3972
  }
3958
3973
  }
3974
+ function emit(...args) {
3975
+ for (const { stream } of this.streams) {
3976
+ if (typeof stream.emit === "function") {
3977
+ stream.emit(...args);
3978
+ }
3979
+ }
3980
+ }
3959
3981
  function flushSync() {
3960
3982
  for (const { stream } of this.streams) {
3961
3983
  if (typeof stream.flushSync === "function") {
@@ -4016,6 +4038,7 @@ var require_multistream = __commonJS({
4016
4038
  minLevel: level,
4017
4039
  streams,
4018
4040
  clone,
4041
+ emit,
4019
4042
  flushSync,
4020
4043
  [metadata]: true
4021
4044
  };
@@ -4198,6 +4221,9 @@ var require_pino = __commonJS({
4198
4221
  throw Error(`Unknown msgPrefix type "${typeof msgPrefix}" - expected "string"`);
4199
4222
  assertDefaultLevelFound(level, customLevels, useOnlyCustomLevels);
4200
4223
  const levels = mappings(customLevels, useOnlyCustomLevels);
4224
+ if (typeof stream.emit === "function") {
4225
+ stream.emit("message", { code: "PINO_CONFIG", config: { levels, messageKey, errorKey } });
4226
+ }
4201
4227
  assertLevelComparison(levelComparison);
4202
4228
  const levelCompFunc = genLevelComparison(levelComparison);
4203
4229
  Object.assign(instance, {
@@ -10414,7 +10440,20 @@ var require_pino_abstract_transport = __commonJS({
10414
10440
  var metadata = Symbol.for("pino.metadata");
10415
10441
  var split = require_split2();
10416
10442
  var { Duplex } = require_ours();
10443
+ var { parentPort, workerData } = require("worker_threads");
10444
+ function createDeferred() {
10445
+ let resolve;
10446
+ let reject;
10447
+ const promise = new Promise((_resolve, _reject) => {
10448
+ resolve = _resolve;
10449
+ reject = _reject;
10450
+ });
10451
+ promise.resolve = resolve;
10452
+ promise.reject = reject;
10453
+ return promise;
10454
+ }
10417
10455
  module2.exports = function build2(fn, opts = {}) {
10456
+ const waitForConfig = opts.expectPinoConfig === true && workerData?.workerData?.pinoWillSendConfig === true;
10418
10457
  const parseLines = opts.parse === "lines";
10419
10458
  const parseLine = typeof opts.parseLine === "function" ? opts.parseLine : JSON.parse;
10420
10459
  const close = opts.close || defaultClose;
@@ -10452,22 +10491,59 @@ var require_pino_abstract_transport = __commonJS({
10452
10491
  promise.then(cb, cb);
10453
10492
  }
10454
10493
  };
10494
+ if (opts.expectPinoConfig === true && workerData?.workerData?.pinoWillSendConfig !== true) {
10495
+ setImmediate(() => {
10496
+ stream.emit("error", new Error("This transport is not compatible with the current version of pino. Please upgrade pino to the latest version."));
10497
+ });
10498
+ }
10455
10499
  if (opts.metadata !== false) {
10456
10500
  stream[metadata] = true;
10457
10501
  stream.lastTime = 0;
10458
10502
  stream.lastLevel = 0;
10459
10503
  stream.lastObj = null;
10460
10504
  }
10461
- let res = fn(stream);
10462
- if (res && typeof res.catch === "function") {
10463
- res.catch((err) => {
10464
- stream.destroy(err);
10505
+ if (waitForConfig) {
10506
+ let pinoConfig = {};
10507
+ const configReceived = createDeferred();
10508
+ parentPort.on("message", function handleMessage(message) {
10509
+ if (message.code === "PINO_CONFIG") {
10510
+ pinoConfig = message.config;
10511
+ configReceived.resolve();
10512
+ parentPort.off("message", handleMessage);
10513
+ }
10514
+ });
10515
+ Object.defineProperties(stream, {
10516
+ levels: {
10517
+ get() {
10518
+ return pinoConfig.levels;
10519
+ }
10520
+ },
10521
+ messageKey: {
10522
+ get() {
10523
+ return pinoConfig.messageKey;
10524
+ }
10525
+ },
10526
+ errorKey: {
10527
+ get() {
10528
+ return pinoConfig.errorKey;
10529
+ }
10530
+ }
10465
10531
  });
10466
- res = null;
10467
- } else if (opts.enablePipelining && res) {
10468
- return Duplex.from({ writable: stream, readable: res, objectMode: true });
10532
+ return configReceived.then(finish);
10533
+ }
10534
+ return finish();
10535
+ function finish() {
10536
+ let res = fn(stream);
10537
+ if (res && typeof res.catch === "function") {
10538
+ res.catch((err) => {
10539
+ stream.destroy(err);
10540
+ });
10541
+ res = null;
10542
+ } else if (opts.enablePipelining && res) {
10543
+ return Duplex.from({ writable: stream, readable: res });
10544
+ }
10545
+ return stream;
10469
10546
  }
10470
- return stream;
10471
10547
  };
10472
10548
  function defaultClose(err, cb) {
10473
10549
  process.nextTick(cb, err);
@@ -120,7 +120,7 @@ async function start() {
120
120
  } catch (error) {
121
121
  if ((error.code === "ENOTDIR" || error.code === "ERR_MODULE_NOT_FOUND") && filename.startsWith("file://")) {
122
122
  worker = realRequire(decodeURIComponent(filename.replace("file://", "")));
123
- } else if (error.code === void 0) {
123
+ } else if (error.code === void 0 || error.code === "ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING") {
124
124
  worker = realRequire(decodeURIComponent(filename.replace(process.platform === "win32" ? "file:///" : "file://", "")));
125
125
  } else {
126
126
  throw error;
@@ -199,3 +199,16 @@ process.on("uncaughtException", function(err) {
199
199
  });
200
200
  process.exit(1);
201
201
  });
202
+ process.once("exit", (exitCode) => {
203
+ if (exitCode !== 0) {
204
+ process.exit(exitCode);
205
+ return;
206
+ }
207
+ if (destination?.writableNeedDrain && !destination?.writableEnded) {
208
+ parentPort.postMessage({
209
+ code: "WARNING",
210
+ err: new Error("ThreadStream: process exited before destination stream was drained. this may indicate that the destination stream try to write to a another missing stream")
211
+ });
212
+ }
213
+ process.exit(0);
214
+ });