webext

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateManifest

func CreateManifest(opts ProjectOptions) ([]byte, error)

func CreatePopupPage

func CreatePopupPage(moduleName, wasmEmbed string) (html, js []byte)

func CreateServiceWorker

func CreateServiceWorker(moduleName, wasmEmbed string) (js []byte)

func CreateSettingsPage

func CreateSettingsPage(moduleName, wasmEmbed string) (html, js []byte)

func CreateSidePanel

func CreateSidePanel(moduleName, wasmEmbed string) (html, js []byte)

Types

type ArchiveEntry

type ArchiveEntry struct {
	Path string
	Size int64
}

func Pack

func Pack(zipOut io.Writer, chdir string, globPatterns []string) (entries []ArchiveEntry, err error)

type File

type File struct {
	Path    string
	Content []byte
}

func CreateProject

func CreateProject(dir string, opts ProjectOptions) []File

type ManifestAction

type ManifestAction struct {
	DefaultTitle string `json:"default_title"`
	DefaultPopup string `json:"default_popup"`
	DefaultIcon  struct {
		N16 string `json:"16"`
		N24 string `json:"24"`
		N32 string `json:"32"`
	} `json:"default_icon"`
}

type ManifestBackground

type ManifestBackground struct {
	ServiceWorker string `json:"service_worker"`
}

type ManifestBasicSchema

type ManifestBasicSchema struct {
	ManifestVersion int    `json:"manifest_version"`
	Name            string `json:"name"`
	Description     string `json:"description"`
	HomepageURL     string `json:"homepage_url"`
	Version         string `json:"version"`

	Icons struct {
		N16  string `json:"16"`
		N48  string `json:"48"`
		N128 string `json:"128"`
		N256 string `json:"256"`
	} `json:"icons"`

	OptionsPage string   `json:"options_page,omitempty"`
	Permissions []string `json:"permissions"`

	CSP ManifestCSP `json:"content_security_policy"`

	SidePanel  *ManifestSidePanel  `json:"side_panel,omitempty"`
	Background *ManifestBackground `json:"background,omitempty"`
	Action     *ManifestAction     `json:"action,omitempty"`
}

type ManifestCSP

type ManifestCSP struct {
	ExtensionPages string `json:"extension_pages"`
}

type ManifestSidePanel

type ManifestSidePanel struct {
	DefaultPath string `json:"default_path"`
}

type PackFlags

type PackFlags struct {
	Chdir  string   `cli:"c|chdir,#set work dir when packing"`
	Output string   `cli:"o|output,#set path to write the output zip file, if not set, write to stdout"`
	Match  []string `cli:"m|match,#add glob pattern to match expected files"`
}

type ProjectOptions

type ProjectOptions struct {
	Name string `cli:"name,#set name of the extension"`
	URL  string `cli:"url,#set url to the project home"`

	ModuleName string `cli:"module-name,#set module name for js bindings"`

	All           bool `cli:"all,#add all components"`
	Popup         bool `cli:"popup,#add popup component"`
	ServiceWorker bool `cli:"service-worker|background,#add service-worker component"`
	Settings      bool `cli:"settings,#add extension settings component (options_page)"`
	SidePanel     bool `cli:"sidepanel,#add sidepanel component"`
}

type WebextFlags

type WebextFlags struct {
	WASM      string `cli:"wasm,#set output path for the built wasm"`
	Bindings  string `cli:"bindings,#set output path for the generated bindings"`
	Embedding string `cli:"embedding,#set output path for the generated js embedding"`
	Zip       string `cli:"zip,#set output path for the generated zip file"`

	EmbedMode  string            `cli:"embed-mode,def=uint8array,comp=uint8array,comp=base64,comp=data-url,#set embedding mode"`
	EmbedFiles map[string]string `cli:"embed,#add embedded file in format \"[export] {var|const|let} <var-name>=<file-path>\""`

	ES         string `cli:"es,def=5,comp=5,comp=6,#set ES language when transpiling typescript"`
	ModuleName string `cli:"module-name,def=bindings,#set module name for generated bindings"`

	PackDir   string   `cli:"pack-base,#set base dir for matching pack glob patterns"`
	PackMatch []string `cli:"pack,#add glob pattern to include matched files in zip"`

	Debug    bool   `cli:"debug,#debug the wasm build process"`
	BuildDir string `cli:"build-dir,def=.pcz/build,#set directory to store intermediate build outputs"`
	NoCache  bool   `cli:"no-cache,#build without cache"`
	Trimpath bool   `cli:"trimpath,#remove all file system paths from the resulting executable"`

	Defs        []string           `cli:"X|define,#link-time string value definition of the form importpath.name=value"`
	EntrySymbol string             `cli:"entry,def=rt0,#set entry symbol name"`
	Platform    toolchain.Platform `cli:"p|platform,def=js/wasm,#\"os/arch\" pair"`
	Tags        []string           `cli:"t|tag,#add build tags"`

	LDFlags  []string `cli:"L|ldflag,#add flags to go tool link"`
	GCFlags  []string `cli:"G|gcflag,#add flags to go tool compile (not including gccgo)"`
	ASMFlags []string `cli:"A|asmflag,#add flags to go tool asm"`
}

Directories

Path Synopsis
+ package main
+ package main

Jump to

Keyboard shortcuts

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