1 package jspacker 2 3 import "vimagination.zapto.org/javascript" 4 5 // Option in a type that can be passed to Package to set an option 6 type Option func(*config) 7 8 // File is an Option that specifies a starting file for Package 9 func File(url string) Option { 10 return func(c *config) { 11 c.filesToDo = append(c.filesToDo, url) 12 } 13 } 14 15 // NoExports disables the creation of exports for any potential plugins 16 func NoExports(c *config) { 17 c.bare = true 18 } 19 20 // Loader sets the func that will take URLs and produce a parsed module 21 func Loader(l func(string) (*javascript.Module, error)) Option { 22 return func(c *config) { 23 c.loader = l 24 } 25 } 26 27 // ParseDynamic turns on dynamic import/include parsing 28 func ParseDynamic(c *config) { 29 c.parseDynamic = true 30 } 31