@playcanvas/splat-transform 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
@@ -170,37 +170,19 @@ class LoggerCore {
170
170
  return verbosityRank[this.verbosity] >= verbosityRank[messageMinVerbosity[level]];
171
171
  }
172
172
  /**
173
- * Gate events by the current verbosity, then hand survivors to the
174
- * renderer. Renderers see only visible events and never need to know
175
- * about verbosity themselves.
173
+ * Hand the event to the renderer. Lifecycle events (`scopeStart`,
174
+ * `scopeEnd`, `barStart`, `barTick`, `barEnd`) and `output` are always
175
+ * forwarded; presentation policy (e.g. hiding successful `scopeEnd`
176
+ * footers at non-`verbose` verbosity) lives in the renderer so
177
+ * embedders consuming the event stream see a complete, faithful
178
+ * record of scope and bar lifecycles. `message` is assumed already
179
+ * gated at the façade via {@link LoggerCore.isLevelVisible} (so
180
+ * callers can skip formatting args for filtered levels); anything
181
+ * that reaches here is passed through.
176
182
  *
177
- * - `output` is always shown (it's the pipeable channel).
178
- * - `message` is assumed already gated at the façade via
179
- * {@link LoggerCore.isLevelVisible} (so callers can skip formatting
180
- * args for filtered levels); anything that reaches here is passed
181
- * through.
182
- * - `scopeEnd` footers are noisy on the success path, so success-ends
183
- * are gated one rank higher than their matching start: visible only
184
- * at `verbose`, while `scopeStart` shows at `normal`. Failed ends
185
- * stay at the `normal` gate so the "failed in Xs" cascade from
186
- * `logger.error` / `unwindAll(true)` survives whenever scope
187
- * output is visible at all.
188
- * - All other scope/bar events (`scopeStart`, `barStart`, `barTick`,
189
- * `barEnd`) are gated at `normal`.
190
- *
191
- * @param event - The candidate event.
183
+ * @param event - The event to deliver.
192
184
  */
193
185
  emit(event) {
194
- if (event.kind !== 'output' && event.kind !== 'message') {
195
- const rank = verbosityRank[this.verbosity];
196
- if (event.kind === 'scopeEnd' && !event.failed) {
197
- if (rank < verbosityRank.verbose)
198
- return;
199
- }
200
- else if (rank < verbosityRank.normal) {
201
- return;
202
- }
203
- }
204
186
  this.renderer.handle(event);
205
187
  }
206
188
  /**
@@ -477,7 +459,10 @@ const logger = {
477
459
  },
478
460
  /**
479
461
  * Replace the active renderer. Embedders install their own renderer here
480
- * to consume `LogEvent`s; the default renderer is a no-op.
462
+ * to consume `LogEvent`s; the default renderer is a no-op. Renderers
463
+ * receive every scope/bar lifecycle event regardless of verbosity, so
464
+ * progress UIs can rely on `scopeStart`/`scopeEnd` and `barStart`/`barEnd`
465
+ * to manage their state.
481
466
  * @param r - The renderer to install.
482
467
  */
483
468
  setRenderer(r) {
@@ -986,20 +971,27 @@ const indent = (depth) => ' '.repeat(Math.max(0, depth));
986
971
  const BAR_WIDTH = 20;
987
972
  /**
988
973
  * Default human-readable text renderer. Emits one event per line - no
989
- * carriage-return rewriting, no TTY detection, no buffering. Scope starts
990
- * always emit a header line; successful `scopeEnd` footers are filtered
991
- * out at `normal` verbosity by `LoggerCore` (kept at `verbose`, and always
992
- * shown when `failed`), so default-mode runs see headers without timing
993
- * footers and `--verbose` adds the matching `done in ...` lines. Bars
994
- * render as `[#### ...... ] duration`, with `#` appended incrementally on
995
- * each `barTick` and the remainder padded with `.` on `barEnd`. `output`
974
+ * carriage-return rewriting, no TTY detection, no buffering. Bars render
975
+ * as `[#### ...... ] duration`, with `#` appended incrementally on each
976
+ * `barTick` and the remainder padded with `.` on `barEnd`. `output`
996
977
  * events are treated as line-oriented: their text is written to the
997
978
  * pipeable sink with a trailing `\n` appended (callers should not include
998
979
  * one themselves).
999
980
  *
1000
- * Verbosity filtering is handled centrally by `LoggerCore` - this renderer
1001
- * receives only events that have already passed the visibility gate, so it
1002
- * is pure presentation.
981
+ * Verbosity is consulted directly from the shared {@link logger} on each
982
+ * event, so this renderer alone decides what to display - the core
983
+ * delivers every scope/bar lifecycle event so embedders consuming the
984
+ * event stream see a faithful record. The display rules are:
985
+ *
986
+ * - `quiet` - suppresses every scope/bar lifecycle line (start, tick,
987
+ * end - including failed ends). Errors, warnings and `output` still
988
+ * show.
989
+ * - `normal` (default) - shows scope/bar headers and bar progress;
990
+ * shows failed `scopeEnd` / `barEnd` footers (the "failed in ..."
991
+ * cascade from `logger.error` / `unwindAll(true)`); hides successful
992
+ * `scopeEnd` footers.
993
+ * - `verbose` - shows everything, including successful `scopeEnd`
994
+ * footers ("done in ...").
1003
995
  *
1004
996
  * Sinks are injected (no `process` reference here) so the renderer works in
1005
997
  * both Node CLI and browser/bundle contexts: the CLI passes
@@ -1022,9 +1014,14 @@ class TextRenderer {
1022
1014
  this.output = options.output ?? options.write;
1023
1015
  this.getMemoryUsage = options.getMemoryUsage;
1024
1016
  }
1017
+ rank() {
1018
+ return verbosityRank[logger.getVerbosity()];
1019
+ }
1025
1020
  handle(event) {
1026
1021
  switch (event.kind) {
1027
1022
  case 'scopeStart': {
1023
+ if (this.rank() < verbosityRank.normal)
1024
+ return;
1028
1025
  this.commitDirty();
1029
1026
  const numbered = event.index !== undefined && event.total !== undefined ?
1030
1027
  `[${event.index}/${event.total}] ` : '';
@@ -1032,12 +1029,22 @@ class TextRenderer {
1032
1029
  return;
1033
1030
  }
1034
1031
  case 'scopeEnd': {
1032
+ const rank = this.rank();
1033
+ if (event.failed) {
1034
+ if (rank < verbosityRank.normal)
1035
+ return;
1036
+ }
1037
+ else if (rank < verbosityRank.verbose) {
1038
+ return;
1039
+ }
1035
1040
  this.commitDirty();
1036
1041
  const verb = event.failed ? 'failed in' : 'done in';
1037
1042
  this.write(`${indent(event.depth + 1)}${verb} ${fmtTime(event.durationMs)}${this.memSuffix()}\n`);
1038
1043
  return;
1039
1044
  }
1040
1045
  case 'barStart': {
1046
+ if (this.rank() < verbosityRank.normal)
1047
+ return;
1041
1048
  this.commitDirty();
1042
1049
  this.write(`${indent(event.depth)}\u25b8 ${event.name} [`);
1043
1050
  this.lineDirty = true;
@@ -1047,6 +1054,8 @@ class TextRenderer {
1047
1054
  case 'barTick': {
1048
1055
  if (!this.lineDirty)
1049
1056
  return;
1057
+ if (this.rank() < verbosityRank.normal)
1058
+ return;
1050
1059
  const target = event.total <= 0 ? 0 :
1051
1060
  Math.min(BAR_WIDTH, Math.floor((event.current / event.total) * BAR_WIDTH));
1052
1061
  if (target > this.barFilled) {
@@ -1056,6 +1065,8 @@ class TextRenderer {
1056
1065
  return;
1057
1066
  }
1058
1067
  case 'barEnd': {
1068
+ if (this.rank() < verbosityRank.normal)
1069
+ return;
1059
1070
  const suffix = event.failed ?
1060
1071
  `] (failed) ${fmtTime(event.durationMs)}` :
1061
1072
  `] ${fmtTime(event.durationMs)}`;
@@ -6248,7 +6259,14 @@ class CompressedChunk {
6248
6259
  }
6249
6260
  }
6250
6261
 
6251
- var version = "2.0.0";
6262
+ /**
6263
+ * The splat-transform version (semver MAJOR.MINOR.PATCH).
6264
+ */
6265
+ const version = '2.0.1';
6266
+ /**
6267
+ * The splat-transform revision (short Git hash of HEAD at build time).
6268
+ */
6269
+ const revision = '129f87d';
6252
6270
 
6253
6271
  const generatedByString = `Generated by splat-transform ${version}`;
6254
6272
  const chunkProps = [
@@ -14297,9 +14315,11 @@ exports.readPly = readPly;
14297
14315
  exports.readSog = readSog;
14298
14316
  exports.readSplat = readSplat;
14299
14317
  exports.readSpz = readSpz;
14318
+ exports.revision = revision;
14300
14319
  exports.simplifyGaussians = simplifyGaussians;
14301
14320
  exports.sortByVisibility = sortByVisibility;
14302
14321
  exports.sortMortonOrder = sortMortonOrder;
14322
+ exports.version = version;
14303
14323
  exports.voxelizeToBuffer = voxelizeToBuffer;
14304
14324
  exports.writeCompressedPly = writeCompressedPly;
14305
14325
  exports.writeCsv = writeCsv;