@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/cli.mjs CHANGED
@@ -11422,37 +11422,19 @@ class LoggerCore {
11422
11422
  return verbosityRank[this.verbosity] >= verbosityRank[messageMinVerbosity[level]];
11423
11423
  }
11424
11424
  /**
11425
- * Gate events by the current verbosity, then hand survivors to the
11426
- * renderer. Renderers see only visible events and never need to know
11427
- * about verbosity themselves.
11425
+ * Hand the event to the renderer. Lifecycle events (`scopeStart`,
11426
+ * `scopeEnd`, `barStart`, `barTick`, `barEnd`) and `output` are always
11427
+ * forwarded; presentation policy (e.g. hiding successful `scopeEnd`
11428
+ * footers at non-`verbose` verbosity) lives in the renderer so
11429
+ * embedders consuming the event stream see a complete, faithful
11430
+ * record of scope and bar lifecycles. `message` is assumed already
11431
+ * gated at the façade via {@link LoggerCore.isLevelVisible} (so
11432
+ * callers can skip formatting args for filtered levels); anything
11433
+ * that reaches here is passed through.
11428
11434
  *
11429
- * - `output` is always shown (it's the pipeable channel).
11430
- * - `message` is assumed already gated at the façade via
11431
- * {@link LoggerCore.isLevelVisible} (so callers can skip formatting
11432
- * args for filtered levels); anything that reaches here is passed
11433
- * through.
11434
- * - `scopeEnd` footers are noisy on the success path, so success-ends
11435
- * are gated one rank higher than their matching start: visible only
11436
- * at `verbose`, while `scopeStart` shows at `normal`. Failed ends
11437
- * stay at the `normal` gate so the "failed in Xs" cascade from
11438
- * `logger.error` / `unwindAll(true)` survives whenever scope
11439
- * output is visible at all.
11440
- * - All other scope/bar events (`scopeStart`, `barStart`, `barTick`,
11441
- * `barEnd`) are gated at `normal`.
11442
- *
11443
- * @param event - The candidate event.
11435
+ * @param event - The event to deliver.
11444
11436
  */
11445
11437
  emit(event) {
11446
- if (event.kind !== 'output' && event.kind !== 'message') {
11447
- const rank = verbosityRank[this.verbosity];
11448
- if (event.kind === 'scopeEnd' && !event.failed) {
11449
- if (rank < verbosityRank.verbose)
11450
- return;
11451
- }
11452
- else if (rank < verbosityRank.normal) {
11453
- return;
11454
- }
11455
- }
11456
11438
  this.renderer.handle(event);
11457
11439
  }
11458
11440
  /**
@@ -11729,7 +11711,10 @@ const logger = {
11729
11711
  },
11730
11712
  /**
11731
11713
  * Replace the active renderer. Embedders install their own renderer here
11732
- * to consume `LogEvent`s; the default renderer is a no-op.
11714
+ * to consume `LogEvent`s; the default renderer is a no-op. Renderers
11715
+ * receive every scope/bar lifecycle event regardless of verbosity, so
11716
+ * progress UIs can rely on `scopeStart`/`scopeEnd` and `barStart`/`barEnd`
11717
+ * to manage their state.
11733
11718
  * @param r - The renderer to install.
11734
11719
  */
11735
11720
  setRenderer(r) {
@@ -12238,20 +12223,27 @@ const indent = (depth) => ' '.repeat(Math.max(0, depth));
12238
12223
  const BAR_WIDTH = 20;
12239
12224
  /**
12240
12225
  * Default human-readable text renderer. Emits one event per line - no
12241
- * carriage-return rewriting, no TTY detection, no buffering. Scope starts
12242
- * always emit a header line; successful `scopeEnd` footers are filtered
12243
- * out at `normal` verbosity by `LoggerCore` (kept at `verbose`, and always
12244
- * shown when `failed`), so default-mode runs see headers without timing
12245
- * footers and `--verbose` adds the matching `done in ...` lines. Bars
12246
- * render as `[#### ...... ] duration`, with `#` appended incrementally on
12247
- * each `barTick` and the remainder padded with `.` on `barEnd`. `output`
12226
+ * carriage-return rewriting, no TTY detection, no buffering. Bars render
12227
+ * as `[#### ...... ] duration`, with `#` appended incrementally on each
12228
+ * `barTick` and the remainder padded with `.` on `barEnd`. `output`
12248
12229
  * events are treated as line-oriented: their text is written to the
12249
12230
  * pipeable sink with a trailing `\n` appended (callers should not include
12250
12231
  * one themselves).
12251
12232
  *
12252
- * Verbosity filtering is handled centrally by `LoggerCore` - this renderer
12253
- * receives only events that have already passed the visibility gate, so it
12254
- * is pure presentation.
12233
+ * Verbosity is consulted directly from the shared {@link logger} on each
12234
+ * event, so this renderer alone decides what to display - the core
12235
+ * delivers every scope/bar lifecycle event so embedders consuming the
12236
+ * event stream see a faithful record. The display rules are:
12237
+ *
12238
+ * - `quiet` - suppresses every scope/bar lifecycle line (start, tick,
12239
+ * end - including failed ends). Errors, warnings and `output` still
12240
+ * show.
12241
+ * - `normal` (default) - shows scope/bar headers and bar progress;
12242
+ * shows failed `scopeEnd` / `barEnd` footers (the "failed in ..."
12243
+ * cascade from `logger.error` / `unwindAll(true)`); hides successful
12244
+ * `scopeEnd` footers.
12245
+ * - `verbose` - shows everything, including successful `scopeEnd`
12246
+ * footers ("done in ...").
12255
12247
  *
12256
12248
  * Sinks are injected (no `process` reference here) so the renderer works in
12257
12249
  * both Node CLI and browser/bundle contexts: the CLI passes
@@ -12274,9 +12266,14 @@ class TextRenderer {
12274
12266
  this.output = options.output ?? options.write;
12275
12267
  this.getMemoryUsage = options.getMemoryUsage;
12276
12268
  }
12269
+ rank() {
12270
+ return verbosityRank[logger.getVerbosity()];
12271
+ }
12277
12272
  handle(event) {
12278
12273
  switch (event.kind) {
12279
12274
  case 'scopeStart': {
12275
+ if (this.rank() < verbosityRank.normal)
12276
+ return;
12280
12277
  this.commitDirty();
12281
12278
  const numbered = event.index !== undefined && event.total !== undefined ?
12282
12279
  `[${event.index}/${event.total}] ` : '';
@@ -12284,12 +12281,22 @@ class TextRenderer {
12284
12281
  return;
12285
12282
  }
12286
12283
  case 'scopeEnd': {
12284
+ const rank = this.rank();
12285
+ if (event.failed) {
12286
+ if (rank < verbosityRank.normal)
12287
+ return;
12288
+ }
12289
+ else if (rank < verbosityRank.verbose) {
12290
+ return;
12291
+ }
12287
12292
  this.commitDirty();
12288
12293
  const verb = event.failed ? 'failed in' : 'done in';
12289
12294
  this.write(`${indent(event.depth + 1)}${verb} ${fmtTime(event.durationMs)}${this.memSuffix()}\n`);
12290
12295
  return;
12291
12296
  }
12292
12297
  case 'barStart': {
12298
+ if (this.rank() < verbosityRank.normal)
12299
+ return;
12293
12300
  this.commitDirty();
12294
12301
  this.write(`${indent(event.depth)}\u25b8 ${event.name} [`);
12295
12302
  this.lineDirty = true;
@@ -12299,6 +12306,8 @@ class TextRenderer {
12299
12306
  case 'barTick': {
12300
12307
  if (!this.lineDirty)
12301
12308
  return;
12309
+ if (this.rank() < verbosityRank.normal)
12310
+ return;
12302
12311
  const target = event.total <= 0 ? 0 :
12303
12312
  Math.min(BAR_WIDTH, Math.floor((event.current / event.total) * BAR_WIDTH));
12304
12313
  if (target > this.barFilled) {
@@ -12308,6 +12317,8 @@ class TextRenderer {
12308
12317
  return;
12309
12318
  }
12310
12319
  case 'barEnd': {
12320
+ if (this.rank() < verbosityRank.normal)
12321
+ return;
12311
12322
  const suffix = event.failed ?
12312
12323
  `] (failed) ${fmtTime(event.durationMs)}` :
12313
12324
  `] ${fmtTime(event.durationMs)}`;
@@ -17464,7 +17475,14 @@ class CompressedChunk {
17464
17475
  }
17465
17476
  }
17466
17477
 
17467
- var version = "2.0.0";
17478
+ /**
17479
+ * The splat-transform version (semver MAJOR.MINOR.PATCH).
17480
+ */
17481
+ const version = '2.0.1';
17482
+ /**
17483
+ * The splat-transform revision (short Git hash of HEAD at build time).
17484
+ */
17485
+ const revision = '129f87d';
17468
17486
 
17469
17487
  const generatedByString = `Generated by splat-transform ${version}`;
17470
17488
  const chunkProps = [
@@ -26387,7 +26405,7 @@ const main = async () => {
26387
26405
  else {
26388
26406
  logger.setVerbosity('normal');
26389
26407
  }
26390
- logger.info(`splat-transform v${version}`);
26408
+ logger.info(`splat-transform v${version} (${revision})`);
26391
26409
  // show version and exit
26392
26410
  if (options.version) {
26393
26411
  exit(0);