scriptTransformer

package
v2.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompileJavascriptFile

func CompileJavascriptFile(scriptPath string) (string, string, error)

func DirExists

func DirExists(path string) bool

func FileExists

func FileExists(path string) bool

func GetCompileCacheDir

func GetCompileCacheDir(searchFrom string) string

func SearchModuleInNodeModules

func SearchModuleInNodeModules(modName string, callerDir string) string

SearchModuleInNodeModules returns the module path inside node_modules directory. It recurse in the upper directory if not found in the current one.

func SearchNodeModulesDir

func SearchNodeModulesDir(searchFrom string) string

func SetJavascriptModuleResolver

func SetJavascriptModuleResolver(handler JavascriptModuleResolverF)

func WalkNodeModules

func WalkNodeModules(startDir string, handler func(dirPath string) bool)

WalkNodeModules allows a function to be called on each node_modules dir until this function return true, going up recursively on the node_modules in the parent dir.

Types

type JavascriptModuleResolverF

type JavascriptModuleResolverF func(resourcePath string) (content string, loaderToUse uint16, isFound bool)

type ScriptCompilationError

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

func (*ScriptCompilationError) Error

func (m *ScriptCompilationError) Error() string

type TransformedScript

type TransformedScript struct {
	CompiledScriptPath    string
	OutputDir             string
	CompiledScriptContent string
	SourceMapFileContent  string
	SourceMapScriptPath   string
}

Jump to

Keyboard shortcuts

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