Skip to content

Commit c31975a

Browse files
committed
refactor: centralize external dependencies in deps.js and update import paths
1 parent 4cc0280 commit c31975a

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

webxr/examples/vr-router-example.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ <h2>Loading WebXR Experience</h2>
171171
"three": "https://unpkg.com/[email protected]/build/three.module.js",
172172
"three/examples/jsm/webxr/VRButton.js": "https://unpkg.com/[email protected]/examples/jsm/webxr/VRButton.js",
173173
"three/examples/jsm/webxr/XRControllerModelFactory.js": "https://unpkg.com/[email protected]/examples/jsm/webxr/XRControllerModelFactory.js",
174-
"@profullstack/spa-router": "https://esm.sh/@profullstack/[email protected]"
174+
"@profullstack/spa-router": "/webxr/js/deps.js"
175175
}
176176
}
177177
</script>

webxr/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ <h1>WebXR Experience</h1>
161161
"three": "https://unpkg.com/[email protected]/build/three.module.js",
162162
"three/examples/jsm/webxr/VRButton.js": "https://unpkg.com/[email protected]/examples/jsm/webxr/VRButton.js",
163163
"three/examples/jsm/webxr/XRControllerModelFactory.js": "https://unpkg.com/[email protected]/examples/jsm/webxr/XRControllerModelFactory.js",
164-
"@profullstack/spa-router": "https://esm.sh/@profullstack/[email protected]"
164+
"@profullstack/spa-router": "/webxr/js/deps.js"
165165
}
166166
}
167167
</script>

webxr/js/deps.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* Dependencies module for WebXR
3+
*
4+
* This file centralizes all external ESM dependencies to make them easier to manage
5+
* and update. It also allows for potential future bundling or local hosting of these
6+
* dependencies if needed.
7+
*/
8+
9+
// Import and re-export spa-router
10+
import { Router } from 'https://esm.sh/@profullstack/[email protected]';
11+
import * as transitions from 'https://esm.sh/@profullstack/[email protected]/src/transitions.js';
12+
import * as renderer from 'https://esm.sh/@profullstack/[email protected]/src/renderer.js';
13+
import * as componentLoader from 'https://esm.sh/@profullstack/[email protected]/src/component-loader.js';
14+
export { Router, transitions, renderer, componentLoader };
15+
16+
// Import and re-export enhanced-router
17+
export * as enhancedRouter from 'https://esm.sh/@profullstack/[email protected]';
18+
19+
// Import and re-export state-manager
20+
export { StoreConnector, createStore } from 'https://esm.sh/@profullstack/[email protected]';

webxr/src/ui/vr-router.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* allowing for different "scenes" or "views" within the VR environment.
66
*/
77

8-
import { Router as SPARouter } from '@profullstack/spa-router';
8+
import { Router } from '/webxr/js/deps.js';
99

1010
export class VRRouter extends HTMLElement {
1111
constructor() {
@@ -69,7 +69,7 @@ export class VRRouter extends HTMLElement {
6969
};
7070

7171
// Initialize the router
72-
this.router = new SPARouter(routerConfig);
72+
this.router = new Router(routerConfig);
7373

7474
// Navigate to the initial route
7575
const initialRoute = this.getAttribute('initial-route') || '/';

0 commit comments

Comments
 (0)