Some checks failed
Build and Deploy / build-macos (push) Failing after 7s
Build and Deploy / build-linux (push) Has been cancelled
Build and Deploy / build-windows (CLANG64) (push) Has been cancelled
Build and Deploy / package-dist (push) Has been cancelled
Build and Deploy / deploy-itch (push) Has been cancelled
Build and Deploy / deploy-gitea (push) Has been cancelled
41 lines
951 B
JavaScript
41 lines
951 B
JavaScript
// Example main.js that uses the module system
|
|
|
|
log.console("=== Module System Test ===")
|
|
|
|
// Test bare imports
|
|
try {
|
|
var sprite = use("sprite")
|
|
log.console("✓ Loaded sprite from bare import")
|
|
} catch (e) {
|
|
log.console("✗ Failed to load sprite: " + e)
|
|
}
|
|
|
|
// Test relative imports
|
|
try {
|
|
var helper = use("./helper")
|
|
log.console("✓ Loaded helper from relative import")
|
|
helper.greet("Module System")
|
|
} catch (e) {
|
|
log.console("✗ Failed to load helper: " + e)
|
|
}
|
|
|
|
// Test scheme-qualified imports
|
|
try {
|
|
var core_time = use("core://time")
|
|
log.console("✓ Loaded time from core:// scheme")
|
|
} catch (e) {
|
|
log.console("✗ Failed to load core://time: " + e)
|
|
}
|
|
|
|
// Test aliased module (if configured in shop.toml)
|
|
try {
|
|
var mod = use("mod/utils")
|
|
log.console("✓ Loaded mod/utils from aliased module")
|
|
} catch (e) {
|
|
log.console("✗ Failed to load mod/utils: " + e)
|
|
}
|
|
|
|
log.console("")
|
|
log.console("Test complete!")
|
|
|
|
$_.stop() |