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