@threlte/gltf 3.0.3 → 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 +13 -0
- package/cli.js +7 -4
- package/package.json +3 -3
- package/src/index.js +2 -1
- package/src/utils/parser.js +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
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
|
+
|
|
10
|
+
## 3.0.4
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 2ee022d: Fix `--output` option being silently ignored
|
|
15
|
+
|
|
3
16
|
## 3.0.3
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict'
|
|
3
3
|
|
|
4
|
-
import { dirname } from 'node:path'
|
|
4
|
+
import { dirname, parse } from 'node:path'
|
|
5
5
|
import { fileURLToPath } from 'node:url'
|
|
6
6
|
import meow from 'meow'
|
|
7
7
|
import { readPackageUpSync } from 'read-pkg-up'
|
|
@@ -75,9 +75,12 @@ if (cli.input.length === 0) {
|
|
|
75
75
|
console.log(cli.help)
|
|
76
76
|
} else {
|
|
77
77
|
const file = cli.input[0]
|
|
78
|
-
const
|
|
79
|
-
const
|
|
80
|
-
|
|
78
|
+
const name = parse(file).name
|
|
79
|
+
const output = cli.flags.output
|
|
80
|
+
? cli.flags.output.endsWith('.svelte')
|
|
81
|
+
? cli.flags.output
|
|
82
|
+
: `${cli.flags.output}.svelte`
|
|
83
|
+
: `${name}.svelte`
|
|
81
84
|
|
|
82
85
|
try {
|
|
83
86
|
await gltf(file, output, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@threlte/gltf",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.5",
|
|
4
4
|
"description": "GLTF to Threlte converter",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"keyframe-resample": "^0.1.0",
|
|
38
38
|
"meow": "^14.0.0",
|
|
39
39
|
"meshoptimizer": "^0.25.0",
|
|
40
|
-
"prettier": "^3.
|
|
41
|
-
"prettier-plugin-svelte": "^3.
|
|
40
|
+
"prettier": "^3.8.1",
|
|
41
|
+
"prettier-plugin-svelte": "^3.5.1",
|
|
42
42
|
"read-pkg-up": "^11.0.0",
|
|
43
43
|
"sharp": "^0.34.5",
|
|
44
44
|
"svelte": "5.53.6",
|
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: [
|
|
44
|
+
plugins: [prettierPluginSvelte],
|
|
44
45
|
overrides: [
|
|
45
46
|
{
|
|
46
47
|
files: '*.svelte',
|
package/src/utils/parser.js
CHANGED
|
@@ -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 = `
|