goxsource

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AliasRoot

func AliasRoot(projectRoot, importerPath string) (string, error)

AliasRoot returns the source-tree boundary used by @ imports. Pages and WebSocket/Channel modules use identical ancestral lookup rules but never cross from one tree into the other.

func IsPublicPage

func IsPublicPage(rel string) bool

IsPublicPage reports whether rel is a routable .gox file below pages/. A segment beginning with @ and a filename with an additional dot are private.

func PublicChannelIdentity

func PublicChannelIdentity(rel string) (string, string, bool)

PublicChannelIdentity returns the canonical static channel name and handler function represented by a public .gox file below websocket/. The root websocket/index.gox is reserved for the global WebSocket and is never a channel. Repeated terminal segments collapse (chat/chat.gox -> Chat), while nested names remain hierarchical (chat/index.gox -> Chat/Index).

func PublicPageRoute

func PublicPageRoute(rel string) (string, bool)

PublicPageRoute returns the canonical HTTP route represented by a public page path relative to the project root.

Types

type ModuleContext

type ModuleContext struct {
	Kind            ModuleKind
	RelativePath    string
	ChannelName     string
	ChannelFunction string
}

func ClassifyModule

func ClassifyModule(rel string) ModuleContext

ClassifyModule describes the filesystem role of a .gox source file. It does not validate which GOX entrypoints the module declares; compiler validation applies those rules separately.

type ModuleKind

type ModuleKind string
const (
	ModuleOther            ModuleKind = "other"
	ModulePublicPage       ModuleKind = "public-page"
	ModulePrivatePage      ModuleKind = "private-page"
	ModulePageAlias        ModuleKind = "page-alias"
	ModuleGlobalWebSocket  ModuleKind = "global-websocket"
	ModulePublicChannel    ModuleKind = "public-channel"
	ModulePrivateWebSocket ModuleKind = "private-websocket"
	ModuleWebSocketAlias   ModuleKind = "websocket-alias"
)

type Resolution

type Resolution struct {
	ImportPath   string
	ResolvedPath string
	Candidates   []string
}

func ResolveAlias

func ResolveAlias(sourceRoot, importerPath, importPath string) (Resolution, error)

ResolveAlias resolves an @ import by searching only the importer's directory and its ancestors up to sourceRoot. The first existing regular file wins.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL