scriptTransformer

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompileJavascriptFile

func CompileJavascriptFile(scriptPath string) (string, string, bool)

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 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