minerender 2.1.0-alpha.17 → 2.1.0-alpha.18

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.
@@ -173,6 +173,7 @@ declare class AssetKey extends BasicAssetKey {
173
173
  rootType: "assets" | "data" | string;
174
174
  extension: ".json" | ".png" | string;
175
175
  root?: string | undefined;
176
+ readonly isAssetKey: true;
176
177
  constructor(namespace: string, path: string, assetType?: AssetType | undefined, type?: string | undefined, rootType?: "assets" | "data" | string, extension?: ".json" | ".png" | string, root?: string | undefined);
177
178
  static parse(assetType: AssetType, str: string, origin?: AssetKey): AssetKey;
178
179
  toString(): string;
@@ -173,6 +173,7 @@ declare class AssetKey extends BasicAssetKey {
173
173
  rootType: "assets" | "data" | string;
174
174
  extension: ".json" | ".png" | string;
175
175
  root?: string | undefined;
176
+ readonly isAssetKey: true;
176
177
  constructor(namespace: string, path: string, assetType?: AssetType | undefined, type?: string | undefined, rootType?: "assets" | "data" | string, extension?: ".json" | ".png" | string, root?: string | undefined);
177
178
  static parse(assetType: AssetType, str: string, origin?: AssetKey): AssetKey;
178
179
  toString(): string;
@@ -1279,6 +1279,7 @@ var AssetKey = class _AssetKey extends BasicAssetKey {
1279
1279
  this.rootType = rootType;
1280
1280
  this.extension = extension;
1281
1281
  this.root = root;
1282
+ this.isAssetKey = true;
1282
1283
  }
1283
1284
  static parse(assetType, str, origin) {
1284
1285
  let namespace = origin?.namespace || DEFAULT_NAMESPACE;
@@ -1294,7 +1295,10 @@ var AssetKey = class _AssetKey extends BasicAssetKey {
1294
1295
  split.shift();
1295
1296
  }
1296
1297
  let path = split.join("/");
1297
- let extension = assetType === "textures" ? ".png" : origin?.assetType || ".json";
1298
+ const extension = assetType === "textures" ? ".png" : origin?.extension ?? ".json";
1299
+ if (extension && path.endsWith(extension)) {
1300
+ path = path.slice(0, -extension.length);
1301
+ }
1298
1302
  return new _AssetKey(namespace, path, assetType, type, "assets", extension, origin?.root);
1299
1303
  }
1300
1304
  toString() {
@@ -1324,10 +1328,10 @@ var AssetKey = class _AssetKey extends BasicAssetKey {
1324
1328
  }
1325
1329
  };
1326
1330
  function isBasicAssetKey(obj) {
1327
- return "namespace" in obj && "path" in obj;
1331
+ return obj !== null && typeof obj === "object" && typeof obj.namespace === "string" && typeof obj.path === "string";
1328
1332
  }
1329
1333
  function isAssetKey(obj) {
1330
- return isBasicAssetKey(obj) && "parse" in obj;
1334
+ return isBasicAssetKey(obj) && obj.isAssetKey === true;
1331
1335
  }
1332
1336
 
1333
1337
  // src/model/ModelMerger.ts