@webspatial/platform-visionos 0.1.8 → 0.1.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webspatial/platform-visionos",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "Used to publish WebSpatial projects to Apple Vision Pro",
5
5
  "type": "commonjs",
6
6
  "engines": {
@@ -66,16 +66,24 @@ struct PWAManager: Codable {
66
66
 
67
67
  func getLocalResourceURL(url: String) -> String {
68
68
  let path = String(url.split(separator: "file://").first!.split(separator: "?").first!)
69
- let root = String(url.split(separator: "?").first!)
70
- let params = String(url.split(separator: "file://" + root).first!)
71
- var resource: String = Bundle.main.url(forResource: path, withExtension: "", subdirectory: "")?.absoluteString ?? ""
69
+ let newUrl = URL(string: url)
70
+ let fileManager = FileManager.default
71
+ if fileManager.fileExists(atPath: newUrl!.path) {
72
+ return url
73
+ }
74
+ var resource: String = Bundle.main.url(forResource: newUrl?.path, withExtension: "", subdirectory: "")?.absoluteString ?? ""
72
75
  if resource == "" {
73
76
  resource = Bundle.main.url(forResource: "static-web" + path, withExtension: "", subdirectory: "")?.absoluteString ?? ""
74
77
  }
75
78
  if resource == "" {
76
79
  return url
77
80
  }
78
- resource += "?" + params
81
+ if newUrl?.query() != nil {
82
+ resource += "?" + (newUrl?.query())!
83
+ }
84
+ if newUrl?.fragment() != nil {
85
+ resource += "#" + (newUrl?.fragment())!
86
+ }
79
87
  return resource
80
88
  }
81
89
  }