@directivegames/genesys.js 3.1.24 → 3.1.25
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/dist/games/animation-demo.d.ts +1 -1
- package/dist/games/animation-demo.js +2 -2
- package/dist/games/animation-retarget-demo.d.ts +1 -1
- package/dist/games/animation-retarget-demo.js +3 -3
- package/dist/games/behavior-tree-demo.d.ts +1 -1
- package/dist/games/behavior-tree-demo.js +2 -2
- package/dist/games/character_animation.d.ts +1 -1
- package/dist/games/character_animation.js +2 -2
- package/dist/games/collision-demo.d.ts +1 -1
- package/dist/games/collision-demo.js +2 -2
- package/dist/games/deprecated/advanced-grid-demo.d.ts +1 -1
- package/dist/games/deprecated/advanced-grid-demo.js +2 -2
- package/dist/games/deprecated/airplane-demo.d.ts +1 -1
- package/dist/games/deprecated/airplane-demo.js +2 -2
- package/dist/games/deprecated/character-controller.d.ts +1 -1
- package/dist/games/deprecated/character-controller.js +2 -2
- package/dist/games/deprecated/chase-game.d.ts +1 -1
- package/dist/games/deprecated/chase-game.js +2 -2
- package/dist/games/deprecated/collision-config.d.ts +1 -1
- package/dist/games/deprecated/collision-config.js +2 -2
- package/dist/games/deprecated/door-demo.d.ts +1 -1
- package/dist/games/deprecated/door-demo.js +2 -2
- package/dist/games/deprecated/fps-demo.d.ts +1 -1
- package/dist/games/deprecated/fps-demo.js +2 -2
- package/dist/games/deprecated/fps-shotgun-demo.d.ts +1 -1
- package/dist/games/deprecated/fps-shotgun-demo.js +2 -2
- package/dist/games/deprecated/lightmapping-demo.d.ts +1 -1
- package/dist/games/deprecated/lightmapping-demo.js +2 -2
- package/dist/games/deprecated/lights-demo.d.ts +1 -1
- package/dist/games/deprecated/lights-demo.js +2 -2
- package/dist/games/deprecated/matcap-demo.d.ts +1 -1
- package/dist/games/deprecated/matcap-demo.js +2 -2
- package/dist/games/deprecated/material-demo-2.d.ts +1 -1
- package/dist/games/deprecated/material-demo-2.js +2 -2
- package/dist/games/deprecated/material-demo.d.ts +1 -1
- package/dist/games/deprecated/material-demo.js +2 -2
- package/dist/games/deprecated/memory-leak-test.d.ts +1 -1
- package/dist/games/deprecated/memory-leak-test.js +2 -2
- package/dist/games/deprecated/model-stress-test.d.ts +1 -1
- package/dist/games/deprecated/model-stress-test.js +2 -2
- package/dist/games/deprecated/multiplayer-demo.d.ts +1 -1
- package/dist/games/deprecated/multiplayer-demo.js +2 -2
- package/dist/games/deprecated/physics-demo.d.ts +1 -1
- package/dist/games/deprecated/physics-demo.js +2 -2
- package/dist/games/deprecated/shadow-demo.d.ts +1 -1
- package/dist/games/deprecated/shadow-demo.js +2 -2
- package/dist/games/deprecated/shooting-demo.d.ts +1 -1
- package/dist/games/deprecated/shooting-demo.js +2 -2
- package/dist/games/deprecated/skybox-demo.d.ts +1 -1
- package/dist/games/deprecated/skybox-demo.js +2 -2
- package/dist/games/deprecated/sound-demo.d.ts +1 -1
- package/dist/games/deprecated/sound-demo.js +2 -2
- package/dist/games/deprecated/timer-demo.d.ts +1 -1
- package/dist/games/deprecated/timer-demo.js +2 -2
- package/dist/games/deprecated/voxel-demo.d.ts +1 -1
- package/dist/games/deprecated/voxel-demo.js +2 -2
- package/dist/games/deprecated/world-commands.d.ts +1 -1
- package/dist/games/deprecated/world-commands.js +2 -2
- package/dist/games/deprecated/world-loading.d.ts +1 -1
- package/dist/games/deprecated/world-loading.js +2 -2
- package/dist/games/examples/fps-advanced/enemies.d.ts +1 -1
- package/dist/games/examples/fps-advanced/enemies.js +2 -2
- package/dist/games/examples/fps-advanced/game-mode.d.ts +1 -1
- package/dist/games/examples/fps-advanced/game-mode.js +2 -2
- package/dist/games/examples/fps-advanced/game.d.ts +1 -1
- package/dist/games/examples/fps-advanced/game.js +2 -2
- package/dist/games/examples/fps-advanced/pickups.d.ts +1 -1
- package/dist/games/examples/fps-advanced/pickups.js +2 -2
- package/dist/games/examples/fps-advanced/player.d.ts +1 -1
- package/dist/games/examples/fps-advanced/player.js +2 -2
- package/dist/games/examples/fps-advanced/ui/endgame-ui.d.ts +1 -1
- package/dist/games/examples/fps-advanced/ui/endgame-ui.js +2 -2
- package/dist/games/examples/fps-advanced/ui/menu-ui.d.ts +1 -1
- package/dist/games/examples/fps-advanced/ui/menu-ui.js +2 -2
- package/dist/games/examples/fps-advanced/ui/weapon-hud.d.ts +1 -1
- package/dist/games/examples/fps-advanced/weapons.d.ts +1 -1
- package/dist/games/examples/fps-advanced/weapons.js +2 -2
- package/dist/games/examples/plugin-demo/game.d.ts +1 -1
- package/dist/games/examples/plugin-demo/game.js +3 -3
- package/dist/games/examples/plugin-demo/plugins/dynamic-lighting.d.ts +1 -1
- package/dist/games/examples/plugin-demo/plugins/dynamic-lighting.js +2 -2
- package/dist/games/examples/plugin-demo/plugins/instanced-forest.d.ts +1 -1
- package/dist/games/examples/plugin-demo/plugins/instanced-forest.js +2 -2
- package/dist/games/examples/plugin-demo/plugins/particle-fountain.d.ts +1 -1
- package/dist/games/examples/plugin-demo/plugins/particle-fountain.js +2 -2
- package/dist/games/examples/plugin-demo/plugins/physics-playground.d.ts +1 -1
- package/dist/games/examples/plugin-demo/plugins/physics-playground.js +2 -2
- package/dist/games/examples/plugin-demo/plugins/robot-follower.d.ts +1 -1
- package/dist/games/examples/plugin-demo/plugins/robot-follower.js +2 -2
- package/dist/games/examples/plugin-demo/plugins/scatter-models.d.ts +1 -1
- package/dist/games/examples/plugin-demo/plugins/scatter-models.js +2 -2
- package/dist/games/examples/plugin-demo/plugins/simple-cube.d.ts +1 -1
- package/dist/games/examples/plugin-demo/plugins/simple-cube.js +2 -2
- package/dist/games/examples/plugin-demo/plugins/tic-tac-toe.d.ts +1 -1
- package/dist/games/examples/plugin-demo/plugins/tic-tac-toe.js +2 -2
- package/dist/games/examples/plugin-demo/plugins/wobbling-sphere.d.ts +1 -1
- package/dist/games/examples/plugin-demo/plugins/wobbling-sphere.js +2 -2
- package/dist/games/examples/side-scroller-advanced/game-mode.d.ts +1 -1
- package/dist/games/examples/side-scroller-advanced/game-mode.js +2 -2
- package/dist/games/examples/side-scroller-advanced/game.d.ts +1 -1
- package/dist/games/examples/side-scroller-advanced/game.js +2 -2
- package/dist/games/examples/side-scroller-advanced/level-generator.d.ts +1 -1
- package/dist/games/examples/side-scroller-advanced/level-generator.js +2 -2
- package/dist/games/examples/side-scroller-advanced/pickups.d.ts +1 -1
- package/dist/games/examples/side-scroller-advanced/pickups.js +2 -2
- package/dist/games/examples/side-scroller-advanced/player.d.ts +1 -1
- package/dist/games/examples/side-scroller-advanced/player.js +2 -2
- package/dist/games/examples/side-scroller-advanced/ui/endgame-ui.d.ts +1 -1
- package/dist/games/examples/side-scroller-advanced/ui/endgame-ui.js +2 -2
- package/dist/games/examples/side-scroller-advanced/ui/menu-ui.d.ts +1 -1
- package/dist/games/examples/side-scroller-advanced/ui/menu-ui.js +2 -2
- package/dist/games/examples/vehicle/base-vehicle.d.ts +1 -1
- package/dist/games/examples/vehicle/base-vehicle.js +2 -2
- package/dist/games/examples/vehicle/game.d.ts +1 -1
- package/dist/games/examples/vehicle/game.js +2 -2
- package/dist/games/examples/vehicle/mesh-vehicle.d.ts +1 -1
- package/dist/games/examples/vehicle/mesh-vehicle.js +2 -2
- package/dist/games/examples/vehicle/player.d.ts +1 -1
- package/dist/games/examples/vehicle/player.js +2 -2
- package/dist/games/examples/vehicle/primitive-vehicle.d.ts +1 -1
- package/dist/games/examples/vehicle/primitive-vehicle.js +2 -2
- package/dist/games/examples/vr-game/VRAttachableCube.d.ts +1 -1
- package/dist/games/examples/vr-game/VRAttachableCube.js +2 -2
- package/dist/games/examples/vr-game/VRInteractableCylinder.d.ts +1 -1
- package/dist/games/examples/vr-game/VRInteractableCylinder.js +2 -2
- package/dist/games/examples/vr-game/VRPressableButton.d.ts +1 -1
- package/dist/games/examples/vr-game/VRPressableButton.js +2 -2
- package/dist/games/examples/vr-game/VRProjectileActor.d.ts +1 -1
- package/dist/games/examples/vr-game/VRProjectileActor.js +2 -2
- package/dist/games/examples/vr-game/VRRifleActor.d.ts +1 -1
- package/dist/games/examples/vr-game/VRRifleActor.js +2 -2
- package/dist/games/examples/vr-game/game.d.ts +1 -1
- package/dist/games/examples/vr-game/game.js +2 -2
- package/dist/games/examples/vr-game/scene.d.ts +1 -1
- package/dist/games/examples/vr-game/scene.js +2 -2
- package/dist/games/instanced-mesh-demo.d.ts +1 -1
- package/dist/games/instanced-mesh-demo.js +2 -2
- package/dist/games/manifold-demo.d.ts +1 -1
- package/dist/games/manifold-demo.js +2 -2
- package/dist/games/navigation-demo.d.ts +1 -1
- package/dist/games/navigation-demo.js +2 -2
- package/dist/games/navmesh-primitives-demo.d.ts +1 -1
- package/dist/games/navmesh-primitives-demo.js +2 -2
- package/dist/games/postprocess-demo.d.ts +1 -1
- package/dist/games/postprocess-demo.js +3 -3
- package/dist/games/ragdoll-demo-simple.d.ts +1 -1
- package/dist/games/ragdoll-demo-simple.js +2 -2
- package/dist/games/ragdoll-demo.d.ts +1 -1
- package/dist/games/ragdoll-demo.js +2 -2
- package/dist/games/swipe-tap-demo.d.ts +1 -1
- package/dist/games/swipe-tap-demo.js +2 -2
- package/dist/games/tween-demo.d.ts +1 -1
- package/dist/games/tween-demo.js +2 -2
- package/dist/games/ui-demo.d.ts +1 -1
- package/dist/games/ui-demo.js +2 -2
- package/dist/games/vfx-demo.d.ts +1 -1
- package/dist/games/vfx-demo.js +2 -2
- package/dist/games/vfx-wawa-demo.d.ts +1 -1
- package/dist/games/vfx-wawa-demo.js +2 -2
- package/dist/games/vr-ui-demo-minimal.d.ts +1 -1
- package/dist/games/vr-ui-demo-minimal.js +2 -2
- package/dist/games/vr-ui-demo.d.ts +1 -1
- package/dist/games/vr-ui-demo.js +2 -2
- package/dist/launcher.js +2 -2
- package/dist/scripts/dump-templates.js +2 -2
- package/dist/test/absolute-transform.test.js +2 -2
- package/dist/test/asset-path.test.js +2 -2
- package/dist/test/component.test.js +2 -2
- package/dist/test/construction.test.js +2 -2
- package/dist/test/default-options-validation.test.js +2 -2
- package/dist/test/metadata.test.js +2 -2
- package/dist/test/nodeStorage.d.ts +2 -2
- package/dist/test/nodeStorage.js +3 -3
- package/dist/test/prefab.test.js +2 -2
- package/dist/test/scene-component.test.js +2 -2
- package/dist/test/scene-graph.test.js +2 -2
- package/dist/test/serialization-v1.test.d.ts +1 -1
- package/dist/test/serialization-v1.test.js +3 -3
- package/dist/test/serialization.test.js +2 -2
- package/dist/test/spawn.test.js +2 -2
- package/dist/test/utils.d.ts +1 -1
- package/dist/test/utils.js +2 -2
- package/docs/guides/15-global-audio-manager.md +1 -1
- package/docs/guides/16-ragdoll-physics.md +1 -1
- package/docs/guides/18-lightmapping-system.md +3 -3
- package/docs/guides/19-webxr-virtual-reality.md +1 -1
- package/docs/guides/4-visuals-and-rendering.md +5 -5
- package/docs/guides/6-ai-and-behavior-trees.md +4 -4
- package/games/animation-demo.ts +1 -1
- package/games/animation-retarget-demo.ts +2 -2
- package/games/behavior-tree-demo.ts +1 -1
- package/games/character_animation.ts +1 -1
- package/games/collision-demo.ts +1 -1
- package/games/deprecated/advanced-grid-demo.ts +1 -1
- package/games/deprecated/airplane-demo.ts +1 -1
- package/games/deprecated/character-controller.ts +1 -1
- package/games/deprecated/chase-game.ts +1 -1
- package/games/deprecated/collision-config.ts +1 -1
- package/games/deprecated/door-demo.ts +1 -1
- package/games/deprecated/fps-demo.ts +1 -1
- package/games/deprecated/fps-shotgun-demo.ts +1 -1
- package/games/deprecated/index.ts +25 -25
- package/games/deprecated/lightmapping-demo.ts +1 -1
- package/games/deprecated/lights-demo.ts +1 -1
- package/games/deprecated/matcap-demo.ts +1 -1
- package/games/deprecated/material-demo-2.ts +1 -1
- package/games/deprecated/material-demo.ts +1 -1
- package/games/deprecated/memory-leak-test.ts +1 -1
- package/games/deprecated/model-stress-test.ts +1 -1
- package/games/deprecated/multiplayer-demo.ts +1 -1
- package/games/deprecated/physics-demo.ts +1 -1
- package/games/deprecated/shadow-demo.ts +1 -1
- package/games/deprecated/shooting-demo.ts +1 -1
- package/games/deprecated/skybox-demo.ts +1 -1
- package/games/deprecated/sound-demo.ts +1 -1
- package/games/deprecated/timer-demo.ts +1 -1
- package/games/deprecated/voxel-demo.ts +1 -1
- package/games/deprecated/world-commands.ts +1 -1
- package/games/deprecated/world-loading.ts +1 -1
- package/games/examples/fps-advanced/enemies.ts +1 -1
- package/games/examples/fps-advanced/game-mode.ts +1 -1
- package/games/examples/fps-advanced/game.ts +1 -1
- package/games/examples/fps-advanced/pickups.ts +1 -1
- package/games/examples/fps-advanced/player.ts +1 -1
- package/games/examples/fps-advanced/ui/endgame-ui.ts +1 -1
- package/games/examples/fps-advanced/ui/menu-ui.ts +1 -1
- package/games/examples/fps-advanced/ui/weapon-hud.ts +253 -253
- package/games/examples/fps-advanced/weapons.ts +1 -1
- package/games/examples/index.ts +5 -5
- package/games/examples/plugin-demo/game.ts +2 -2
- package/games/examples/plugin-demo/plugins/dynamic-lighting.ts +1 -1
- package/games/examples/plugin-demo/plugins/instanced-forest.ts +1 -1
- package/games/examples/plugin-demo/plugins/particle-fountain.ts +1 -1
- package/games/examples/plugin-demo/plugins/physics-playground.ts +1 -1
- package/games/examples/plugin-demo/plugins/robot-follower.ts +1 -1
- package/games/examples/plugin-demo/plugins/scatter-models.ts +1 -1
- package/games/examples/plugin-demo/plugins/simple-cube.ts +1 -1
- package/games/examples/plugin-demo/plugins/tic-tac-toe.ts +1 -1
- package/games/examples/plugin-demo/plugins/wobbling-sphere.ts +1 -1
- package/games/examples/side-scroller-advanced/game-mode.ts +1 -1
- package/games/examples/side-scroller-advanced/game.ts +1 -1
- package/games/examples/side-scroller-advanced/level-generator.ts +1 -1
- package/games/examples/side-scroller-advanced/pickups.ts +1 -1
- package/games/examples/side-scroller-advanced/player.ts +1 -1
- package/games/examples/side-scroller-advanced/ui/endgame-ui.ts +1 -1
- package/games/examples/side-scroller-advanced/ui/menu-ui.ts +1 -1
- package/games/examples/vehicle/base-vehicle.ts +1 -1
- package/games/examples/vehicle/game.ts +1 -1
- package/games/examples/vehicle/mesh-vehicle.ts +1 -1
- package/games/examples/vehicle/player.ts +1 -1
- package/games/examples/vehicle/primitive-vehicle.ts +1 -1
- package/games/examples/vr-game/VRAttachableCube.ts +1 -1
- package/games/examples/vr-game/VRInteractableCylinder.ts +1 -1
- package/games/examples/vr-game/VRPressableButton.ts +1 -1
- package/games/examples/vr-game/VRProjectileActor.ts +1 -1
- package/games/examples/vr-game/VRRifleActor.ts +1 -1
- package/games/examples/vr-game/game.ts +1 -1
- package/games/examples/vr-game/scene.ts +1 -1
- package/games/instanced-mesh-demo.ts +1 -1
- package/games/manifold-demo.ts +1 -1
- package/games/navigation-demo.ts +1 -1
- package/games/navmesh-primitives-demo.ts +1 -1
- package/games/postprocess-demo.ts +2 -2
- package/games/ragdoll-demo-simple.ts +1 -1
- package/games/ragdoll-demo.ts +1 -1
- package/games/swipe-tap-demo.ts +1 -1
- package/games/tween-demo.ts +1 -1
- package/games/ui-demo.ts +1 -1
- package/games/vfx-demo.ts +1 -1
- package/games/vfx-wawa-demo.ts +1 -1
- package/games/vr-ui-demo-minimal.ts +1 -1
- package/games/vr-ui-demo.ts +1 -1
- package/package.json +1 -1
- package/scripts/dump-templates.ts +1 -1
- package/src/global.d.ts +11 -11
- package/src/multiplayer/MovementPrediction.ts +202 -202
- package/src/templates/MyActor.ts +1 -1
- package/src/templates/MySceneComponent.ts +1 -1
- package/src/ui/UIResource.ts +20 -20
- package/src/utils/browser-polyfills/module.ts +35 -35
- package/src/utils/browser-polyfills/path.ts +231 -231
package/src/templates/MyActor.ts
CHANGED
package/src/ui/UIResource.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import type { UIManager } from './UIManager.js';
|
|
2
|
-
|
|
3
|
-
export abstract class UIResource {
|
|
4
|
-
protected uiManager: WeakRef<UIManager> | null = null;
|
|
5
|
-
|
|
6
|
-
public registerWithUIManager(uiManager: UIManager): void {
|
|
7
|
-
if (this.uiManager) {
|
|
8
|
-
throw new Error('UIResource already has a UIManager');
|
|
9
|
-
}
|
|
10
|
-
this.uiManager = new WeakRef(uiManager);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
protected unregisterFromUIManager(): void {
|
|
14
|
-
if (!this.uiManager) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
this.uiManager.deref()?.unregisterUIResource(this);
|
|
18
|
-
this.uiManager = null;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
1
|
+
import type { UIManager } from './UIManager.js';
|
|
2
|
+
|
|
3
|
+
export abstract class UIResource {
|
|
4
|
+
protected uiManager: WeakRef<UIManager> | null = null;
|
|
5
|
+
|
|
6
|
+
public registerWithUIManager(uiManager: UIManager): void {
|
|
7
|
+
if (this.uiManager) {
|
|
8
|
+
throw new Error('UIResource already has a UIManager');
|
|
9
|
+
}
|
|
10
|
+
this.uiManager = new WeakRef(uiManager);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
protected unregisterFromUIManager(): void {
|
|
14
|
+
if (!this.uiManager) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
this.uiManager.deref()?.unregisterUIResource(this);
|
|
18
|
+
this.uiManager = null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Browser-compatible polyfill for Node.js module system
|
|
3
|
-
* Provides minimal functionality needed for Genesys.js to work in browsers
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Browser-compatible createRequire implementation
|
|
8
|
-
* This is a minimal implementation that should prevent errors when manifold-3d tries to use it
|
|
9
|
-
*/
|
|
10
|
-
function createRequire(filename: string) {
|
|
11
|
-
// In browser context, we return a mock require function
|
|
12
|
-
// This should prevent the manifold-3d library from failing
|
|
13
|
-
function mockRequire(id: string) {
|
|
14
|
-
// For now, just throw an error with helpful message
|
|
15
|
-
throw new Error(`Cannot require '${id}' in browser context. Module ID: ${id}, from: ${filename}`);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Add properties that a real require function might have
|
|
19
|
-
mockRequire.resolve = (id: string) => {
|
|
20
|
-
throw new Error(`Cannot resolve '${id}' in browser context`);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
mockRequire.cache = {};
|
|
24
|
-
mockRequire.extensions = {};
|
|
25
|
-
mockRequire.main = undefined;
|
|
26
|
-
|
|
27
|
-
return mockRequire;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Export as both default and named exports for compatibility
|
|
31
|
-
const moduleExports = {
|
|
32
|
-
createRequire
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export default moduleExports;
|
|
1
|
+
/**
|
|
2
|
+
* Browser-compatible polyfill for Node.js module system
|
|
3
|
+
* Provides minimal functionality needed for Genesys.js to work in browsers
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Browser-compatible createRequire implementation
|
|
8
|
+
* This is a minimal implementation that should prevent errors when manifold-3d tries to use it
|
|
9
|
+
*/
|
|
10
|
+
function createRequire(filename: string) {
|
|
11
|
+
// In browser context, we return a mock require function
|
|
12
|
+
// This should prevent the manifold-3d library from failing
|
|
13
|
+
function mockRequire(id: string) {
|
|
14
|
+
// For now, just throw an error with helpful message
|
|
15
|
+
throw new Error(`Cannot require '${id}' in browser context. Module ID: ${id}, from: ${filename}`);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Add properties that a real require function might have
|
|
19
|
+
mockRequire.resolve = (id: string) => {
|
|
20
|
+
throw new Error(`Cannot resolve '${id}' in browser context`);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
mockRequire.cache = {};
|
|
24
|
+
mockRequire.extensions = {};
|
|
25
|
+
mockRequire.main = undefined;
|
|
26
|
+
|
|
27
|
+
return mockRequire;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Export as both default and named exports for compatibility
|
|
31
|
+
const moduleExports = {
|
|
32
|
+
createRequire
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default moduleExports;
|
|
36
36
|
export { createRequire };
|
|
@@ -1,232 +1,232 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Browser-compatible polyfill for Node.js path module
|
|
3
|
-
* Provides minimal functionality needed for Genesys.js to work in browsers
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
interface PathObject {
|
|
7
|
-
root: string;
|
|
8
|
-
dir: string;
|
|
9
|
-
base: string;
|
|
10
|
-
ext: string;
|
|
11
|
-
name: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Join path segments using forward slashes (browser-friendly)
|
|
16
|
-
*/
|
|
17
|
-
function join(...paths: string[]): string {
|
|
18
|
-
if (paths.length === 0) return '.';
|
|
19
|
-
|
|
20
|
-
let joined = '';
|
|
21
|
-
for (let i = 0; i < paths.length; i++) {
|
|
22
|
-
const path = paths[i];
|
|
23
|
-
if (path && path.length > 0) {
|
|
24
|
-
if (joined.length === 0) {
|
|
25
|
-
joined += path;
|
|
26
|
-
} else {
|
|
27
|
-
joined += '/' + path;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return normalize(joined);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Normalize a path (resolve . and .. segments)
|
|
37
|
-
*/
|
|
38
|
-
function normalize(path: string): string {
|
|
39
|
-
if (!path) return '.';
|
|
40
|
-
|
|
41
|
-
const isAbsolute = path[0] === '/';
|
|
42
|
-
const segments = path.split('/').filter(segment => segment !== '');
|
|
43
|
-
const normalizedSegments: string[] = [];
|
|
44
|
-
|
|
45
|
-
for (const segment of segments) {
|
|
46
|
-
if (segment === '..') {
|
|
47
|
-
if (normalizedSegments.length > 0 && normalizedSegments[normalizedSegments.length - 1] !== '..') {
|
|
48
|
-
normalizedSegments.pop();
|
|
49
|
-
} else if (!isAbsolute) {
|
|
50
|
-
normalizedSegments.push('..');
|
|
51
|
-
}
|
|
52
|
-
} else if (segment !== '.') {
|
|
53
|
-
normalizedSegments.push(segment);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
let result = normalizedSegments.join('/');
|
|
58
|
-
if (isAbsolute) {
|
|
59
|
-
result = '/' + result;
|
|
60
|
-
} else if (!result) {
|
|
61
|
-
result = '.';
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return result;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Resolve path segments into an absolute path
|
|
69
|
-
*/
|
|
70
|
-
function resolve(...paths: string[]): string {
|
|
71
|
-
let resolvedPath = '';
|
|
72
|
-
let resolvedAbsolute = false;
|
|
73
|
-
|
|
74
|
-
for (let i = paths.length - 1; i >= 0 && !resolvedAbsolute; i--) {
|
|
75
|
-
const path = paths[i];
|
|
76
|
-
if (path) {
|
|
77
|
-
resolvedPath = path + '/' + resolvedPath;
|
|
78
|
-
resolvedAbsolute = path[0] === '/';
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (!resolvedAbsolute) {
|
|
83
|
-
// In browser, we treat relative to current location
|
|
84
|
-
resolvedPath = window.location.pathname + '/' + resolvedPath;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return normalize(resolvedPath);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Check if path is absolute
|
|
92
|
-
*/
|
|
93
|
-
function isAbsolute(path: string): boolean {
|
|
94
|
-
return path.length > 0 && (path[0] === '/' || path.includes('://'));
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Get the directory name of a path
|
|
99
|
-
*/
|
|
100
|
-
function dirname(path: string): string {
|
|
101
|
-
if (!path) return '.';
|
|
102
|
-
|
|
103
|
-
const lastSlash = path.lastIndexOf('/');
|
|
104
|
-
if (lastSlash === -1) return '.';
|
|
105
|
-
if (lastSlash === 0) return '/';
|
|
106
|
-
|
|
107
|
-
return path.slice(0, lastSlash);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Get the base name of a path
|
|
112
|
-
*/
|
|
113
|
-
function basename(path: string, ext?: string): string {
|
|
114
|
-
if (!path) return '';
|
|
115
|
-
|
|
116
|
-
const lastSlash = path.lastIndexOf('/');
|
|
117
|
-
let base = lastSlash === -1 ? path : path.slice(lastSlash + 1);
|
|
118
|
-
|
|
119
|
-
if (ext && base.endsWith(ext)) {
|
|
120
|
-
base = base.slice(0, -ext.length);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return base;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Get the extension of a path
|
|
128
|
-
*/
|
|
129
|
-
function extname(path: string): string {
|
|
130
|
-
if (!path) return '';
|
|
131
|
-
|
|
132
|
-
const base = basename(path);
|
|
133
|
-
const lastDot = base.lastIndexOf('.');
|
|
134
|
-
|
|
135
|
-
return lastDot === -1 ? '' : base.slice(lastDot);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Parse a path into components
|
|
140
|
-
*/
|
|
141
|
-
function parse(path: string): PathObject {
|
|
142
|
-
const dir = dirname(path);
|
|
143
|
-
const base = basename(path);
|
|
144
|
-
const ext = extname(path);
|
|
145
|
-
const name = basename(path, ext);
|
|
146
|
-
|
|
147
|
-
return {
|
|
148
|
-
root: isAbsolute(path) ? '/' : '',
|
|
149
|
-
dir,
|
|
150
|
-
base,
|
|
151
|
-
ext,
|
|
152
|
-
name
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Format a path object into a string
|
|
158
|
-
*/
|
|
159
|
-
function format(pathObject: PathObject): string {
|
|
160
|
-
const dir = pathObject.dir || pathObject.root;
|
|
161
|
-
const base = pathObject.base || pathObject.name + pathObject.ext;
|
|
162
|
-
|
|
163
|
-
if (!dir) return base;
|
|
164
|
-
return dir === pathObject.root ? dir + base : dir + '/' + base;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Get relative path from one path to another
|
|
169
|
-
*/
|
|
170
|
-
function relative(from: string, to: string): string {
|
|
171
|
-
from = resolve(from);
|
|
172
|
-
to = resolve(to);
|
|
173
|
-
|
|
174
|
-
if (from === to) return '';
|
|
175
|
-
|
|
176
|
-
const fromParts = from.split('/').filter(p => p);
|
|
177
|
-
const toParts = to.split('/').filter(p => p);
|
|
178
|
-
|
|
179
|
-
let commonLength = 0;
|
|
180
|
-
const length = Math.min(fromParts.length, toParts.length);
|
|
181
|
-
|
|
182
|
-
for (let i = 0; i < length; i++) {
|
|
183
|
-
if (fromParts[i] === toParts[i]) {
|
|
184
|
-
commonLength++;
|
|
185
|
-
} else {
|
|
186
|
-
break;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
const upCount = fromParts.length - commonLength;
|
|
191
|
-
const downPath = toParts.slice(commonLength);
|
|
192
|
-
|
|
193
|
-
const relativeParts = Array(upCount).fill('..').concat(downPath);
|
|
194
|
-
|
|
195
|
-
return relativeParts.join('/') || '.';
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// Browser-friendly path separator (always forward slash)
|
|
199
|
-
const sep = '/';
|
|
200
|
-
const delimiter = ':';
|
|
201
|
-
|
|
202
|
-
// Export as both default and named exports for compatibility
|
|
203
|
-
const pathModule = {
|
|
204
|
-
join,
|
|
205
|
-
normalize,
|
|
206
|
-
resolve,
|
|
207
|
-
isAbsolute,
|
|
208
|
-
dirname,
|
|
209
|
-
basename,
|
|
210
|
-
extname,
|
|
211
|
-
parse,
|
|
212
|
-
format,
|
|
213
|
-
relative,
|
|
214
|
-
sep,
|
|
215
|
-
delimiter
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
export default pathModule;
|
|
219
|
-
export {
|
|
220
|
-
join,
|
|
221
|
-
normalize,
|
|
222
|
-
resolve,
|
|
223
|
-
isAbsolute,
|
|
224
|
-
dirname,
|
|
225
|
-
basename,
|
|
226
|
-
extname,
|
|
227
|
-
parse,
|
|
228
|
-
format,
|
|
229
|
-
relative,
|
|
230
|
-
sep,
|
|
231
|
-
delimiter
|
|
1
|
+
/**
|
|
2
|
+
* Browser-compatible polyfill for Node.js path module
|
|
3
|
+
* Provides minimal functionality needed for Genesys.js to work in browsers
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
interface PathObject {
|
|
7
|
+
root: string;
|
|
8
|
+
dir: string;
|
|
9
|
+
base: string;
|
|
10
|
+
ext: string;
|
|
11
|
+
name: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Join path segments using forward slashes (browser-friendly)
|
|
16
|
+
*/
|
|
17
|
+
function join(...paths: string[]): string {
|
|
18
|
+
if (paths.length === 0) return '.';
|
|
19
|
+
|
|
20
|
+
let joined = '';
|
|
21
|
+
for (let i = 0; i < paths.length; i++) {
|
|
22
|
+
const path = paths[i];
|
|
23
|
+
if (path && path.length > 0) {
|
|
24
|
+
if (joined.length === 0) {
|
|
25
|
+
joined += path;
|
|
26
|
+
} else {
|
|
27
|
+
joined += '/' + path;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return normalize(joined);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Normalize a path (resolve . and .. segments)
|
|
37
|
+
*/
|
|
38
|
+
function normalize(path: string): string {
|
|
39
|
+
if (!path) return '.';
|
|
40
|
+
|
|
41
|
+
const isAbsolute = path[0] === '/';
|
|
42
|
+
const segments = path.split('/').filter(segment => segment !== '');
|
|
43
|
+
const normalizedSegments: string[] = [];
|
|
44
|
+
|
|
45
|
+
for (const segment of segments) {
|
|
46
|
+
if (segment === '..') {
|
|
47
|
+
if (normalizedSegments.length > 0 && normalizedSegments[normalizedSegments.length - 1] !== '..') {
|
|
48
|
+
normalizedSegments.pop();
|
|
49
|
+
} else if (!isAbsolute) {
|
|
50
|
+
normalizedSegments.push('..');
|
|
51
|
+
}
|
|
52
|
+
} else if (segment !== '.') {
|
|
53
|
+
normalizedSegments.push(segment);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
let result = normalizedSegments.join('/');
|
|
58
|
+
if (isAbsolute) {
|
|
59
|
+
result = '/' + result;
|
|
60
|
+
} else if (!result) {
|
|
61
|
+
result = '.';
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Resolve path segments into an absolute path
|
|
69
|
+
*/
|
|
70
|
+
function resolve(...paths: string[]): string {
|
|
71
|
+
let resolvedPath = '';
|
|
72
|
+
let resolvedAbsolute = false;
|
|
73
|
+
|
|
74
|
+
for (let i = paths.length - 1; i >= 0 && !resolvedAbsolute; i--) {
|
|
75
|
+
const path = paths[i];
|
|
76
|
+
if (path) {
|
|
77
|
+
resolvedPath = path + '/' + resolvedPath;
|
|
78
|
+
resolvedAbsolute = path[0] === '/';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (!resolvedAbsolute) {
|
|
83
|
+
// In browser, we treat relative to current location
|
|
84
|
+
resolvedPath = window.location.pathname + '/' + resolvedPath;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return normalize(resolvedPath);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Check if path is absolute
|
|
92
|
+
*/
|
|
93
|
+
function isAbsolute(path: string): boolean {
|
|
94
|
+
return path.length > 0 && (path[0] === '/' || path.includes('://'));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Get the directory name of a path
|
|
99
|
+
*/
|
|
100
|
+
function dirname(path: string): string {
|
|
101
|
+
if (!path) return '.';
|
|
102
|
+
|
|
103
|
+
const lastSlash = path.lastIndexOf('/');
|
|
104
|
+
if (lastSlash === -1) return '.';
|
|
105
|
+
if (lastSlash === 0) return '/';
|
|
106
|
+
|
|
107
|
+
return path.slice(0, lastSlash);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Get the base name of a path
|
|
112
|
+
*/
|
|
113
|
+
function basename(path: string, ext?: string): string {
|
|
114
|
+
if (!path) return '';
|
|
115
|
+
|
|
116
|
+
const lastSlash = path.lastIndexOf('/');
|
|
117
|
+
let base = lastSlash === -1 ? path : path.slice(lastSlash + 1);
|
|
118
|
+
|
|
119
|
+
if (ext && base.endsWith(ext)) {
|
|
120
|
+
base = base.slice(0, -ext.length);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return base;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Get the extension of a path
|
|
128
|
+
*/
|
|
129
|
+
function extname(path: string): string {
|
|
130
|
+
if (!path) return '';
|
|
131
|
+
|
|
132
|
+
const base = basename(path);
|
|
133
|
+
const lastDot = base.lastIndexOf('.');
|
|
134
|
+
|
|
135
|
+
return lastDot === -1 ? '' : base.slice(lastDot);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Parse a path into components
|
|
140
|
+
*/
|
|
141
|
+
function parse(path: string): PathObject {
|
|
142
|
+
const dir = dirname(path);
|
|
143
|
+
const base = basename(path);
|
|
144
|
+
const ext = extname(path);
|
|
145
|
+
const name = basename(path, ext);
|
|
146
|
+
|
|
147
|
+
return {
|
|
148
|
+
root: isAbsolute(path) ? '/' : '',
|
|
149
|
+
dir,
|
|
150
|
+
base,
|
|
151
|
+
ext,
|
|
152
|
+
name
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Format a path object into a string
|
|
158
|
+
*/
|
|
159
|
+
function format(pathObject: PathObject): string {
|
|
160
|
+
const dir = pathObject.dir || pathObject.root;
|
|
161
|
+
const base = pathObject.base || pathObject.name + pathObject.ext;
|
|
162
|
+
|
|
163
|
+
if (!dir) return base;
|
|
164
|
+
return dir === pathObject.root ? dir + base : dir + '/' + base;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Get relative path from one path to another
|
|
169
|
+
*/
|
|
170
|
+
function relative(from: string, to: string): string {
|
|
171
|
+
from = resolve(from);
|
|
172
|
+
to = resolve(to);
|
|
173
|
+
|
|
174
|
+
if (from === to) return '';
|
|
175
|
+
|
|
176
|
+
const fromParts = from.split('/').filter(p => p);
|
|
177
|
+
const toParts = to.split('/').filter(p => p);
|
|
178
|
+
|
|
179
|
+
let commonLength = 0;
|
|
180
|
+
const length = Math.min(fromParts.length, toParts.length);
|
|
181
|
+
|
|
182
|
+
for (let i = 0; i < length; i++) {
|
|
183
|
+
if (fromParts[i] === toParts[i]) {
|
|
184
|
+
commonLength++;
|
|
185
|
+
} else {
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const upCount = fromParts.length - commonLength;
|
|
191
|
+
const downPath = toParts.slice(commonLength);
|
|
192
|
+
|
|
193
|
+
const relativeParts = Array(upCount).fill('..').concat(downPath);
|
|
194
|
+
|
|
195
|
+
return relativeParts.join('/') || '.';
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Browser-friendly path separator (always forward slash)
|
|
199
|
+
const sep = '/';
|
|
200
|
+
const delimiter = ':';
|
|
201
|
+
|
|
202
|
+
// Export as both default and named exports for compatibility
|
|
203
|
+
const pathModule = {
|
|
204
|
+
join,
|
|
205
|
+
normalize,
|
|
206
|
+
resolve,
|
|
207
|
+
isAbsolute,
|
|
208
|
+
dirname,
|
|
209
|
+
basename,
|
|
210
|
+
extname,
|
|
211
|
+
parse,
|
|
212
|
+
format,
|
|
213
|
+
relative,
|
|
214
|
+
sep,
|
|
215
|
+
delimiter
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
export default pathModule;
|
|
219
|
+
export {
|
|
220
|
+
join,
|
|
221
|
+
normalize,
|
|
222
|
+
resolve,
|
|
223
|
+
isAbsolute,
|
|
224
|
+
dirname,
|
|
225
|
+
basename,
|
|
226
|
+
extname,
|
|
227
|
+
parse,
|
|
228
|
+
format,
|
|
229
|
+
relative,
|
|
230
|
+
sep,
|
|
231
|
+
delimiter
|
|
232
232
|
};
|