@threlte/gltf 1.0.0-next.11 → 1.0.0-next.13

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,17 @@
1
1
  # @threlte/gltf
2
2
 
3
+ ## 1.0.0-next.13
4
+
5
+ ### Major Changes
6
+
7
+ - d5abde5: Simplified root option to more reasonable approach. When no root is given, the path supplied will be normalized and used as a file path, if root is given, takes full control.
8
+
9
+ ## 1.0.0-next.12
10
+
11
+ ### Patch Changes
12
+
13
+ - 6d56d11c: Added proper types for new slots error & fallback
14
+
3
15
  ## 1.0.0-next.11
4
16
 
5
17
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threlte/gltf",
3
- "version": "1.0.0-next.11",
3
+ "version": "1.0.0-next.13",
4
4
  "description": "GLTF to Threlte converter",
5
5
  "type": "module",
6
6
  "keywords": [
package/src/index.js CHANGED
@@ -25,12 +25,8 @@ function toArrayBuffer(buf) {
25
25
  }
26
26
 
27
27
  export default function (file, output, options) {
28
- function getRelativeFilePath(file) {
29
- const filePath = path.resolve(file)
30
- const rootPath = options.root ? path.resolve(options.root) : path.dirname(file)
31
- const relativePath = path.relative(rootPath, filePath) || ''
32
- if (process.platform === 'win32') return relativePath.replace(/\\/g, '/')
33
- return relativePath
28
+ function getFilePath(file) {
29
+ return `${options.root ?? '/'}${options.root ? path.basename(file) : path.normalize(file)}`
34
30
  }
35
31
 
36
32
  return new Promise((resolve, reject) => {
@@ -48,7 +44,7 @@ export default function (file, output, options) {
48
44
  }
49
45
  resolve()
50
46
 
51
- const filePath = getRelativeFilePath(file)
47
+ const filePath = getFilePath(file)
52
48
  const data = fs.readFileSync(file)
53
49
  const arrayBuffer = toArrayBuffer(data)
54
50
 
@@ -2,7 +2,7 @@ import THREE from 'three'
2
2
  import isVarName from './isVarName.js'
3
3
 
4
4
  function parse(fileName, gltf, options = {}) {
5
- const url = (fileName.toLowerCase().startsWith('http') ? '' : '/') + fileName
5
+ const url = fileName
6
6
  const animations = gltf.animations
7
7
  const hasAnimations = animations.length > 0
8
8
 
@@ -535,7 +535,11 @@ ${
535
535
 
536
536
  ${options.types && !options.isolated ? 'type $$Props = Props<THREE.Group>' : ''}
537
537
  ${options.types && !options.isolated ? 'type $$Events = Events<THREE.Group>' : ''}
538
- ${options.types && !options.isolated ? 'type $$Slots = Slots<THREE.Group>' : ''}
538
+ ${
539
+ options.types && !options.isolated
540
+ ? 'type $$Slots = Slots<THREE.Group> & { fallback: {}; error: { error: any } }'
541
+ : ''
542
+ }
539
543
 
540
544
  export const ref = new Group()
541
545