engines

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package engines mirrors Illuminate\View\Engines.

The files it answers to, in the clone at laravel_illuminate/view/Engines:

CompilerEngine.php
Engine.php
EngineResolver.php
FileEngine.php
PhpEngine.php

Nothing is implemented here yet. docs/31-reorganizacao-hesape.md says what moves in, from where, and in which phase.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	// contains filtered or unexported fields
}

Base is the abstract Illuminate\View\Engines\Engine.

PHP's abstract class holds one field and one method: the view drawn last, which the exception message names. An engine embeds this to answer for it.

func (*Base) GetLastRendered

func (e *Base) GetLastRendered() string

GetLastRendered is Engine::getLastRendered.

type Compiler

type Compiler struct {
	Base
	// contains filtered or unexported fields
}

Compiler is Illuminate\View\Engines\CompilerEngine.

In Arandu there is no runtime compilation on the hot path: the kyse compiler runs at build time and produces Go functions. What survives from PHP is the bookkeeping around it -- whether a path was already found current in this process, and which path is being drawn when something fails.

func NewCompiler

func NewCompiler(compiler CompilerInterface, evaluate func(path string, data map[string]any) (string, error)) *Compiler

NewCompiler is CompilerEngine::__construct.

evaluate stands in for PhpEngine::evaluatePath, which has no counterpart: it exists because PHP includes the compiled file at request time, and a compiled view here is a Go function that was linked into the binary.

func (*Compiler) ForgetCompiledOrNotExpired

func (c *Compiler) ForgetCompiledOrNotExpired()

ForgetCompiledOrNotExpired is CompilerEngine::forgetCompiledOrNotExpired.

func (*Compiler) Get

func (c *Compiler) Get(path string, data map[string]any) (string, error)

Get is CompilerEngine::get.

func (*Compiler) GetCompiler

func (c *Compiler) GetCompiler() CompilerInterface

GetCompiler is CompilerEngine::getCompiler.

type CompilerInterface

type CompilerInterface interface {
	// GetCompiledPath is Compiler::getCompiledPath.
	GetCompiledPath(path string) string

	// IsExpired is Compiler::isExpired.
	IsExpired(path string) (bool, error)

	// Compile is CompilerInterface::compile.
	Compile(path string) error
}

CompilerInterface is Illuminate\View\Compilers\CompilerInterface.

The contract is declared where it is consumed rather than beside the implementation, which is what keeps view -> engines -> compilers -> view from closing into a cycle.

type Engine

type Engine interface {
	Get(path string, data map[string]any) (string, error)
}

Engine mirrors Illuminate\View\Engines\Engine.

An Engine turns a view path and data into rendered content. In Arandu, views are compiled into Go functions by kyse at build time, so the engine delegates to the compiled function registry — there is no runtime compilation. The Engine interface exists to match the Illuminate surface.

type File

type File struct {
	Base
	// contains filtered or unexported fields
}

File is Illuminate\View\Engines\FileEngine.

It reads a raw file from disk. In Arandu that is `aru view:build` reading a .kyse.go source before compiling it, never a request.

func NewFile

func NewFile(read func(path string) (string, error)) *File

NewFile is FileEngine::__construct.

func (*File) Get

func (e *File) Get(path string, _ map[string]any) (string, error)

Get is FileEngine::get.

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

Resolver mirrors Illuminate\View\Engines\EngineResolver.

It maps engine names to constructors. In Arandu, the only engine is the compiled kyse engine; this type preserves the Illuminate API surface for compatibility and future extension.

func NewResolver

func NewResolver() *Resolver

NewResolver returns a resolver with no engines registered.

func (*Resolver) Forget

func (r *Resolver) Forget(name string)

Forget removes a resolved engine from the cache.

func (*Resolver) Register

func (r *Resolver) Register(name string, resolver func() Engine)

Register stores a constructor for the given engine name.

func (*Resolver) Resolve

func (r *Resolver) Resolve(name string) (Engine, error)

Resolve returns the engine for name, creating it once and caching.

Jump to

Keyboard shortcuts

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