@needle-tools/gltf-build-pipeline 1.5.0-alpha.7 → 1.5.0-alpha.8

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
@@ -4,6 +4,9 @@ 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
+ ## [1.5.0-alpha.8] - 2023-05-16
8
+ - fix: issue where updating ktx compressed texture extension also flattened the path
9
+
7
10
  ## [1.5.0-alpha.7] - 2023-05-16
8
11
  - fix: external resources that are KTX2 compressed are now saved with a `.ktx2` extension
9
12
  - change: toktx now uses compression "auto" mode to select uastc or etc1s
@@ -8,6 +8,7 @@ import fs from 'fs/promises';
8
8
  import os from 'os';
9
9
  import tmp from 'tmp';
10
10
  import pLimit from 'p-limit';
11
+ import { replaceExtension } from "../utils/fileutils.js";
11
12
  const NUM_CPUS = os.cpus().length || 1; // microsoft/vscode#112122
12
13
  let didLogEnvironmentInfo = false;
13
14
  export class NeedleToktxContext {
@@ -158,7 +159,7 @@ export class NeedleToktxContext {
158
159
  // If this is a texture that was loaded from a file, we need to update the URI
159
160
  if (texture.getURI()) {
160
161
  const oldUri = texture.getURI();
161
- const newUri = FileUtils.basename(oldUri) + '.ktx2';
162
+ const newUri = replaceExtension(oldUri, 'ktx2');
162
163
  texture.setURI(newUri);
163
164
  }
164
165
  return true;
@@ -1,2 +1,3 @@
1
1
  export declare type GLTFFileCallback = (file: string) => void | Promise<void>;
2
2
  export declare function foreachGLTF(args: string | string[], callback: GLTFFileCallback): Promise<void>;
3
+ export declare function replaceExtension(filepath: string, newExtension: string): string;
@@ -113,3 +113,8 @@ async function testEntry(entry, callback, context) {
113
113
  }
114
114
  }
115
115
  }
116
+ export function replaceExtension(filepath, newExtension) {
117
+ const parts = filepath.split(".");
118
+ parts.pop();
119
+ return parts.join(".") + "." + newExtension;
120
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/gltf-build-pipeline",
3
- "version": "1.5.0-alpha.7",
3
+ "version": "1.5.0-alpha.8",
4
4
  "description": "Pipeline and tools for optimizing gltf files using gltf-transform and compression settings within glTF extensions",
5
5
  "main": "index.mjs",
6
6
  "type": "module",