Compare commits

..

1 Commits
v1.0.0 ... main

Author SHA1 Message Date
AI Engineer
147579b0d1 feat: propagate safeMode status via context 2026-05-30 19:26:01 +08:00

View File

@ -1,6 +1,22 @@
package jsmod
import "sync"
import (
"context"
"sync"
)
type contextKey string
const SafeModeKey contextKey = "SafeMode"
// IsSafeMode checks if the provided context indicates that the execution is in safe mode.
func IsSafeMode(ctx context.Context) bool {
v := ctx.Value(SafeModeKey)
if sm, ok := v.(bool); ok {
return sm
}
return false // Default to false if not specified (internal trusted caller)
}
type Module struct {
Exports map[string]any