javascript

package module
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Extension

func Extension(scriptPath string, options ...Option) scaffolder.Extension

Extension is a scaffolder extension that allows the use of end-user-provided JavaScript code to write template functions.

The extension will execute the JS file scriptPath in the source directory if present. If you wish to include a file named scriptPath in the generated output, you can name it scriptPath.tmpl.

A global variable named context will be available in the JS VM. It will contain the scaffolder.Config.Context value.

Existing template functions will also be available in the JS VM.

Types

type Option

type Option func(*config)

Option is a function that modifies the behaviour of the interpreter.

func WithLogger

func WithLogger(logger func(args ...any)) Option

WithLogger sets the logger to use for console.log, console.debug, console.error and console.warn.

Jump to

Keyboard shortcuts

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