mage-engine 3.23.27 → 3.23.28

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.
Files changed (2) hide show
  1. package/dist/mage.js +77 -20
  2. package/package.json +1 -1
package/dist/mage.js CHANGED
@@ -55792,10 +55792,10 @@ var TAGS = {
55792
55792
  var isLevelName = function isLevelName(level) {
55793
55793
  return level.startsWith(DIVIDER);
55794
55794
  };/**
55795
- * Checks if a path is an absolute URL.
55795
+ * Checks if a path is an absolute URL (with protocol).
55796
55796
  */
55797
55797
 
55798
- var isURL$2 = function isURL(path) {
55798
+ var isAbsoluteURL$3 = function isAbsoluteURL(path) {
55799
55799
  try {
55800
55800
  new URL(path);
55801
55801
  return true;
@@ -55804,12 +55804,22 @@ var isURL$2 = function isURL(path) {
55804
55804
  }
55805
55805
  };
55806
55806
  /**
55807
- * Resolves an asset path to a full URL using MAGE_ASSETS_BASE_URL.
55807
+ * Checks if a path already contains the assets API path.
55808
+ * This prevents double-prepending when a full path is passed.
55808
55809
  */
55809
55810
 
55810
55811
 
55811
- var resolveAssetPath$2 = function resolveAssetPath(path) {
55812
- if (isURL$2(path)) {
55812
+ var isAlreadyResolved$2 = function isAlreadyResolved(path) {
55813
+ return path && (isAbsoluteURL$3(path) || path.includes("/api/assets/"));
55814
+ };
55815
+ /**
55816
+ * Resolves a single asset path to a full URL using MAGE_ASSETS_BASE_URL.
55817
+ */
55818
+
55819
+
55820
+ var resolveSinglePath = function resolveSinglePath(path) {
55821
+ // If already a full URL or already contains the API path, return as-is
55822
+ if (isAlreadyResolved$2(path)) {
55813
55823
  return path;
55814
55824
  }
55815
55825
 
@@ -55822,6 +55832,21 @@ var resolveAssetPath$2 = function resolveAssetPath(path) {
55822
55832
 
55823
55833
  return path;
55824
55834
  };
55835
+ /**
55836
+ * Resolves asset path(s) to full URL(s) using MAGE_ASSETS_BASE_URL.
55837
+ * Handles both single paths (string) and arrays of paths (for cube textures).
55838
+ */
55839
+
55840
+
55841
+ var resolveAssetPath$2 = function resolveAssetPath(pathOrPaths) {
55842
+ if (Array.isArray(pathOrPaths)) {
55843
+ return pathOrPaths.map(function (p) {
55844
+ return resolveSinglePath(p);
55845
+ });
55846
+ }
55847
+
55848
+ return resolveSinglePath(pathOrPaths);
55849
+ };
55825
55850
 
55826
55851
  var Images = /*#__PURE__*/function () {
55827
55852
  function Images() {
@@ -58400,7 +58425,7 @@ function applyMiddleware() {
58400
58425
 
58401
58426
  var thunk = createThunkMiddleware();
58402
58427
  thunk.withExtraArgument = createThunkMiddleware;var name = "mage-engine";
58403
- var version$1 = "3.23.27";
58428
+ var version$1 = "3.23.28";
58404
58429
  var description = "A WebGL Javascript Game Engine, built on top of THREE.js and many other libraries.";
58405
58430
  var main = "dist/mage.js";
58406
58431
  var author$1 = {
@@ -70327,12 +70352,10 @@ var AUDIO_RAMPS = {
70327
70352
  EXPONENTIAL: "EXPONENTIAL"
70328
70353
  };
70329
70354
  /**
70330
- * Checks if a path is an absolute URL.
70331
- * @param {string} path - The path to check
70332
- * @returns {boolean} - True if path is an absolute URL
70355
+ * Checks if a path is an absolute URL (with protocol).
70333
70356
  */
70334
70357
 
70335
- var isURL$1 = function isURL(path) {
70358
+ var isAbsoluteURL$2 = function isAbsoluteURL(path) {
70336
70359
  try {
70337
70360
  new URL(path);
70338
70361
  return true;
@@ -70340,9 +70363,18 @@ var isURL$1 = function isURL(path) {
70340
70363
  return false;
70341
70364
  }
70342
70365
  };
70366
+ /**
70367
+ * Checks if a path already contains the assets API path.
70368
+ * This prevents double-prepending when a full path is passed.
70369
+ */
70370
+
70371
+
70372
+ var isAlreadyResolved$1 = function isAlreadyResolved(path) {
70373
+ return path && (isAbsoluteURL$2(path) || path.includes("/api/assets/"));
70374
+ };
70343
70375
  /**
70344
70376
  * Resolves an asset path to a full URL.
70345
- * If path is already an absolute URL, returns it as-is.
70377
+ * If path is already an absolute URL or contains the API path, returns it as-is.
70346
70378
  * If path is relative and MAGE_ASSETS_BASE_URL is set, prepends the base URL.
70347
70379
  * @param {string} path - The asset path (relative or absolute)
70348
70380
  * @returns {string} - The resolved full URL
@@ -70350,8 +70382,8 @@ var isURL$1 = function isURL(path) {
70350
70382
 
70351
70383
 
70352
70384
  var resolveAssetPath$1 = function resolveAssetPath(path) {
70353
- // If it's already an absolute URL, use it as-is
70354
- if (isURL$1(path)) {
70385
+ // If already a full URL or already contains the API path, return as-is
70386
+ if (isAlreadyResolved$1(path)) {
70355
70387
  return path;
70356
70388
  } // If MAGE_ASSETS_BASE_URL is set, prepend it to the relative path
70357
70389
 
@@ -76265,7 +76297,7 @@ var NURBSCurve = /*#__PURE__*/function (_Curve) {
76265
76297
  }]);
76266
76298
 
76267
76299
  return NURBSCurve;
76268
- }(Curve);var isAbsoluteURL = function isAbsoluteURL(url) {
76300
+ }(Curve);var isAbsoluteURL$1 = function isAbsoluteURL(url) {
76269
76301
  return /^(?:\w+:)\/\//.test(url);
76270
76302
  };/**
76271
76303
  * Loader loads FBX file and generates Group representing FBX scene.
@@ -76361,7 +76393,7 @@ var buildFBXLoader = function buildFBXLoader() {
76361
76393
  var texturePath = LoaderUtils.extractUrlBase(texture);
76362
76394
  var textureLoader = new TextureLoader(this.manager).setCrossOrigin(this.crossOrigin);
76363
76395
 
76364
- if (!isAbsoluteURL(texture)) {
76396
+ if (!isAbsoluteURL$1(texture)) {
76365
76397
  textureLoader.setPath(this.resourcePath || texturePath || path);
76366
76398
  }
76367
76399
 
@@ -80902,18 +80934,43 @@ var DEFAULTbuildObjectLoader = function DEFAULTbuildObjectLoader() {
80902
80934
  };
80903
80935
 
80904
80936
  var loaders = (_loaders = {}, _defineProperty$1(_loaders, EXTENSIONS.JSON, DEFAULTbuildObjectLoader), _defineProperty$1(_loaders, EXTENSIONS.GLB, buildGLTFLoader), _defineProperty$1(_loaders, EXTENSIONS.GLTF, buildGLTFLoader), _defineProperty$1(_loaders, EXTENSIONS.FBX, buildFBXLoader), _defineProperty$1(_loaders, EXTENSIONS.OBJ, buildOBJMTLLoader), _loaders);
80937
+ /**
80938
+ * Checks if a path is an absolute URL (with protocol).
80939
+ */
80940
+
80941
+ var isAbsoluteURL = function isAbsoluteURL(path) {
80942
+ try {
80943
+ new URL(path);
80944
+ return true;
80945
+ } catch (_) {
80946
+ return false;
80947
+ }
80948
+ };
80949
+ /**
80950
+ * Parses a URL and returns the URL object, or false if not a valid URL.
80951
+ * Used by extractExtension to get the pathname.
80952
+ */
80953
+
80905
80954
 
80906
80955
  var isURL = function isURL(path) {
80907
80956
  try {
80908
- var url = new URL(path);
80909
- return url;
80957
+ return new URL(path);
80910
80958
  } catch (_) {
80911
80959
  return false;
80912
80960
  }
80913
80961
  };
80962
+ /**
80963
+ * Checks if a path already contains the assets API path.
80964
+ * This prevents double-prepending when a full path is passed.
80965
+ */
80966
+
80967
+
80968
+ var isAlreadyResolved = function isAlreadyResolved(path) {
80969
+ return path && (isAbsoluteURL(path) || path.includes("/api/assets/"));
80970
+ };
80914
80971
  /**
80915
80972
  * Resolves an asset path to a full URL.
80916
- * If path is already an absolute URL, returns it as-is.
80973
+ * If path is already an absolute URL or contains the API path, returns it as-is.
80917
80974
  * If path is relative and MAGE_ASSETS_BASE_URL is set, prepends the base URL.
80918
80975
  * @param {string} path - The asset path (relative or absolute)
80919
80976
  * @returns {string} - The resolved full URL
@@ -80921,8 +80978,8 @@ var isURL = function isURL(path) {
80921
80978
 
80922
80979
 
80923
80980
  var resolveAssetPath = function resolveAssetPath(path) {
80924
- // If it's already an absolute URL, use it as-is
80925
- if (isURL(path)) {
80981
+ // If already a full URL or already contains the API path, return as-is
80982
+ if (isAlreadyResolved(path)) {
80926
80983
  return path;
80927
80984
  } // If MAGE_ASSETS_BASE_URL is set, prepend it to the relative path
80928
80985
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mage-engine",
3
- "version": "3.23.27",
3
+ "version": "3.23.28",
4
4
  "description": "A WebGL Javascript Game Engine, built on top of THREE.js and many other libraries.",
5
5
  "main": "dist/mage.js",
6
6
  "author": {