@threlte/gltf 3.0.4 → 3.0.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @threlte/gltf
2
2
 
3
+ ## 3.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - bd24a8a: Fix prettier-plugin-svelte resolution error when running via npx
8
+ - 3c951cc: Auto-detect Draco compression from GLTF metadata and include useDraco() in generated components automatically
9
+
3
10
  ## 3.0.4
4
11
 
5
12
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threlte/gltf",
3
- "version": "3.0.4",
3
+ "version": "3.0.5",
4
4
  "description": "GLTF to Threlte converter",
5
5
  "type": "module",
6
6
  "keywords": [
package/src/index.js CHANGED
@@ -2,6 +2,7 @@ import 'jsdom-global'
2
2
  import fs from 'node:fs/promises'
3
3
  import path from 'node:path'
4
4
  import * as prettier from 'prettier'
5
+ import * as prettierPluginSvelte from 'prettier-plugin-svelte'
5
6
  import { transform } from './utils/transform.js'
6
7
  import { parse } from './utils/parser.js'
7
8
  import { GLTFLoader } from './bin/GLTFLoader.js'
@@ -40,7 +41,7 @@ export default async function (file, output, options) {
40
41
  semi: false,
41
42
  printWidth: 100,
42
43
  parser: 'svelte',
43
- plugins: ['prettier-plugin-svelte'],
44
+ plugins: [prettierPluginSvelte],
44
45
  overrides: [
45
46
  {
46
47
  files: '*.svelte',
@@ -484,8 +484,12 @@ export function parse(fileName, gltf, options = {}) {
484
484
  // 2nd pass to eliminate hard to swat left-overs
485
485
  const scene = printThrelte(gltf.scene)
486
486
 
487
+ const hasDraco =
488
+ gltf.parser?.json?.extensionsUsed?.includes('KHR_draco_mesh_compression') ||
489
+ gltf.parser?.json?.extensionsRequired?.includes('KHR_draco_mesh_compression')
490
+
487
491
  const useGltfOptions = {
488
- draco: options.transform || options.draco
492
+ draco: options.transform || options.draco || hasDraco
489
493
  }
490
494
 
491
495
  const imports = `