@webspatial/builder 0.1.17 → 0.1.19

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.
@@ -27,7 +27,7 @@ function configId(manifestJson, bundleId) {
27
27
  }
28
28
  function configStartUrl(manifestJson, base, manifestUrl, isNet) {
29
29
  var _a;
30
- let start_url = (_a = manifestJson.start_url) !== null && _a !== void 0 ? _a : '/';
30
+ let start_url = (_a = manifestJson.start_url) !== null && _a !== void 0 ? _a : '/index.html';
31
31
  const isStartUrl = (0, validate_1.validateURL)(start_url);
32
32
  const hasBase = base.length > 0;
33
33
  if (hasBase) {
@@ -86,7 +86,7 @@ PWAGenerator.defaultBundleId = 'com.webspatial.test';
86
86
  PWAGenerator.defaultManifestJson = {
87
87
  name: 'WebSpatialTest',
88
88
  display: 'minimal-ui',
89
- start_url: '/',
89
+ start_url: '/index.html',
90
90
  scope: '/',
91
91
  };
92
92
  PWAGenerator.useDefaultManifestJson = false;
@@ -72,7 +72,7 @@ class ResourceManager {
72
72
  let tempProjectDir = (0, path_1.join)(tempPlatformDir, './project');
73
73
  let temBuildDir = (0, path_1.join)(tempPlatformDir, './build');
74
74
  let temExportDir = (0, path_1.join)(tempPlatformDir, './export');
75
- let temTestDir = (0, path_1.join)(tempPlatformDir, './test');
75
+ let temTestDir = `./node_modules/.webspatial-builder-temp/platform-${usePlatform}/test`;
76
76
  if (!fs.existsSync(tempDir)) {
77
77
  fs.mkdirSync(tempDir);
78
78
  }
@@ -88,6 +88,12 @@ class ResourceManager {
88
88
  if (!fs.existsSync(temExportDir)) {
89
89
  fs.mkdirSync(temExportDir);
90
90
  }
91
+ if (!fs.existsSync('./node_modules/.webspatial-builder-temp')) {
92
+ fs.mkdirSync('./node_modules/.webspatial-builder-temp');
93
+ }
94
+ if (!fs.existsSync(`./node_modules/.webspatial-builder-temp/platform-${usePlatform}`)) {
95
+ fs.mkdirSync(`./node_modules/.webspatial-builder-temp/platform-${usePlatform}`);
96
+ }
91
97
  if (!fs.existsSync(temTestDir)) {
92
98
  fs.mkdirSync(temTestDir);
93
99
  }
@@ -1 +1 @@
1
- export declare const manifestSwiftTemplate = "\nimport Foundation\n\nvar pwaManager = PWAManager()\n\nstruct PWAManager: Codable {\n var isLocal: Bool = false\n var start_url: String = \"START_URL\"\n var scope: String = \"SCOPE\"\n var id: String = \"AppID\"\n\n var name: String = \"AppName\"\n var short_name: String = \"name\"\n var description: String = \"Description\"\n\n var display: PWADisplayMode = .minimal\n var display_override: [PWADisplayMode] = []\n var protocol_handlers: [PWAProtocol] = [PWAProtocol(protocolValue: \"\", url: \"\")]\n var mainScene: WindowContainerOptions = .init(\n defaultSize: .init(\n width: SceneWidth,\n height: SceneHeight\n ),\n resizability: SceneResizability\n )\n var useMainScene: Bool = USE_MAIN_SCENE\n\n mutating func _init() {\n let urlType = start_url.split(separator: \"://\").first\n if !(urlType == \"http\" || urlType == \"https\") {\n if scope == \"\" || scope == \"/\" {\n scope = \"./\"\n }\n let startUrl = Bundle.main.url(forResource: start_url, withExtension: \"\", subdirectory: \"\")\n start_url = startUrl!.absoluteString\n scope = URL(string: scope, relativeTo: startUrl)!.absoluteString\n isLocal = true\n }\n\n if display_override.count > 0 {\n display = display_override[0]\n }\n\n for i in 0 ... protocol_handlers.count - 1 {\n let item = protocol_handlers[i]\n protocol_handlers[i].updateUrl(scope + item.url)\n }\n }\n\n func checkInScope(url: String) -> Bool {\n return url.starts(with: scope)\n }\n\n // web+spatial://test\n func checkInDeeplink(url: String) -> String {\n var linkUrl: String = url\n for item in protocol_handlers {\n if linkUrl.starts(with: item.protocolValue) {\n let queryString: String = linkUrl.replacingOccurrences(of: item.protocolValue, with: \"\").addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!\n linkUrl = item.url.replacingOccurrences(of: \"%s\", with: item.protocolValue + queryString)\n }\n }\n logger.debug(linkUrl)\n return linkUrl\n }\n\n func getLocalResourceURL(url: String) -> String {\n let path = String(url.split(separator: \"file://\").first!.split(separator: \"?\").first!)\n let newUrl = URL(string: url)\n let fileManager = FileManager.default\n if fileManager.fileExists(atPath: newUrl!.path) {\n return url\n }\n var resource: String = Bundle.main.url(forResource: newUrl?.path, withExtension: \"\", subdirectory: \"\")?.absoluteString ?? \"\"\n if resource == \"\" {\n resource = Bundle.main.url(forResource: \"static-web\" + path, withExtension: \"\", subdirectory: \"\")?.absoluteString ?? \"\"\n }\n if resource == \"\" {\n return url\n }\n if newUrl?.query() != nil {\n resource += \"?\" + (newUrl?.query())!\n }\n if newUrl?.fragment() != nil {\n resource += \"#\" + (newUrl?.fragment())!\n }\n return resource\n }\n}\n\nenum PWADisplayMode: Codable {\n case minimal\n case standalone\n case fullscreen\n}\n\nstruct PWAProtocol: Codable {\n var protocolValue: String = \"\"\n var url: String = \"\"\n\n mutating func updateUrl(_ str: String) {\n url = str\n }\n}\n\n";
1
+ export declare const manifestSwiftTemplate = "\nimport Foundation\n\nvar pwaManager = PWAManager()\n\nstruct PWAManager: Codable {\n var isLocal: Bool = false\n var start_url: String = \"START_URL\"\n var scope: String = \"SCOPE\"\n var id: String = \"AppID\"\n\n var name: String = \"AppName\"\n var short_name: String = \"name\"\n var description: String = \"Description\"\n\n var display: PWADisplayMode = .minimal\n var display_override: [PWADisplayMode] = []\n var protocol_handlers: [PWAProtocol] = [PWAProtocol(protocolValue: \"\", url: \"\")]\n var mainScene: WindowContainerOptions = .init(\n defaultSize: .init(\n width: SceneWidth,\n height: SceneHeight\n ),\n resizability: SceneResizability\n )\n var useMainScene: Bool = USE_MAIN_SCENE\n\n mutating func _init() {\n let urlType = start_url.split(separator: \"://\").first\n if !(urlType == \"http\" || urlType == \"https\") {\n if scope == \"\" || scope == \"/\" {\n scope = \"./\"\n }\n let startUrl = Bundle.main.url(forResource: start_url, withExtension: \"\", subdirectory: \"\")\n start_url = startUrl!.absoluteString\n scope = URL(string: (scope.starts(with: \"/\") ? \"..\" : \"../\") + scope, relativeTo: startUrl)!.absoluteString\n isLocal = true\n }\n\n if display_override.count > 0 {\n display = display_override[0]\n }\n\n for i in 0 ... protocol_handlers.count - 1 {\n let item = protocol_handlers[i]\n protocol_handlers[i].updateUrl(scope + item.url)\n }\n }\n\n func checkInScope(url: String) -> Bool {\n return url.starts(with: scope)\n }\n\n // web+spatial://test\n func checkInDeeplink(url: String) -> String {\n var linkUrl: String = url\n for item in protocol_handlers {\n if linkUrl.starts(with: item.protocolValue) {\n let queryString: String = linkUrl.replacingOccurrences(of: item.protocolValue, with: \"\").addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!\n linkUrl = item.url.replacingOccurrences(of: \"%s\", with: item.protocolValue + queryString)\n }\n }\n logger.debug(linkUrl)\n return linkUrl\n }\n\n func getLocalResourceURL(url: String) -> String {\n let path = String(url.split(separator: \"file://\").first!.split(separator: \"?\").first!)\n let newUrl = URL(string: url)\n let fileManager = FileManager.default\n if fileManager.fileExists(atPath: newUrl!.path) {\n return url\n }\n var resource: String = Bundle.main.url(forResource: newUrl?.path, withExtension: \"\", subdirectory: \"\")?.absoluteString ?? \"\"\n if resource == \"\" {\n resource = Bundle.main.url(forResource: \"static-web\" + path, withExtension: \"\", subdirectory: \"\")?.absoluteString ?? \"\"\n }\n if resource == \"\" {\n return url\n }\n if newUrl?.query() != nil {\n resource += \"?\" + (newUrl?.query())!\n }\n if newUrl?.fragment() != nil {\n resource += \"#\" + (newUrl?.fragment())!\n }\n return resource\n }\n}\n\nenum PWADisplayMode: Codable {\n case minimal\n case standalone\n case fullscreen\n}\n\nstruct PWAProtocol: Codable {\n var protocolValue: String = \"\"\n var url: String = \"\"\n\n mutating func updateUrl(_ str: String) {\n url = str\n }\n}\n\n";
@@ -36,7 +36,7 @@ struct PWAManager: Codable {
36
36
  }
37
37
  let startUrl = Bundle.main.url(forResource: start_url, withExtension: "", subdirectory: "")
38
38
  start_url = startUrl!.absoluteString
39
- scope = URL(string: scope, relativeTo: startUrl)!.absoluteString
39
+ scope = URL(string: (scope.starts(with: "/") ? ".." : "../") + scope, relativeTo: startUrl)!.absoluteString
40
40
  isLocal = true
41
41
  }
42
42
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webspatial/builder",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "description": "Client CLI tool to Generate XRApp project for Apple Vision Pro",
5
5
  "type": "commonjs",
6
6
  "engines": {
@@ -11,7 +11,8 @@
11
11
  },
12
12
  "repository": {
13
13
  "type": "git",
14
- "url": ""
14
+ "url": "git+https://github.com/webspatial/webspatial-sdk.git",
15
+ "directory": "packages/cli"
15
16
  },
16
17
  "files": [
17
18
  "dist/lib",
@@ -39,7 +40,7 @@
39
40
  "sharp": "^0.33.5",
40
41
  "valid-url": "^1.0.9",
41
42
  "xcode": "^3.0.1",
42
- "@webspatial/platform-visionos": "^0.1.17"
43
+ "@webspatial/platform-visionos": "^0.1.19"
43
44
  },
44
45
  "devDependencies": {
45
46
  "@rollup/plugin-terser": "^0.4.3",