@needle-tools/gltf-build-pipeline 2.16.0-next.eb5a640 → 3.0.0-520934f

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.
Files changed (121) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/README.md +13 -1
  3. package/dist/cli/index.js +4237 -258
  4. package/package.json +9 -14
  5. package/tools/pmrem/pkg/pmrem_wasm.d.ts +25 -0
  6. package/tools/pmrem/pkg/pmrem_wasm.js +110 -0
  7. package/tools/pmrem/pkg/pmrem_wasm_bg.wasm +0 -0
  8. package/dist/cache/cache.d.ts +0 -59
  9. package/dist/cache/cache.js +0 -350
  10. package/dist/cache/index.d.ts +0 -2
  11. package/dist/cache/index.js +0 -2
  12. package/dist/cache/job-cache.d.ts +0 -28
  13. package/dist/cache/job-cache.js +0 -86
  14. package/dist/cli/index.d.ts +0 -2
  15. package/dist/config/index.d.ts +0 -64
  16. package/dist/config/index.js +0 -161
  17. package/dist/constants.d.ts +0 -7
  18. package/dist/constants.js +0 -7
  19. package/dist/extensions/NEEDLE_compression_texture/NEEDLE_compression_texture.d.ts +0 -24
  20. package/dist/extensions/NEEDLE_compression_texture/NEEDLE_compression_texture.js +0 -54
  21. package/dist/extensions/NEEDLE_compression_texture/index.d.ts +0 -1
  22. package/dist/extensions/NEEDLE_compression_texture/index.js +0 -1
  23. package/dist/extensions/NEEDLE_lightmaps/index.d.ts +0 -39
  24. package/dist/extensions/NEEDLE_lightmaps/index.js +0 -257
  25. package/dist/extensions/NEEDLE_mesh_compression/NEEDLE_mesh_compression.d.ts +0 -27
  26. package/dist/extensions/NEEDLE_mesh_compression/NEEDLE_mesh_compression.js +0 -88
  27. package/dist/extensions/NEEDLE_mesh_compression/index.d.ts +0 -1
  28. package/dist/extensions/NEEDLE_mesh_compression/index.js +0 -1
  29. package/dist/extensions/NEEDLE_opaque/NEEDLE_opaque.d.ts +0 -27
  30. package/dist/extensions/NEEDLE_opaque/NEEDLE_opaque.js +0 -1078
  31. package/dist/extensions/NEEDLE_opaque/index.d.ts +0 -2
  32. package/dist/extensions/NEEDLE_opaque/index.js +0 -30
  33. package/dist/extensions/NEEDLE_pmrem/index.d.ts +0 -21
  34. package/dist/extensions/NEEDLE_pmrem/index.js +0 -95
  35. package/dist/extensions/NEEDLE_progressive/NEEDLE_progressive.d.ts +0 -48
  36. package/dist/extensions/NEEDLE_progressive/NEEDLE_progressive.js +0 -69
  37. package/dist/extensions/NEEDLE_progressive/index.d.ts +0 -1
  38. package/dist/extensions/NEEDLE_progressive/index.js +0 -1
  39. package/dist/extensions/NEEDLE_progressive_mesh_settings/index.d.ts +0 -23
  40. package/dist/extensions/NEEDLE_progressive_mesh_settings/index.js +0 -41
  41. package/dist/extensions/NEEDLE_progressive_texture_settings/index.d.ts +0 -25
  42. package/dist/extensions/NEEDLE_progressive_texture_settings/index.js +0 -38
  43. package/dist/extensions/index.d.ts +0 -15
  44. package/dist/extensions/index.js +0 -34
  45. package/dist/extensions/utils.d.ts +0 -9
  46. package/dist/extensions/utils.js +0 -79
  47. package/dist/functions/weld.3.d.ts +0 -76
  48. package/dist/functions/weld.3.js +0 -414
  49. package/dist/index.d.ts +0 -8
  50. package/dist/index.js +0 -8
  51. package/dist/scripts/index.d.ts +0 -2
  52. package/dist/scripts/index.js +0 -2
  53. package/dist/scripts/pack-gltf.d.ts +0 -19
  54. package/dist/scripts/pack-gltf.js +0 -187
  55. package/dist/scripts/stats.d.ts +0 -5
  56. package/dist/scripts/stats.js +0 -20
  57. package/dist/transforms/index.d.ts +0 -12
  58. package/dist/transforms/index.js +0 -12
  59. package/dist/transforms/needle_animation_transform.d.ts +0 -2
  60. package/dist/transforms/needle_animation_transform.js +0 -5
  61. package/dist/transforms/needle_asset.d.ts +0 -3
  62. package/dist/transforms/needle_asset.js +0 -50
  63. package/dist/transforms/needle_audio.d.ts +0 -12
  64. package/dist/transforms/needle_audio.js +0 -104
  65. package/dist/transforms/needle_audio_ffmpeg.d.ts +0 -14
  66. package/dist/transforms/needle_audio_ffmpeg.js +0 -51
  67. package/dist/transforms/needle_audio_registry.d.ts +0 -38
  68. package/dist/transforms/needle_audio_registry.js +0 -47
  69. package/dist/transforms/needle_common.d.ts +0 -17
  70. package/dist/transforms/needle_common.js +0 -1
  71. package/dist/transforms/needle_mesh_transform.d.ts +0 -15
  72. package/dist/transforms/needle_mesh_transform.js +0 -223
  73. package/dist/transforms/needle_pmrem.d.ts +0 -21
  74. package/dist/transforms/needle_pmrem.js +0 -238
  75. package/dist/transforms/needle_progressive.d.ts +0 -53
  76. package/dist/transforms/needle_progressive.js +0 -1117
  77. package/dist/transforms/needle_texture_transform.d.ts +0 -15
  78. package/dist/transforms/needle_texture_transform.js +0 -271
  79. package/dist/transforms/needle_toktx.d.ts +0 -26
  80. package/dist/transforms/needle_toktx.js +0 -250
  81. package/dist/transforms/needle_webp.d.ts +0 -15
  82. package/dist/transforms/needle_webp.js +0 -53
  83. package/dist/transforms/toktx.d.ts +0 -52
  84. package/dist/transforms/toktx.js +0 -208
  85. package/dist/transforms/toktx_types.d.ts +0 -78
  86. package/dist/transforms/toktx_types.js +0 -62
  87. package/dist/transforms/util.d.ts +0 -21
  88. package/dist/transforms/util.js +0 -90
  89. package/dist/utils/analytics.d.ts +0 -24
  90. package/dist/utils/analytics.js +0 -128
  91. package/dist/utils/compression_utils.d.ts +0 -2
  92. package/dist/utils/compression_utils.js +0 -6
  93. package/dist/utils/fileutils.d.ts +0 -22
  94. package/dist/utils/fileutils.js +0 -195
  95. package/dist/utils/guid.d.ts +0 -1
  96. package/dist/utils/guid.js +0 -5
  97. package/dist/utils/index.d.ts +0 -9
  98. package/dist/utils/index.js +0 -9
  99. package/dist/utils/mesh.d.ts +0 -13
  100. package/dist/utils/mesh.js +0 -124
  101. package/dist/utils/nodeio.d.ts +0 -11
  102. package/dist/utils/nodeio.js +0 -116
  103. package/dist/utils/stats.d.ts +0 -70
  104. package/dist/utils/stats.js +0 -273
  105. package/dist/utils/test-assert.d.ts +0 -8
  106. package/dist/utils/test-assert.js +0 -18
  107. package/dist/utils/texture.d.ts +0 -5
  108. package/dist/utils/texture.js +0 -14
  109. package/dist/utils/validate.d.ts +0 -9
  110. package/dist/utils/validate.js +0 -24
  111. package/dist/utils/version.d.ts +0 -1
  112. package/dist/utils/version.gen.d.ts +0 -1
  113. package/dist/utils/version.gen.js +0 -1
  114. package/dist/utils/version.js +0 -4
  115. package/scripts/clear-caches.mjs +0 -4
  116. package/scripts/defaults.mjs +0 -12
  117. package/scripts/fileutils.mjs +0 -6
  118. package/scripts/index.mjs +0 -41
  119. package/scripts/limit-caches.mjs +0 -4
  120. package/scripts/make-progressive.mjs +0 -16
  121. package/scripts/pack-gltf.mjs +0 -107
package/CHANGELOG.md CHANGED
@@ -4,6 +4,78 @@ All notable changes to this package will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [3.0.0] - 2026-06-23
8
+
9
+ First stable 3.0 release. Summary of the headline changes across the 3.0 alpha/beta cycle.
10
+
11
+ ### Breaking
12
+ - The CLI now requires JWT authentication via `--auth-token`. A missing, malformed, or expired token aborts the run with a clear message that includes the pipeline version.
13
+ - The package ships as a CLI only.
14
+
15
+ ### Added
16
+ - **Job cache**: a file-level cache that skips an entire transform when the same input + config was already processed.
17
+ - **Audio compression**: external audio references are re-encoded to Opus/OGG. Supported input formats are WAV, FLAC, and AIFF; already-lossy formats pass through unchanged.
18
+ - **PMREM CLI command**: `needle-gltf pmrem <input>` converts EXR and Radiance HDR files to PMREM KTX2.
19
+ - **Multiple file inputs**: `transform` accepts comma-separated paths (e.g. `needle-gltf transform a.glb,b.glb out/`).
20
+ - **Diagnostic logging**: authentication failures (with secrets redacted) and pipeline errors — compression failures and unhandled exceptions — are written to a log file to make issues easier to diagnose.
21
+
22
+ ### Fixed
23
+ - VRM thumbnails (and other textures referenced only through an opaque extension) no longer dangle to the wrong image after prune/dedup re-indexing. A stale `KHR_texture_basisu.source` could point past the end of the image array and crash three.js on load (`Cannot read properties of undefined (reading 'uri')`), or silently resolve to a neighbouring image. Re-running the pipeline on an already-compressed VRM is now covered by tests.
24
+ - Audio URIs use forward slashes on every platform; on Windows a `path.join`-built clip path produced backslashes that loaders could not resolve (only affected audio in a subfolder).
25
+ - Cache restore now also restores external files (KTX2, PMREM) alongside the main GLB.
26
+ - PMREM NaN generation that caused artifacts in certain EXR files.
27
+ - xxHash WASM init race condition, now gated by `ensureHashReady`.
28
+ - LOD file detection no longer matches against directory names.
29
+ - toktx now probes the `ktx` binary to match what the compression step actually runs.
30
+ - `getConfig` returns a fresh copy instead of a shared mutable reference.
31
+ - `stats` tolerates undefined errors/warnings in `addFrom` and exits with code 0.
32
+ - Material-only GLBs are no longer incorrectly pruned.
33
+ - `createOpaqueExtension` return type fixed, downstream casts removed.
34
+
35
+ ## [3.0.0-beta.3] - 2026-06-10
36
+
37
+ ### Added
38
+ - Pipeline errors (including compression failures and unhandled exceptions) are now written to the log file to aid diagnosis.
39
+
40
+ ## [3.0.0-beta.2] - 2026-06-10
41
+
42
+ ### Added
43
+ - Authentication failures are now written to a log file (with secrets redacted) to make auth issues easier to diagnose.
44
+
45
+ ### Changed
46
+ - The "Auth failed" message now includes the pipeline version.
47
+
48
+ ## [3.0.0-beta.1] - 2026-06-10
49
+
50
+ ### Fixed
51
+ - VRM thumbnail (and other textures referenced only through an opaque extension) no longer dangle to the wrong image after prune/dedup re-indexing. When an image was deduped, an extension-carried `KHR_texture_basisu.source` was copied verbatim and left stale — the thumbnail's source could point past the end of the image array and crash three.js on load (`Cannot read properties of undefined (reading 'uri')`), while other affected textures silently resolved to a neighbouring image. Re-running the pipeline on an already-compressed VRM is now covered by tests.
52
+ - Audio URIs now use forward slashes on every platform. On Windows the rewritten clip path was built with `path.join`, producing backslashes that loaders cannot resolve (only affected audio assets in a subfolder).
53
+
54
+ ## [3.0.0-alpha] - 2026-05-26
55
+
56
+ ### Breaking
57
+ - CLI now requires JWT authentication via `--auth-token`
58
+ - The package ships as a CLI-only right now
59
+
60
+ ### Added
61
+ - **Job cache**: file-level cache that skips an entire transform when the same input + config was already processed
62
+ - **Audio compression**: external audio references are re-encoded to Opus/OGG; supported input formats are WAV, FLAC, and AIFF (lossy formats pass through unchanged)
63
+ - **PMREM standalone CLI command**: `needle-gltf pmrem <input>` converts EXR and Radiance HDR files to PMREM KTX2
64
+ - **Multiple file inputs**: `transform` now accepts comma-separated paths (e.g. `needle-gltf transform a.glb,b.glb out/`)
65
+ - Auth surfaces clean "token expired" message when the JWT `exp` claim is past
66
+
67
+ ### Fixed
68
+ - Cache restore now also restores external files (KTX2, PMREM) alongside the main GLB
69
+ - PMREM NaN generation that caused artifacts in certain EXR files
70
+ - xxHash WASM init race condition, now resolved with `ensureHashReady` gate
71
+ - LOD file detection no longer matches against directory names
72
+ - toktx: probes `ktx` binary to match what the compression step actually runs
73
+ - `getConfig` now returns a fresh copy instead of a shared mutable reference
74
+ - `stats` tolerates undefined errors/warnings in `addFrom`
75
+ - Material-only GLBs are no longer incorrectly pruned
76
+ - `createOpaqueExtension` return type fixed, downstream casts removed
77
+ - `stats` command exits with code 0
78
+
7
79
  ## [2.15.0] - 2026-03-20
8
80
  - add: EXR environment map compression (PMREM / FASTHDR) for Needle Engine, supporting both Unity and Blender exports
9
81
  - fix: cache hashing stability (circular reference handling)
package/README.md CHANGED
@@ -26,6 +26,18 @@ To load progressively enhanced glTF files in Needle Engine or another three.js b
26
26
  ### Commands
27
27
  - `help` - use help to view options
28
28
 
29
+ ### Platform support
30
+
31
+ The bundled `basisu` encoder (used for HDR / EXR → KTX2 HDR) supports:
32
+
33
+ | OS | Arch | Status |
34
+ |---------|-----------------------|--------|
35
+ | Linux | x64 | Supported |
36
+ | Linux | arm64 | Not supported |
37
+ | macOS | arm64 (Apple Silicon) | Supported |
38
+ | macOS | x64 (Intel) | Not supported |
39
+ | Windows | x64 | Supported |
40
+
29
41
  ### Configuration
30
42
 
31
43
  The pipeline reads an optional `needle.config.json` from the working directory (or any parent directory). Configure pipeline behaviour under the `gltf` key:
@@ -49,7 +61,7 @@ The `gltf` value may also be a string shorthand for `usecase` — `"gltf": "prod
49
61
  | `usecase` | `"default" \| "product" \| "world"` | `"default"` | High-level optimisation profile. |
50
62
  | `textures.lods` | `boolean` | `true` | Generate progressive texture LODs. |
51
63
  | `meshes.lods` | `boolean` | `true` | Generate progressive mesh LODs. |
52
- | `audio.enabled` | `boolean` | `true` | Compress externally referenced `.wav` audio files to Opus in an `.ogg` container, rewriting the URIs in the glTF. Lossy formats (`.mp3`, `.ogg`, `.m4a`, `.aac`) pass through unchanged to avoid compounding compression artifacts. Requires `ffmpeg` with `libopus` on `PATH`; when missing the build logs a warning and leaves the audio files untouched. |
64
+ | `audio.enabled` | `boolean` | `true` | Compress externally referenced lossless audio files (`.wav`, `.flac`, `.aiff`/`.aif`) to Opus in an `.ogg` container, rewriting the URIs in the glTF. Lossy formats (`.mp3`, `.ogg`, `.m4a`, `.aac`) pass through unchanged to avoid compounding compression artifacts. Requires `ffmpeg` with `libopus` on `PATH`; when missing the build logs a warning and leaves the audio files untouched. |
53
65
  | `audio.bitrate` | `number` (kbps) | `128` | Opus encoding bitrate. 96 is near-transparent for most music; 128 matches YouTube's music tier and is the safe "won't sound bad" default. Drop to 48–64 for known mono/UI-only assets. |
54
66
  | `exr.enabled` | `boolean` | `true` | Convert EXR textures to KTX2 HDR via PMREM. When `false`, EXR textures (bundled and externally referenced) are left as-is so a downstream step can handle them. |
55
67