jslib

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2021 License: ISC Imports: 13 Imported by: 0

README

jslib

-- import "vimagination.zapto.org/jslib"

Package jslib is a javascript packer and library for javascript projects

Usage

var (
	ErrNoFiles    = errors.New("no files")
	ErrInvalidURL = errors.New("added files must be absolute URLs")
)

Errors

var (
	ErrInvalidExport = errors.New("invalid export")
)

Errors

func NoExports
func NoExports(c *config)

NoExports disables the creation of exports for any potential plugins

func OSLoad
func OSLoad(base string) func(url string) (*javascript.Module, error)

OSLoad is the default loader for Package, with the base set to CWD

func Package
func Package(opts ...Option) (*javascript.Script, error)

Package packages up multiple javascript modules into a single file, renaming bindings to simulate imports

func ParseDynamic
func ParseDynamic(c *config)

ParseDynamic turns on dynamic import/include parsing

func Plugin
func Plugin(m *javascript.Module, url string) (*javascript.Script, error)

Plugin converts a single javascript module to make use of the processed exports from package

type Option
type Option func(*config)

Option in a type that can be passed to Package to set an option

func File
func File(url string) Option

File is an Option that specifies a starting file for Package

func Loader
func Loader(l func(string) (*javascript.Module, error)) Option

Loader sets the func that will take URLs and produce a parsed module

Documentation

Overview

Package jslib is a javascript packer and library for javascript projects

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoFiles    = errors.New("no files")
	ErrInvalidURL = errors.New("added files must be absolute URLs")
)

Errors

View Source
var (
	ErrInvalidExport = errors.New("invalid export")
)

Errors

Functions

func NoExports

func NoExports(c *config)

NoExports disables the creation of exports for any potential plugins

func OSLoad

func OSLoad(base string) func(string) (*javascript.Module, error)

OSLoad is the default loader for Package, with the base set to CWD

func Package

func Package(opts ...Option) (*javascript.Script, error)

Package packages up multiple javascript modules into a single file, renaming bindings to simulate imports

func ParseDynamic

func ParseDynamic(c *config)

ParseDynamic turns on dynamic import/include parsing

func Plugin

func Plugin(m *javascript.Module, url string) (*javascript.Script, error)

Plugin converts a single javascript module to make use of the processed exports from package

func Token

func Token(data string) *javascript.Token

Types

type Option

type Option func(*config)

Option in a type that can be passed to Package to set an option

func File

func File(url string) Option

File is an Option that specifies a starting file for Package

func Loader

func Loader(l func(string) (*javascript.Module, error)) Option

Loader sets the func that will take URLs and produce a parsed module

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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