Compare commits
3 Commits
main
...
dev_cli_demon
| Author | SHA1 | Date | |
|---|---|---|---|
| 946c1beabf | |||
| d5783423d6 | |||
| 0d80f575c1 |
@@ -0,0 +1,20 @@
|
|||||||
|
# binaries
|
||||||
|
**/bin/
|
||||||
|
**/.bin/
|
||||||
|
*.exe
|
||||||
|
|
||||||
|
# Go build artifacts
|
||||||
|
*.out
|
||||||
|
*.test
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# OS
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# local notes
|
||||||
|
TODO.md
|
||||||
|
|
||||||
|
# protobuf generated
|
||||||
|
internal/grpc/pb/*.pb.goa
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
GO := $(shell command -v go 2>/dev/null || echo /usr/local/go/bin/go)
|
||||||
|
BIN_DIR=bin
|
||||||
|
|
||||||
|
DAEMON=$(BIN_DIR)/daemon
|
||||||
|
CLI=$(BIN_DIR)/cli
|
||||||
|
|
||||||
|
PROTO_DIR=proto
|
||||||
|
PROTO_OUT=internal/grpc/pb
|
||||||
|
|
||||||
|
.PHONY: all build clean proto daemon cli daemon-arm64
|
||||||
|
|
||||||
|
all: build
|
||||||
|
|
||||||
|
# =========================
|
||||||
|
# BUILD
|
||||||
|
# =========================
|
||||||
|
|
||||||
|
build: daemon cli daemon-arm64
|
||||||
|
|
||||||
|
daemon:
|
||||||
|
@echo "Building daemon..."
|
||||||
|
@mkdir -p $(BIN_DIR)
|
||||||
|
@$(GO) build -o $(DAEMON) ./cmd/daemon
|
||||||
|
|
||||||
|
cli:
|
||||||
|
@echo "Building cli..."
|
||||||
|
@mkdir -p $(BIN_DIR)
|
||||||
|
@$(GO) build -o $(CLI) ./cmd/cli
|
||||||
|
|
||||||
|
daemon-arm64:
|
||||||
|
@echo "Building daemon for linux/arm64..."
|
||||||
|
@mkdir -p $(BIN_DIR)
|
||||||
|
@GOOS=linux GOARCH=arm64 CGO_ENABLED=0 $(GO) build -o $(BIN_DIR)/daemon-arm64 ./cmd/daemon
|
||||||
|
|
||||||
|
|
||||||
|
# =========================
|
||||||
|
# PROTO
|
||||||
|
# =========================
|
||||||
|
|
||||||
|
proto:
|
||||||
|
@echo "Generating protobuf..."
|
||||||
|
@mkdir -p $(PROTO_OUT)
|
||||||
|
@protoc \
|
||||||
|
--go_out=. \
|
||||||
|
--go-grpc_out=. \
|
||||||
|
-I $(PROTO_DIR) \
|
||||||
|
$(PROTO_DIR)/*.proto
|
||||||
|
|
||||||
|
|
||||||
|
# =========================
|
||||||
|
# CLEAN
|
||||||
|
# =========================
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@echo "Cleaning binaries..."
|
||||||
|
@rm -rf $(BIN_DIR)/*
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# SPEKTR
|
||||||
|
|
||||||
|
Минимальный Go-прототип: gRPC daemon + UART bridge + CLI discovery.
|
||||||
|
|
||||||
|
## Команды
|
||||||
|
- `av`
|
||||||
|
- `af <mhz>`
|
||||||
|
- `get`
|
||||||
|
|
||||||
|
## Запуск
|
||||||
|
- daemon: `go run ./cmd/daemon`
|
||||||
|
- cli: `go run ./cmd/cli`
|
||||||
@@ -0,0 +1,150 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"context"
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"spektr/internal/config"
|
||||||
|
"spektr/internal/discovery"
|
||||||
|
grpcclient "spektr/internal/grpc"
|
||||||
|
pb "spektr/internal/grpc/pb"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
configPath := flag.String("config", "configs/config.yaml", "path to config file")
|
||||||
|
addrOverride := flag.String("addr", "192.168.1.10:50051", "explicit gRPC address")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
cfg, err := config.Load(*configPath)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
scanner := bufio.NewScanner(os.Stdin)
|
||||||
|
for {
|
||||||
|
addr := resolveAddr(cfg, *addrOverride)
|
||||||
|
client, err := waitForClient(addr)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("Подключено к", addr)
|
||||||
|
printHelp()
|
||||||
|
|
||||||
|
lostConnection := false
|
||||||
|
for {
|
||||||
|
fmt.Print("> ")
|
||||||
|
if !scanner.Scan() {
|
||||||
|
_ = client.Close()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
line := strings.TrimSpace(scanner.Text())
|
||||||
|
switch {
|
||||||
|
case line == "", line == "help":
|
||||||
|
printHelp()
|
||||||
|
case line == "exit":
|
||||||
|
_ = client.Close()
|
||||||
|
return
|
||||||
|
case line == "av":
|
||||||
|
lostConnection = !sendAndPrint(client, &pb.ClientMessage{RequestId: requestID(), Payload: &pb.ClientMessage_Av{Av: &pb.AvCommand{}}})
|
||||||
|
case line == "get":
|
||||||
|
lostConnection = !sendAndPrint(client, &pb.ClientMessage{RequestId: requestID(), Payload: &pb.ClientMessage_GetFrequency{GetFrequency: &pb.GetFrequencyCommand{}}})
|
||||||
|
case strings.HasPrefix(line, "af "):
|
||||||
|
value := strings.TrimSpace(strings.TrimPrefix(line, "af "))
|
||||||
|
mhz, err := strconv.ParseUint(value, 10, 32)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("invalid frequency")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
lostConnection = !sendAndPrint(client, &pb.ClientMessage{RequestId: requestID(), Payload: &pb.ClientMessage_SetFrequency{SetFrequency: &pb.SetFrequencyCommand{Frequency: uint32(mhz)}}})
|
||||||
|
default:
|
||||||
|
fmt.Println("unknown command")
|
||||||
|
}
|
||||||
|
|
||||||
|
if lostConnection {
|
||||||
|
_ = client.Close()
|
||||||
|
fmt.Println("Соединение потеряно, ожидаю демон...")
|
||||||
|
time.Sleep(2 * time.Second)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func resolveAddr(cfg config.Config, override string) string {
|
||||||
|
if override != "" {
|
||||||
|
return override
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
discovered, err := discovery.Discover(ctx, cfg.DiscoveryPort)
|
||||||
|
if err == nil && discovered != "" {
|
||||||
|
return discovered
|
||||||
|
}
|
||||||
|
|
||||||
|
return cfg.GRPCAdvertiseAddr
|
||||||
|
}
|
||||||
|
|
||||||
|
func waitForClient(addr string) (*grpcclient.Client, error) {
|
||||||
|
for {
|
||||||
|
dialCtx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||||
|
client, err := grpcclient.Dial(dialCtx, addr)
|
||||||
|
cancel()
|
||||||
|
if err == nil {
|
||||||
|
return client, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("Демон недоступен, жду подключение...")
|
||||||
|
time.Sleep(2 * time.Second)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func printHelp() {
|
||||||
|
fmt.Println("Доступные команды:")
|
||||||
|
fmt.Println(" av - проверить связь с устройством")
|
||||||
|
fmt.Println(" af <мгц> - установить частоту, например: af 1880")
|
||||||
|
fmt.Println(" get - показать текущую частоту")
|
||||||
|
fmt.Println(" help - показать список команд")
|
||||||
|
fmt.Println(" exit - выйти из CLI")
|
||||||
|
}
|
||||||
|
|
||||||
|
func sendAndPrint(client *grpcclient.Client, msg *pb.ClientMessage) bool {
|
||||||
|
resp, err := client.Send(msg)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("error:", err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
switch payload := resp.GetPayload().(type) {
|
||||||
|
case *pb.ServerMessage_Av:
|
||||||
|
fmt.Printf("HW: %s FW: %s\n", payload.Av.GetHw(), payload.Av.GetSw())
|
||||||
|
case *pb.ServerMessage_SetFrequency:
|
||||||
|
fmt.Println("ok")
|
||||||
|
case *pb.ServerMessage_GetFrequency:
|
||||||
|
fmt.Printf("%s\n", formatFrequencyResponse(payload.GetFrequency.GetFrequency()))
|
||||||
|
case *pb.ServerMessage_Error:
|
||||||
|
fmt.Println("error:", payload.Error.GetMessage())
|
||||||
|
default:
|
||||||
|
fmt.Println("unknown response")
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func requestID() string {
|
||||||
|
return strconv.FormatInt(time.Now().UnixNano(), 10)
|
||||||
|
}
|
||||||
|
|
||||||
|
func formatFrequencyResponse(freq uint32) string {
|
||||||
|
return fmt.Sprintf("f%07d", freq*100)
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"flag"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"os/signal"
|
||||||
|
"syscall"
|
||||||
|
|
||||||
|
"spektr/internal/config"
|
||||||
|
"spektr/internal/discovery"
|
||||||
|
grpcserver "spektr/internal/grpc"
|
||||||
|
"spektr/internal/service"
|
||||||
|
"spektr/internal/uart"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
configPath := flag.String("config", "./config.yaml", "path to config file")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
cfg, err := config.Load(*configPath)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
u, err := uart.New(cfg.UARTDevice, cfg.UARTBaud)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
log.Printf("UART opened: %s @ %d", cfg.UARTDevice, cfg.UARTBaud)
|
||||||
|
defer u.Close()
|
||||||
|
|
||||||
|
svc := service.New(u)
|
||||||
|
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
if err := discovery.Serve(ctx, cfg.DiscoveryPort, cfg.GRPCAdvertiseAddr); err != nil {
|
||||||
|
log.Println("discovery stopped:", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
if err := grpcserver.Serve(ctx, cfg.GRPCListenAddr, svc); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
grpc_listen_addr: ":50051"
|
||||||
|
grpc_advertise_addr: "127.0.0.1:50051"
|
||||||
|
discovery_port: 50052
|
||||||
|
uart_device: "/dev/ttyS3"
|
||||||
|
uart_baud: 115200
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
module spektr
|
||||||
|
|
||||||
|
go 1.26.4
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07
|
||||||
|
github.com/wailsapp/wails/v2 v2.12.0
|
||||||
|
google.golang.org/grpc v1.81.1
|
||||||
|
google.golang.org/protobuf v1.36.11
|
||||||
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
git.sr.ht/~jackmordaunt/go-toast/v2 v2.0.3 // indirect
|
||||||
|
github.com/bep/debounce v1.2.1 // indirect
|
||||||
|
github.com/go-ole/go-ole v1.3.0 // indirect
|
||||||
|
github.com/godbus/dbus/v5 v5.1.0 // indirect
|
||||||
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
|
github.com/gorilla/websocket v1.5.3 // indirect
|
||||||
|
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
|
||||||
|
github.com/labstack/echo/v4 v4.13.3 // indirect
|
||||||
|
github.com/labstack/gommon v0.4.2 // indirect
|
||||||
|
github.com/leaanthony/go-ansi-parser v1.6.1 // indirect
|
||||||
|
github.com/leaanthony/gosod v1.0.4 // indirect
|
||||||
|
github.com/leaanthony/slicer v1.6.0 // indirect
|
||||||
|
github.com/leaanthony/u v1.1.1 // indirect
|
||||||
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
|
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
|
||||||
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
|
github.com/rivo/uniseg v0.4.7 // indirect
|
||||||
|
github.com/samber/lo v1.49.1 // indirect
|
||||||
|
github.com/tkrajina/go-reflector v0.5.8 // indirect
|
||||||
|
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||||
|
github.com/valyala/fasttemplate v1.2.2 // indirect
|
||||||
|
github.com/wailsapp/go-webview2 v1.0.22 // indirect
|
||||||
|
github.com/wailsapp/mimetype v1.4.1 // indirect
|
||||||
|
golang.org/x/crypto v0.48.0 // indirect
|
||||||
|
golang.org/x/net v0.51.0 // indirect
|
||||||
|
golang.org/x/sys v0.42.0 // indirect
|
||||||
|
golang.org/x/text v0.34.0 // indirect
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171 // indirect
|
||||||
|
)
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
git.sr.ht/~jackmordaunt/go-toast/v2 v2.0.3 h1:N3IGoHHp9pb6mj1cbXbuaSXV/UMKwmbKLf53nQmtqMA=
|
||||||
|
git.sr.ht/~jackmordaunt/go-toast/v2 v2.0.3/go.mod h1:QtOLZGz8olr4qH2vWK0QH0w0O4T9fEIjMuWpKUsH7nc=
|
||||||
|
github.com/bep/debounce v1.2.1 h1:v67fRdBA9UQu2NhLFXrSg0Brw7CexQekrBwDMM8bzeY=
|
||||||
|
github.com/bep/debounce v1.2.1/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0=
|
||||||
|
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||||
|
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
||||||
|
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||||
|
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||||
|
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||||
|
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
|
||||||
|
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
|
||||||
|
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
|
||||||
|
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||||
|
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||||
|
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||||
|
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||||
|
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||||
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
|
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
||||||
|
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||||
|
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e h1:Q3+PugElBCf4PFpxhErSzU3/PY5sFL5Z6rfv4AbGAck=
|
||||||
|
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
|
||||||
|
github.com/labstack/echo/v4 v4.13.3 h1:pwhpCPrTl5qry5HRdM5FwdXnhXSLSY+WE+YQSeCaafY=
|
||||||
|
github.com/labstack/echo/v4 v4.13.3/go.mod h1:o90YNEeQWjDozo584l7AwhJMHN0bOC4tAfg+Xox9q5g=
|
||||||
|
github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
|
||||||
|
github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU=
|
||||||
|
github.com/leaanthony/debme v1.2.1 h1:9Tgwf+kjcrbMQ4WnPcEIUcQuIZYqdWftzZkBr+i/oOc=
|
||||||
|
github.com/leaanthony/debme v1.2.1/go.mod h1:3V+sCm5tYAgQymvSOfYQ5Xx2JCr+OXiD9Jkw3otUjiA=
|
||||||
|
github.com/leaanthony/go-ansi-parser v1.6.1 h1:xd8bzARK3dErqkPFtoF9F3/HgN8UQk0ed1YDKpEz01A=
|
||||||
|
github.com/leaanthony/go-ansi-parser v1.6.1/go.mod h1:+vva/2y4alzVmmIEpk9QDhA7vLC5zKDTRwfZGOp3IWU=
|
||||||
|
github.com/leaanthony/gosod v1.0.4 h1:YLAbVyd591MRffDgxUOU1NwLhT9T1/YiwjKZpkNFeaI=
|
||||||
|
github.com/leaanthony/gosod v1.0.4/go.mod h1:GKuIL0zzPj3O1SdWQOdgURSuhkF+Urizzxh26t9f1cw=
|
||||||
|
github.com/leaanthony/slicer v1.6.0 h1:1RFP5uiPJvT93TAHi+ipd3NACobkW53yUiBqZheE/Js=
|
||||||
|
github.com/leaanthony/slicer v1.6.0/go.mod h1:o/Iz29g7LN0GqH3aMjWAe90381nyZlDNquK+mtH2Fj8=
|
||||||
|
github.com/leaanthony/u v1.1.1 h1:TUFjwDGlNX+WuwVEzDqQwC2lOv0P4uhTQw7CMFdiK7M=
|
||||||
|
github.com/leaanthony/u v1.1.1/go.mod h1:9+o6hejoRljvZ3BzdYlVL0JYCwtnAsVuN9pVTQcaRfI=
|
||||||
|
github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
|
||||||
|
github.com/matryer/is v1.4.1 h1:55ehd8zaGABKLXQUe2awZ99BD/PTc2ls+KV/dXphgEQ=
|
||||||
|
github.com/matryer/is v1.4.1/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
|
||||||
|
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||||
|
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||||
|
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
|
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
|
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
|
||||||
|
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
|
||||||
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||||
|
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
||||||
|
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||||
|
github.com/samber/lo v1.49.1 h1:4BIFyVfuQSEpluc7Fua+j1NolZHiEHEpaSEKdsH0tew=
|
||||||
|
github.com/samber/lo v1.49.1/go.mod h1:dO6KHFzUKXgP8LDhU0oI8d2hekjXnGOu0DB8Jecxd6o=
|
||||||
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
|
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07 h1:UyzmZLoiDWMRywV4DUYb9Fbt8uiOSooupjTq10vpvnU=
|
||||||
|
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
|
||||||
|
github.com/tkrajina/go-reflector v0.5.8 h1:yPADHrwmUbMq4RGEyaOUpz2H90sRsETNVpjzo3DLVQQ=
|
||||||
|
github.com/tkrajina/go-reflector v0.5.8/go.mod h1:ECbqLgccecY5kPmPmXg1MrHW585yMcDkVl6IvJe64T4=
|
||||||
|
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||||
|
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||||
|
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
|
||||||
|
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
|
||||||
|
github.com/wailsapp/go-webview2 v1.0.22 h1:YT61F5lj+GGaat5OB96Aa3b4QA+mybD0Ggq6NZijQ58=
|
||||||
|
github.com/wailsapp/go-webview2 v1.0.22/go.mod h1:qJmWAmAmaniuKGZPWwne+uor3AHMB5PFhqiK0Bbj8kc=
|
||||||
|
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
|
||||||
|
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
|
||||||
|
github.com/wailsapp/wails/v2 v2.12.0 h1:BHO/kLNWFHYjCzucxbzAYZWUjub1Tvb4cSguQozHn5c=
|
||||||
|
github.com/wailsapp/wails/v2 v2.12.0/go.mod h1:mo1bzK1DEJrobt7YrBjgxvb5Sihb1mhAY09hppbibQg=
|
||||||
|
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
|
||||||
|
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
||||||
|
go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I=
|
||||||
|
go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0=
|
||||||
|
go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM=
|
||||||
|
go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY=
|
||||||
|
go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg=
|
||||||
|
go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg=
|
||||||
|
go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw=
|
||||||
|
go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A=
|
||||||
|
go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A=
|
||||||
|
go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0=
|
||||||
|
golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts=
|
||||||
|
golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos=
|
||||||
|
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
|
golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo=
|
||||||
|
golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y=
|
||||||
|
golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo=
|
||||||
|
golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||||
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk=
|
||||||
|
golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA=
|
||||||
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
|
||||||
|
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171 h1:ggcbiqK8WWh6l1dnltU4BgWGIGo+EVYxCaAPih/zQXQ=
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
|
||||||
|
google.golang.org/grpc v1.81.1 h1:VnnIIZ88UzOOKLukQi+ImGz8O1Wdp8nAGGnvOfEIWQQ=
|
||||||
|
google.golang.org/grpc v1.81.1/go.mod h1:xGH9GfzOyMTGIOXBJmXt+BX/V0kcdQbdcuwQ/zNw42I=
|
||||||
|
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
|
||||||
|
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# README
|
||||||
|
|
||||||
|
## About
|
||||||
|
|
||||||
|
This is the official Wails Vanilla template.
|
||||||
|
|
||||||
|
You can configure the project by editing `wails.json`. More information about the project settings can be found
|
||||||
|
here: https://wails.io/docs/reference/project-config
|
||||||
|
|
||||||
|
## Live Development
|
||||||
|
|
||||||
|
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
|
||||||
|
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
|
||||||
|
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
|
||||||
|
to this in your browser, and you can call your Go code from devtools.
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
To build a redistributable, production mode package, use `wails build`.
|
||||||
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 176 KiB |
@@ -0,0 +1,88 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="ru">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
||||||
|
<title>Спектр</title>
|
||||||
|
<script type="module" crossorigin src="/assets/index.02c817da.js"></script>
|
||||||
|
<link rel="stylesheet" href="/assets/index.41fde905.css">
|
||||||
|
</head>
|
||||||
|
<body data-theme="dark">
|
||||||
|
|
||||||
|
<!-- Переключатель темы -->
|
||||||
|
<button id="theme-toggle" title="Сменить тему">☀</button>
|
||||||
|
|
||||||
|
<!-- Интро при запуске: закрывает всё окно приложения, потом "двери" разъезжаются -->
|
||||||
|
<div id="intro-overlay">
|
||||||
|
<div class="door door-left"></div>
|
||||||
|
<div class="door door-right"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="app">
|
||||||
|
|
||||||
|
<!-- Бренд-блок -->
|
||||||
|
<div id="brand">
|
||||||
|
<div class="logo-icon">
|
||||||
|
<img class="logo-dark" src="/assets/logo-dark.ff9a8bc7.jpg" alt="ТЭЧ ДМ" />
|
||||||
|
<img class="logo-light" src="/assets/logo-light.d5e577a8.png" alt="ТЭЧ ДМ" />
|
||||||
|
</div>
|
||||||
|
<h1>СПЕКТР</h1>
|
||||||
|
<div class="tag">видеоприёмник · панель управления</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Заголовки вкладок (пока скрыты — активен только режим приёмника) -->
|
||||||
|
<div class="tabs" hidden>
|
||||||
|
<button class="tab-button active" data-tab="receiver">Режим приемника</button>
|
||||||
|
<button class="tab-button" data-tab="detector">Режим детектора</button>
|
||||||
|
<button class="tab-button" data-tab="info">Информация</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Содержимое вкладок -->
|
||||||
|
<div class="tab-content active" id="tab-receiver">
|
||||||
|
<div class="buttons-vertical">
|
||||||
|
<button class="action-button" id="btn-check">Проверка подключения</button>
|
||||||
|
<button class="action-button" id="btn-freq">Установка частоты</button>
|
||||||
|
<button class="action-button close-button" id="btn-quit">Закрыть приложение</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Панель частоты (новая, выше статуса) -->
|
||||||
|
<div id="frequency-panel">
|
||||||
|
<span id="frequency-label">Текущая частота:</span>
|
||||||
|
<span id="frequency-value">---</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Панель состояния соединения -->
|
||||||
|
<div id="status-panel">
|
||||||
|
<span id="status-indicator" class="indicator indicator-red"></span>
|
||||||
|
<span id="status-text">Нет соединения</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-content" id="tab-detector">
|
||||||
|
<p>Здесь будет проводиться сканирование доступных частот!</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-content" id="tab-info">
|
||||||
|
<p>О программе: Версия 0.01, сделано на Wails в тэч дм!</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Модальное окно для установки частоты -->
|
||||||
|
<div id="freq-modal" class="modal hidden">
|
||||||
|
<div class="modal-content">
|
||||||
|
<span class="close-modal" id="close-modal">×</span>
|
||||||
|
<h3>Укажите желаемую частоту</h3>
|
||||||
|
<div class="freq-input-group">
|
||||||
|
<button id="btn-minus" class="freq-btn">-</button>
|
||||||
|
<input type="text" id="freq-input" value="145" />
|
||||||
|
<button id="btn-plus" class="freq-btn">+</button>
|
||||||
|
</div>
|
||||||
|
<button id="btn-set-freq" class="action-button">Установить</button>
|
||||||
|
<p id="modal-error" class="error-msg hidden"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="ru">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<link rel="stylesheet" href="./src/style.css" />
|
||||||
|
<title>Спектр</title>
|
||||||
|
</head>
|
||||||
|
<body data-theme="dark">
|
||||||
|
|
||||||
|
<!-- Переключатель темы -->
|
||||||
|
<button id="theme-toggle" title="Сменить тему">☀</button>
|
||||||
|
|
||||||
|
<!-- Интро при запуске: закрывает всё окно приложения, потом "двери" разъезжаются -->
|
||||||
|
<div id="intro-overlay">
|
||||||
|
<div class="door door-left"></div>
|
||||||
|
<div class="door door-right"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="app">
|
||||||
|
|
||||||
|
<!-- Бренд-блок -->
|
||||||
|
<div id="brand">
|
||||||
|
<div class="logo-icon">
|
||||||
|
<img class="logo-dark" src="/src/assets/images/logo-dark.jpg" alt="ТЭЧ ДМ" />
|
||||||
|
<img class="logo-light" src="/src/assets/images/logo-light.png" alt="ТЭЧ ДМ" />
|
||||||
|
</div>
|
||||||
|
<h1>СПЕКТР</h1>
|
||||||
|
<div class="tag">видеоприёмник · панель управления</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Заголовки вкладок (пока скрыты — активен только режим приёмника) -->
|
||||||
|
<div class="tabs" hidden>
|
||||||
|
<button class="tab-button active" data-tab="receiver">Режим приемника</button>
|
||||||
|
<button class="tab-button" data-tab="detector">Режим детектора</button>
|
||||||
|
<button class="tab-button" data-tab="info">Информация</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Содержимое вкладок -->
|
||||||
|
<div class="tab-content active" id="tab-receiver">
|
||||||
|
<div class="buttons-vertical">
|
||||||
|
<button class="action-button" id="btn-check">Проверка подключения</button>
|
||||||
|
<button class="action-button" id="btn-freq">Установка частоты</button>
|
||||||
|
<button class="action-button close-button" id="btn-quit">Закрыть приложение</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Панель частоты (новая, выше статуса) -->
|
||||||
|
<div id="frequency-panel">
|
||||||
|
<span id="frequency-label">Текущая частота:</span>
|
||||||
|
<span id="frequency-value">---</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Панель состояния соединения -->
|
||||||
|
<div id="status-panel">
|
||||||
|
<span id="status-indicator" class="indicator indicator-red"></span>
|
||||||
|
<span id="status-text">Нет соединения</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-content" id="tab-detector">
|
||||||
|
<p>Здесь будет проводиться сканирование доступных частот!</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-content" id="tab-info">
|
||||||
|
<p>О программе: Версия 0.01, сделано на Wails в тэч дм!</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Модальное окно для установки частоты -->
|
||||||
|
<div id="freq-modal" class="modal hidden">
|
||||||
|
<div class="modal-content">
|
||||||
|
<span class="close-modal" id="close-modal">×</span>
|
||||||
|
<h3>Укажите желаемую частоту</h3>
|
||||||
|
<div class="freq-input-group">
|
||||||
|
<button id="btn-minus" class="freq-btn">-</button>
|
||||||
|
<input type="text" id="freq-input" value="145" />
|
||||||
|
<button id="btn-plus" class="freq-btn">+</button>
|
||||||
|
</div>
|
||||||
|
<button id="btn-set-freq" class="action-button">Установить</button>
|
||||||
|
<p id="modal-error" class="error-msg hidden"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="module" src="/src/main.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,664 @@
|
|||||||
|
{
|
||||||
|
"name": "frontend",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "frontend",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"devDependencies": {
|
||||||
|
"vite": "^3.0.7"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/android-arm": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-5GT+kcs2WVGjVs7+boataCkO5Fg0y4kCjzkB5bAip7H4jfnOS3dA6KPiww9W1OEKTKeAcUVhdZGvgI65OXmUnw==",
|
||||||
|
"cpu": [
|
||||||
|
"arm"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"android"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@esbuild/linux-loong64": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-L4jVKS82XVhw2nvzLg/19ClLWg0y27ulRwuP7lcyL6AbUWB5aPglXY3M21mauDQMDfRLs8cQmeT03r/+X3cZYQ==",
|
||||||
|
"cpu": [
|
||||||
|
"loong64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/es-errors": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-x/R72SmW3sSFRm5zrrIjAhCeQSAWoni3CmHEqfQrZIQTM3lVCdehdwuIqaOtfC2slvpdlLa62GYoN8SxT23m6Q==",
|
||||||
|
"dev": true,
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"bin": {
|
||||||
|
"esbuild": "bin/esbuild"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"@esbuild/android-arm": "0.15.18",
|
||||||
|
"@esbuild/linux-loong64": "0.15.18",
|
||||||
|
"esbuild-android-64": "0.15.18",
|
||||||
|
"esbuild-android-arm64": "0.15.18",
|
||||||
|
"esbuild-darwin-64": "0.15.18",
|
||||||
|
"esbuild-darwin-arm64": "0.15.18",
|
||||||
|
"esbuild-freebsd-64": "0.15.18",
|
||||||
|
"esbuild-freebsd-arm64": "0.15.18",
|
||||||
|
"esbuild-linux-32": "0.15.18",
|
||||||
|
"esbuild-linux-64": "0.15.18",
|
||||||
|
"esbuild-linux-arm": "0.15.18",
|
||||||
|
"esbuild-linux-arm64": "0.15.18",
|
||||||
|
"esbuild-linux-mips64le": "0.15.18",
|
||||||
|
"esbuild-linux-ppc64le": "0.15.18",
|
||||||
|
"esbuild-linux-riscv64": "0.15.18",
|
||||||
|
"esbuild-linux-s390x": "0.15.18",
|
||||||
|
"esbuild-netbsd-64": "0.15.18",
|
||||||
|
"esbuild-openbsd-64": "0.15.18",
|
||||||
|
"esbuild-sunos-64": "0.15.18",
|
||||||
|
"esbuild-windows-32": "0.15.18",
|
||||||
|
"esbuild-windows-64": "0.15.18",
|
||||||
|
"esbuild-windows-arm64": "0.15.18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild-android-64": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-wnpt3OXRhcjfIDSZu9bnzT4/TNTDsOUvip0foZOUBG7QbSt//w3QV4FInVJxNhKc/ErhUxc5z4QjHtMi7/TbgA==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"android"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild-android-arm64": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-G4xu89B8FCzav9XU8EjsXacCKSG2FT7wW9J6hOc18soEHJdtWu03L3TQDGf0geNxfLTtxENKBzMSq9LlbjS8OQ==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"android"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild-darwin-64": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-2WAvs95uPnVJPuYKP0Eqx+Dl/jaYseZEUUT1sjg97TJa4oBtbAKnPnl3b5M9l51/nbx7+QAEtuummJZW0sBEmg==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild-darwin-arm64": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-tKPSxcTJ5OmNb1btVikATJ8NftlyNlc8BVNtyT/UAr62JFOhwHlnoPrhYWz09akBLHI9nElFVfWSTSRsrZiDUA==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild-freebsd-64": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-TT3uBUxkteAjR1QbsmvSsjpKjOX6UkCstr8nMr+q7zi3NuZ1oIpa8U41Y8I8dJH2fJgdC3Dj3CXO5biLQpfdZA==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"freebsd"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild-freebsd-arm64": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-R/oVr+X3Tkh+S0+tL41wRMbdWtpWB8hEAMsOXDumSSa6qJR89U0S/PpLXrGF7Wk/JykfpWNokERUpCeHDl47wA==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"freebsd"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild-linux-32": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-lphF3HiCSYtaa9p1DtXndiQEeQDKPl9eN/XNoBf2amEghugNuqXNZA/ZovthNE2aa4EN43WroO0B85xVSjYkbg==",
|
||||||
|
"cpu": [
|
||||||
|
"ia32"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild-linux-64": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-hNSeP97IviD7oxLKFuii5sDPJ+QHeiFTFLoLm7NZQligur8poNOWGIgpQ7Qf8Balb69hptMZzyOBIPtY09GZYw==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild-linux-arm": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-UH779gstRblS4aoS2qpMl3wjg7U0j+ygu3GjIeTonCcN79ZvpPee12Qun3vcdxX+37O5LFxz39XeW2I9bybMVA==",
|
||||||
|
"cpu": [
|
||||||
|
"arm"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild-linux-arm64": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-54qr8kg/6ilcxd+0V3h9rjT4qmjc0CccMVWrjOEM/pEcUzt8X62HfBSeZfT2ECpM7104mk4yfQXkosY8Quptug==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild-linux-mips64le": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-Mk6Ppwzzz3YbMl/ZZL2P0q1tnYqh/trYZ1VfNP47C31yT0K8t9s7Z077QrDA/guU60tGNp2GOwCQnp+DYv7bxQ==",
|
||||||
|
"cpu": [
|
||||||
|
"mips64el"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild-linux-ppc64le": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-b0XkN4pL9WUulPTa/VKHx2wLCgvIAbgwABGnKMY19WhKZPT+8BxhZdqz6EgkqCLld7X5qiCY2F/bfpUUlnFZ9w==",
|
||||||
|
"cpu": [
|
||||||
|
"ppc64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild-linux-riscv64": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-ba2COaoF5wL6VLZWn04k+ACZjZ6NYniMSQStodFKH/Pu6RxzQqzsmjR1t9QC89VYJxBeyVPTaHuBMCejl3O/xg==",
|
||||||
|
"cpu": [
|
||||||
|
"riscv64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild-linux-s390x": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-VbpGuXEl5FCs1wDVp93O8UIzl3ZrglgnSQ+Hu79g7hZu6te6/YHgVJxCM2SqfIila0J3k0csfnf8VD2W7u2kzQ==",
|
||||||
|
"cpu": [
|
||||||
|
"s390x"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild-netbsd-64": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-98ukeCdvdX7wr1vUYQzKo4kQ0N2p27H7I11maINv73fVEXt2kyh4K4m9f35U1K43Xc2QGXlzAw0K9yoU7JUjOg==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"netbsd"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild-openbsd-64": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-yK5NCcH31Uae076AyQAXeJzt/vxIo9+omZRKj1pauhk3ITuADzuOx5N2fdHrAKPxN+zH3w96uFKlY7yIn490xQ==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"openbsd"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild-sunos-64": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-On22LLFlBeLNj/YF3FT+cXcyKPEI263nflYlAhz5crxtp3yRG1Ugfr7ITyxmCmjm4vbN/dGrb/B7w7U8yJR9yw==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"sunos"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild-windows-32": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-o+eyLu2MjVny/nt+E0uPnBxYuJHBvho8vWsC2lV61A7wwTWC3jkN2w36jtA+yv1UgYkHRihPuQsL23hsCYGcOQ==",
|
||||||
|
"cpu": [
|
||||||
|
"ia32"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild-windows-64": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-qinug1iTTaIIrCorAUjR0fcBk24fjzEedFYhhispP8Oc7SFvs+XeW3YpAKiKp8dRpizl4YYAhxMjlftAMJiaUw==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild-windows-arm64": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-q9bsYzegpZcLziq0zgUi5KqGVtfhjxGbnksaBFYmWLxeV/S1fK4OLdq2DFYnXcLMjlZw2L0jLsk1eGoB522WXQ==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/fsevents": {
|
||||||
|
"version": "2.3.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
||||||
|
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
||||||
|
"dev": true,
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/function-bind": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||||
|
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/hasown": {
|
||||||
|
"version": "2.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
|
||||||
|
"integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"function-bind": "^1.1.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/is-core-module": {
|
||||||
|
"version": "2.16.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.2.tgz",
|
||||||
|
"integrity": "sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"hasown": "^2.0.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/nanoid": {
|
||||||
|
"version": "3.3.15",
|
||||||
|
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.15.tgz",
|
||||||
|
"integrity": "sha512-y7Wygv/7mEOvxTuEQDB8StXdMRBWf1kR/tlhAzBRUFkB2jfcLOAxO/SHmOO2zgz1pVgK29/kyupn059/bCHdjA==",
|
||||||
|
"dev": true,
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/ai"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"bin": {
|
||||||
|
"nanoid": "bin/nanoid.cjs"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/path-parse": {
|
||||||
|
"version": "1.0.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
|
||||||
|
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/picocolors": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "ISC"
|
||||||
|
},
|
||||||
|
"node_modules/postcss": {
|
||||||
|
"version": "8.5.15",
|
||||||
|
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz",
|
||||||
|
"integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==",
|
||||||
|
"dev": true,
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/postcss/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "tidelift",
|
||||||
|
"url": "https://tidelift.com/funding/github/npm/postcss"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/ai"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"nanoid": "^3.3.12",
|
||||||
|
"picocolors": "^1.1.1",
|
||||||
|
"source-map-js": "^1.2.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^10 || ^12 || >=14"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/resolve": {
|
||||||
|
"version": "1.22.12",
|
||||||
|
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.12.tgz",
|
||||||
|
"integrity": "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"es-errors": "^1.3.0",
|
||||||
|
"is-core-module": "^2.16.1",
|
||||||
|
"path-parse": "^1.0.7",
|
||||||
|
"supports-preserve-symlinks-flag": "^1.0.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"resolve": "bin/resolve"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/rollup": {
|
||||||
|
"version": "2.80.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.80.0.tgz",
|
||||||
|
"integrity": "sha512-cIFJOD1DESzpjOBl763Kp1AH7UE/0fcdHe6rZXUdQ9c50uvgigvW97u3IcSeBwOkgqL/PXPBktBCh0KEu5L8XQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"bin": {
|
||||||
|
"rollup": "dist/bin/rollup"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.0.0"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"fsevents": "~2.3.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/source-map-js": {
|
||||||
|
"version": "1.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
||||||
|
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "BSD-3-Clause",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/supports-preserve-symlinks-flag": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/vite": {
|
||||||
|
"version": "3.2.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/vite/-/vite-3.2.11.tgz",
|
||||||
|
"integrity": "sha512-K/jGKL/PgbIgKCiJo5QbASQhFiV02X9Jh+Qq0AKCRCRKZtOTVi4t6wh75FDpGf2N9rYOnzH87OEFQNaFy6pdxQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"esbuild": "^0.15.9",
|
||||||
|
"postcss": "^8.4.18",
|
||||||
|
"resolve": "^1.22.1",
|
||||||
|
"rollup": "^2.79.1"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"vite": "bin/vite.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^14.18.0 || >=16.0.0"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"fsevents": "~2.3.2"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@types/node": ">= 14",
|
||||||
|
"less": "*",
|
||||||
|
"sass": "*",
|
||||||
|
"stylus": "*",
|
||||||
|
"sugarss": "*",
|
||||||
|
"terser": "^5.4.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@types/node": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"less": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"sass": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"stylus": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"sugarss": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"terser": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"name": "frontend",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.0.0",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "node ./node_modules/vite/bin/vite.js",
|
||||||
|
"build": "node ./node_modules/vite/bin/vite.js build",
|
||||||
|
"preview": "vite preview"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"vite": "^3.0.7"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
#logo {
|
||||||
|
display: block;
|
||||||
|
width: 50%;
|
||||||
|
height: 50%;
|
||||||
|
margin: auto;
|
||||||
|
padding: 10% 0 0;
|
||||||
|
background-position: center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: 100% 100%;
|
||||||
|
background-origin: content-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result {
|
||||||
|
height: 20px;
|
||||||
|
line-height: 20px;
|
||||||
|
margin: 1.5rem auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-box .btn {
|
||||||
|
width: 60px;
|
||||||
|
height: 30px;
|
||||||
|
line-height: 30px;
|
||||||
|
border-radius: 3px;
|
||||||
|
border: none;
|
||||||
|
margin: 0 0 0 20px;
|
||||||
|
padding: 0 8px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-box .btn:hover {
|
||||||
|
background-image: linear-gradient(to top, #cfd9df 0%, #e2ebf0 100%);
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-box .input {
|
||||||
|
border: none;
|
||||||
|
border-radius: 3px;
|
||||||
|
outline: none;
|
||||||
|
height: 30px;
|
||||||
|
line-height: 30px;
|
||||||
|
padding: 0 10px;
|
||||||
|
background-color: rgba(240, 240, 240, 1);
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-box .input:hover {
|
||||||
|
border: none;
|
||||||
|
background-color: rgba(255, 255, 255, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-box .input:focus {
|
||||||
|
border: none;
|
||||||
|
background-color: rgba(255, 255, 255, 1);
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
Copyright 2016 The Nunito Project Authors (contact@sansoxygen.com),
|
||||||
|
|
||||||
|
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||||
|
This license is copied below, and is also available with a FAQ at:
|
||||||
|
http://scripts.sil.org/OFL
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------
|
||||||
|
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||||
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
PREAMBLE
|
||||||
|
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||||
|
development of collaborative font projects, to support the font creation
|
||||||
|
efforts of academic and linguistic communities, and to provide a free and
|
||||||
|
open framework in which fonts may be shared and improved in partnership
|
||||||
|
with others.
|
||||||
|
|
||||||
|
The OFL allows the licensed fonts to be used, studied, modified and
|
||||||
|
redistributed freely as long as they are not sold by themselves. The
|
||||||
|
fonts, including any derivative works, can be bundled, embedded,
|
||||||
|
redistributed and/or sold with any software provided that any reserved
|
||||||
|
names are not used by derivative works. The fonts and derivatives,
|
||||||
|
however, cannot be released under any other type of license. The
|
||||||
|
requirement for fonts to remain under this license does not apply
|
||||||
|
to any document created using the fonts or their derivatives.
|
||||||
|
|
||||||
|
DEFINITIONS
|
||||||
|
"Font Software" refers to the set of files released by the Copyright
|
||||||
|
Holder(s) under this license and clearly marked as such. This may
|
||||||
|
include source files, build scripts and documentation.
|
||||||
|
|
||||||
|
"Reserved Font Name" refers to any names specified as such after the
|
||||||
|
copyright statement(s).
|
||||||
|
|
||||||
|
"Original Version" refers to the collection of Font Software components as
|
||||||
|
distributed by the Copyright Holder(s).
|
||||||
|
|
||||||
|
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||||
|
or substituting -- in part or in whole -- any of the components of the
|
||||||
|
Original Version, by changing formats or by porting the Font Software to a
|
||||||
|
new environment.
|
||||||
|
|
||||||
|
"Author" refers to any designer, engineer, programmer, technical
|
||||||
|
writer or other person who contributed to the Font Software.
|
||||||
|
|
||||||
|
PERMISSION & CONDITIONS
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||||
|
redistribute, and sell modified and unmodified copies of the Font
|
||||||
|
Software, subject to the following conditions:
|
||||||
|
|
||||||
|
1) Neither the Font Software nor any of its individual components,
|
||||||
|
in Original or Modified Versions, may be sold by itself.
|
||||||
|
|
||||||
|
2) Original or Modified Versions of the Font Software may be bundled,
|
||||||
|
redistributed and/or sold with any software, provided that each copy
|
||||||
|
contains the above copyright notice and this license. These can be
|
||||||
|
included either as stand-alone text files, human-readable headers or
|
||||||
|
in the appropriate machine-readable metadata fields within text or
|
||||||
|
binary files as long as those fields can be easily viewed by the user.
|
||||||
|
|
||||||
|
3) No Modified Version of the Font Software may use the Reserved Font
|
||||||
|
Name(s) unless explicit written permission is granted by the corresponding
|
||||||
|
Copyright Holder. This restriction only applies to the primary font name as
|
||||||
|
presented to the users.
|
||||||
|
|
||||||
|
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||||
|
Software shall not be used to promote, endorse or advertise any
|
||||||
|
Modified Version, except to acknowledge the contribution(s) of the
|
||||||
|
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||||
|
permission.
|
||||||
|
|
||||||
|
5) The Font Software, modified or unmodified, in part or in whole,
|
||||||
|
must be distributed entirely under this license, and must not be
|
||||||
|
distributed under any other license. The requirement for fonts to
|
||||||
|
remain under this license does not apply to any document created
|
||||||
|
using the Font Software.
|
||||||
|
|
||||||
|
TERMINATION
|
||||||
|
This license becomes null and void if any of the above conditions are
|
||||||
|
not met.
|
||||||
|
|
||||||
|
DISCLAIMER
|
||||||
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||||
|
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||||
|
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||||
|
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||||
|
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||||
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 176 KiB |
|
After Width: | Height: | Size: 136 KiB |
@@ -0,0 +1,189 @@
|
|||||||
|
import {
|
||||||
|
CheckConnection,
|
||||||
|
SetFrequency,
|
||||||
|
Quit,
|
||||||
|
} from "../wailsjs/go/main/App";
|
||||||
|
|
||||||
|
// импорт через ES-модуль, а не строкой-путём — иначе vite не подставит
|
||||||
|
// правильный хэшированный путь в собранном билде (сломается в проде)
|
||||||
|
import logoDarkUrl from "./assets/images/logo-dark.jpg";
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
// === Тема (тёмная/светлая) ===
|
||||||
|
const themeToggle = document.getElementById('theme-toggle');
|
||||||
|
themeToggle.addEventListener('click', () => {
|
||||||
|
const cur = document.body.getAttribute('data-theme');
|
||||||
|
const next = cur === 'light' ? 'dark' : 'light';
|
||||||
|
document.body.setAttribute('data-theme', next);
|
||||||
|
themeToggle.textContent = next === 'light' ? '☾' : '☀';
|
||||||
|
});
|
||||||
|
|
||||||
|
// === Интро при запуске (лого "двери" разъезжаются) ===
|
||||||
|
const NATURAL_W = 640, NATURAL_H = 480;
|
||||||
|
const AXIS_X = 312; // ось раздела — середина носа черепа / верхнего зубца шестерни
|
||||||
|
const LOGO_DARK_URL = logoDarkUrl;
|
||||||
|
|
||||||
|
const introOverlay = document.getElementById('intro-overlay');
|
||||||
|
const doorLeft = document.querySelector('#intro-overlay .door-left');
|
||||||
|
const doorRight = document.querySelector('#intro-overlay .door-right');
|
||||||
|
|
||||||
|
function layoutDoors() {
|
||||||
|
const W = window.innerWidth;
|
||||||
|
const H = window.innerHeight;
|
||||||
|
const scale = Math.max(W / NATURAL_W, H / NATURAL_H); // object-fit: cover на весь размер окна
|
||||||
|
const renderW = NATURAL_W * scale;
|
||||||
|
const renderH = NATURAL_H * scale;
|
||||||
|
const offsetX = (W - renderW) / 2;
|
||||||
|
const offsetY = (H - renderH) / 2;
|
||||||
|
const axisDisplayX = offsetX + AXIS_X * scale;
|
||||||
|
|
||||||
|
const leftW = Math.max(0, Math.min(W, axisDisplayX));
|
||||||
|
const rightW = W - leftW;
|
||||||
|
|
||||||
|
doorLeft.style.width = leftW + 'px';
|
||||||
|
doorLeft.style.backgroundImage = `url(${LOGO_DARK_URL})`;
|
||||||
|
doorLeft.style.backgroundSize = renderW + 'px ' + renderH + 'px';
|
||||||
|
doorLeft.style.backgroundPosition = offsetX + 'px ' + offsetY + 'px';
|
||||||
|
|
||||||
|
doorRight.style.left = leftW + 'px';
|
||||||
|
doorRight.style.width = rightW + 'px';
|
||||||
|
doorRight.style.backgroundImage = `url(${LOGO_DARK_URL})`;
|
||||||
|
doorRight.style.backgroundSize = renderW + 'px ' + renderH + 'px';
|
||||||
|
doorRight.style.backgroundPosition = (offsetX - leftW) + 'px ' + offsetY + 'px';
|
||||||
|
}
|
||||||
|
|
||||||
|
const OPEN_AT = 2100; // момент начала разъезда дверей от старта интро, мс
|
||||||
|
const APPEAR_START = 100;
|
||||||
|
const APPEAR_DUR = 450;
|
||||||
|
|
||||||
|
function playIntro() {
|
||||||
|
introOverlay.style.display = '';
|
||||||
|
introOverlay.classList.remove('appear', 'open');
|
||||||
|
void introOverlay.offsetWidth; // reflow reset
|
||||||
|
layoutDoors();
|
||||||
|
|
||||||
|
setTimeout(() => introOverlay.classList.add('appear'), APPEAR_START);
|
||||||
|
setTimeout(() => introOverlay.classList.add('open'), OPEN_AT);
|
||||||
|
// прячем оверлей из потока/кликов после того как двери разъехались и погасли
|
||||||
|
setTimeout(() => { introOverlay.style.display = 'none'; }, OPEN_AT + 1170);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('resize', layoutDoors);
|
||||||
|
playIntro(); // main.js подключён как type="module" — DOM уже готов на этот момент
|
||||||
|
|
||||||
|
// === Переключение вкладок ===
|
||||||
|
const tabButtons = document.querySelectorAll('.tab-button');
|
||||||
|
const tabContents = document.querySelectorAll('.tab-content');
|
||||||
|
|
||||||
|
tabButtons.forEach(button => {
|
||||||
|
button.addEventListener('click', () => {
|
||||||
|
tabButtons.forEach(btn => btn.classList.remove('active'));
|
||||||
|
tabContents.forEach(content => content.classList.remove('active'));
|
||||||
|
button.classList.add('active');
|
||||||
|
const tabId = button.getAttribute('data-tab');
|
||||||
|
document.getElementById(`tab-${tabId}`).classList.add('active');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// === Элементы интерфейса ===
|
||||||
|
const btnCheck = document.getElementById('btn-check');
|
||||||
|
const btnFreq = document.getElementById('btn-freq');
|
||||||
|
const btnQuit = document.getElementById('btn-quit');
|
||||||
|
const statusIndicator = document.getElementById('status-indicator');
|
||||||
|
const statusText = document.getElementById('status-text');
|
||||||
|
const freqLabel = document.getElementById('frequency-label');
|
||||||
|
const freqValue = document.getElementById('frequency-value');
|
||||||
|
|
||||||
|
// Модальное окно
|
||||||
|
const modal = document.getElementById('freq-modal');
|
||||||
|
const closeModal = document.getElementById('close-modal');
|
||||||
|
const freqInput = document.getElementById('freq-input');
|
||||||
|
const btnMinus = document.getElementById('btn-minus');
|
||||||
|
const btnPlus = document.getElementById('btn-plus');
|
||||||
|
const btnSetFreq = document.getElementById('btn-set-freq');
|
||||||
|
const modalError = document.getElementById('modal-error');
|
||||||
|
|
||||||
|
// === Проверка подключения ===
|
||||||
|
btnCheck.addEventListener('click', () => {
|
||||||
|
CheckConnection()
|
||||||
|
.then((response) => {
|
||||||
|
// Обновление индикатора соединения
|
||||||
|
statusIndicator.classList.remove('indicator-red');
|
||||||
|
statusIndicator.classList.add('indicator-green');
|
||||||
|
statusText.textContent = `Соединение установлено! ${response.status}`;
|
||||||
|
|
||||||
|
// Обновление панели частоты (текущая)
|
||||||
|
freqLabel.textContent = 'Текущая частота:';
|
||||||
|
freqValue.textContent = response.frequency;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.error('Ошибка CheckConnection:', err);
|
||||||
|
statusText.textContent = 'Ошибка: не удалось выполнить проверку';
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// === Установка частоты (открытие модального окна) ===
|
||||||
|
btnFreq.addEventListener('click', () => {
|
||||||
|
modal.classList.remove('hidden');
|
||||||
|
// Показываем текущую частоту из панели (или 145)
|
||||||
|
const current = freqValue.textContent !== '---' ? freqValue.textContent : '145';
|
||||||
|
freqInput.value = current;
|
||||||
|
modalError.classList.add('hidden');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Закрытие модального окна
|
||||||
|
closeModal.addEventListener('click', () => {
|
||||||
|
modal.classList.add('hidden');
|
||||||
|
});
|
||||||
|
window.addEventListener('click', (e) => {
|
||||||
|
if (e.target === modal) {
|
||||||
|
modal.classList.add('hidden');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Кнопки +/- для изменения значения на 1
|
||||||
|
btnMinus.addEventListener('click', () => {
|
||||||
|
let val = parseInt(freqInput.value, 10) || 1;
|
||||||
|
val = Math.max(1, val - 1); // минимум 1
|
||||||
|
freqInput.value = val.toString();
|
||||||
|
});
|
||||||
|
btnPlus.addEventListener('click', () => {
|
||||||
|
let val = parseInt(freqInput.value, 10) || 1;
|
||||||
|
val += 1;
|
||||||
|
freqInput.value = val.toString();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Кнопка "Установить"
|
||||||
|
btnSetFreq.addEventListener('click', () => {
|
||||||
|
const inputVal = freqInput.value.trim();
|
||||||
|
// Проверка: только цифры
|
||||||
|
if (!/^\d+$/.test(inputVal)) {
|
||||||
|
modalError.textContent = 'Вводимое значение должно быть целым положительным числом';
|
||||||
|
modalError.classList.remove('hidden');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const num = parseInt(inputVal, 10);
|
||||||
|
if (num <= 0) {
|
||||||
|
modalError.textContent = 'Вводимое значение должно быть целым положительным числом';
|
||||||
|
modalError.classList.remove('hidden');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetFrequency(inputVal)
|
||||||
|
.then((newFreq) => {
|
||||||
|
// Обновляем панель частоты
|
||||||
|
freqLabel.textContent = 'Установленная частота:';
|
||||||
|
freqValue.textContent = newFreq;
|
||||||
|
modal.classList.add('hidden');
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
modalError.textContent = err;
|
||||||
|
modalError.classList.remove('hidden');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// === Закрыть приложение ===
|
||||||
|
btnQuit.addEventListener('click', () => {
|
||||||
|
Quit();
|
||||||
|
});
|
||||||
|
})();
|
||||||
@@ -0,0 +1,343 @@
|
|||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
html, body {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===================== ТЕМА (тёмная/светлая) ===================== */
|
||||||
|
body {
|
||||||
|
background: radial-gradient(circle at 50% 18%, #1a1d24 0%, #0d0f13 70%);
|
||||||
|
transition: background 0.3s ease;
|
||||||
|
}
|
||||||
|
body[data-theme="light"] {
|
||||||
|
background: radial-gradient(circle at 50% 18%, #ffffff 0%, #dde1e7 70%);
|
||||||
|
}
|
||||||
|
|
||||||
|
#theme-toggle {
|
||||||
|
position: fixed;
|
||||||
|
top: 16px; right: 18px;
|
||||||
|
z-index: 500;
|
||||||
|
width: 34px; height: 34px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 1px solid #333a46;
|
||||||
|
background: #222a37;
|
||||||
|
color: #ccc;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 14px;
|
||||||
|
display: flex; align-items: center; justify-content: center;
|
||||||
|
}
|
||||||
|
body[data-theme="light"] #theme-toggle {
|
||||||
|
border-color: #c7cbd1;
|
||||||
|
background: #ffffff;
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===================== КАРТОЧКА ПРИЛОЖЕНИЯ ===================== */
|
||||||
|
#app {
|
||||||
|
width: 360px;
|
||||||
|
border-radius: 14px;
|
||||||
|
box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
|
||||||
|
overflow: hidden;
|
||||||
|
background: #1b1e24;
|
||||||
|
transition: background 0.3s ease;
|
||||||
|
}
|
||||||
|
body[data-theme="light"] #app {
|
||||||
|
background: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- бренд-блок ---- */
|
||||||
|
#brand {
|
||||||
|
display: flex; flex-direction: column; align-items: center;
|
||||||
|
padding: 26px 24px 16px;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
.logo-icon {
|
||||||
|
position: relative;
|
||||||
|
width: 64px; height: 48px; /* пропорции 640:480 исходного лого */
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
.logo-icon img {
|
||||||
|
position: absolute; inset: 0;
|
||||||
|
width: 100%; height: 100%;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
.logo-icon .logo-dark { mix-blend-mode: screen; display: block; }
|
||||||
|
.logo-icon .logo-light { mix-blend-mode: multiply; display: none; }
|
||||||
|
body[data-theme="light"] .logo-icon .logo-dark { display: none; }
|
||||||
|
body[data-theme="light"] .logo-icon .logo-light { display: block; }
|
||||||
|
|
||||||
|
#brand h1 {
|
||||||
|
color: #eeeeee;
|
||||||
|
font-size: 21px;
|
||||||
|
letter-spacing: 3.5px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
#brand .tag {
|
||||||
|
color: #7a7f89;
|
||||||
|
font-size: 11px;
|
||||||
|
letter-spacing: 1.2px;
|
||||||
|
}
|
||||||
|
body[data-theme="light"] #brand h1 { color: #1b1d22; }
|
||||||
|
body[data-theme="light"] #brand .tag { color: #888d97; }
|
||||||
|
|
||||||
|
/* Панель вкладок (пока скрыта атрибутом hidden в HTML) */
|
||||||
|
.tabs {
|
||||||
|
display: flex;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
.tabs[hidden] {
|
||||||
|
display: none; /* без этого .tabs{display:flex} выше перебивает атрибут hidden */
|
||||||
|
}
|
||||||
|
.tab-button {
|
||||||
|
flex: 1;
|
||||||
|
padding: 12px;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #9aa0aa;
|
||||||
|
transition: background 0.2s;
|
||||||
|
}
|
||||||
|
.tab-button:hover { background: rgba(255,255,255,0.05); }
|
||||||
|
.tab-button.active {
|
||||||
|
color: #eee;
|
||||||
|
border-bottom: 2px solid #b8362a;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
body[data-theme="light"] .tab-button { color: #7a7f89; }
|
||||||
|
body[data-theme="light"] .tab-button.active { color: #1b1d22; }
|
||||||
|
|
||||||
|
/* Содержимое вкладок */
|
||||||
|
.tab-content { display: none; padding: 4px 22px 24px; }
|
||||||
|
.tab-content.active { display: block; }
|
||||||
|
|
||||||
|
/* Вертикально расположенные кнопки */
|
||||||
|
.buttons-vertical {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-button {
|
||||||
|
padding: 11px;
|
||||||
|
font-size: 14px;
|
||||||
|
cursor: pointer;
|
||||||
|
border: 1px solid #2a2d34;
|
||||||
|
border-radius: 8px;
|
||||||
|
background-color: #15171c;
|
||||||
|
color: #e8e8e8;
|
||||||
|
transition: background-color 0.2s, border-color 0.2s;
|
||||||
|
}
|
||||||
|
.action-button:hover {
|
||||||
|
background-color: #1d2027;
|
||||||
|
border-color: #3a3e46;
|
||||||
|
}
|
||||||
|
body[data-theme="light"] .action-button {
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-color: #ccd1d9;
|
||||||
|
color: #22242a;
|
||||||
|
}
|
||||||
|
body[data-theme="light"] .action-button:hover {
|
||||||
|
background-color: #f0f2f5;
|
||||||
|
border-color: #aeb4bd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-button {
|
||||||
|
background-color: #b8362a;
|
||||||
|
color: white;
|
||||||
|
border-color: #8f2a20;
|
||||||
|
}
|
||||||
|
.close-button:hover { background-color: #c73f31; }
|
||||||
|
body[data-theme="light"] .close-button {
|
||||||
|
background-color: #e74c3c;
|
||||||
|
border-color: #c0392b;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
body[data-theme="light"] .close-button:hover { background-color: #d8432f; }
|
||||||
|
|
||||||
|
/* Панель частоты */
|
||||||
|
#frequency-panel {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: 9px 13px;
|
||||||
|
background-color: #15171c;
|
||||||
|
border: 1px solid #2a2d34;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-bottom: 9px;
|
||||||
|
}
|
||||||
|
#frequency-label { font-weight: bold; color: #9aa0aa; font-size: 13px; }
|
||||||
|
#frequency-value { font-size: 17px; color: #f2f2f2; }
|
||||||
|
body[data-theme="light"] #frequency-panel { background-color: #ffffff; border-color: #ccd1d9; }
|
||||||
|
body[data-theme="light"] #frequency-label { color: #7a7f89; }
|
||||||
|
body[data-theme="light"] #frequency-value { color: #1b1d22; }
|
||||||
|
|
||||||
|
/* Панель статуса */
|
||||||
|
#status-panel {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 9px;
|
||||||
|
padding: 9px 13px;
|
||||||
|
background-color: #15171c;
|
||||||
|
border: 1px solid #2a2d34;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
body[data-theme="light"] #status-panel { background-color: #ffffff; border-color: #ccd1d9; }
|
||||||
|
|
||||||
|
.indicator {
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
border-radius: 50%;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
.indicator-red { background-color: #e74c3c; }
|
||||||
|
.indicator-green { background-color: #2ecc71; }
|
||||||
|
|
||||||
|
#status-text { font-size: 14px; color: #ddd; }
|
||||||
|
body[data-theme="light"] #status-text { color: #333; }
|
||||||
|
|
||||||
|
/* ===================== ИНТРО (двери) ===================== */
|
||||||
|
#intro-overlay {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
z-index: 1000;
|
||||||
|
background: #000; /* подстраховка: перекрывает всё, даже пока JS ещё не выставил размеры дверей */
|
||||||
|
transform: scale(1.04);
|
||||||
|
}
|
||||||
|
#intro-overlay.appear {
|
||||||
|
animation: introPop 0.45s cubic-bezier(.2,.9,.3,1) forwards;
|
||||||
|
}
|
||||||
|
@keyframes introPop { to { transform: scale(1); } }
|
||||||
|
|
||||||
|
.door {
|
||||||
|
position: absolute;
|
||||||
|
top: 0; bottom: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
background-color: #000;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
transition: transform 1.17s cubic-bezier(.65,0,.35,1);
|
||||||
|
}
|
||||||
|
.door-left { left: 0; }
|
||||||
|
.door-right { left: 0; } /* left/width выставляются из JS под реальный размер окна */
|
||||||
|
|
||||||
|
#intro-overlay.open .door-left { transform: translateX(-100%); }
|
||||||
|
#intro-overlay.open .door-right { transform: translateX(100%); }
|
||||||
|
#intro-overlay.open {
|
||||||
|
transition: opacity 0.45s ease 0.65s;
|
||||||
|
opacity: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Модальное окно */
|
||||||
|
.modal {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: rgba(0,0,0,0.5);
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-content {
|
||||||
|
background: #1b1e24;
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 8px;
|
||||||
|
width: 300px;
|
||||||
|
box-shadow: 0 5px 15px rgba(0,0,0,0.4);
|
||||||
|
position: relative;
|
||||||
|
color: #eee;
|
||||||
|
}
|
||||||
|
body[data-theme="light"] .modal-content {
|
||||||
|
background: #ffffff;
|
||||||
|
color: #222;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-modal {
|
||||||
|
position: absolute;
|
||||||
|
top: 10px;
|
||||||
|
right: 15px;
|
||||||
|
font-size: 22px;
|
||||||
|
cursor: pointer;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
.close-modal:hover { color: #eee; }
|
||||||
|
body[data-theme="light"] .close-modal { color: #777; }
|
||||||
|
body[data-theme="light"] .close-modal:hover { color: #333; }
|
||||||
|
|
||||||
|
.modal-content h3 {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.freq-input-group {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 10px;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.freq-btn {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
font-size: 20px;
|
||||||
|
background: #b8362a;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.2s;
|
||||||
|
}
|
||||||
|
.freq-btn:hover { background: #c73f31; }
|
||||||
|
|
||||||
|
#freq-input {
|
||||||
|
width: 100px;
|
||||||
|
padding: 8px;
|
||||||
|
font-size: 18px;
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid #444;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: #15171c;
|
||||||
|
color: #eee;
|
||||||
|
}
|
||||||
|
body[data-theme="light"] #freq-input {
|
||||||
|
border-color: #ccc;
|
||||||
|
background: #fff;
|
||||||
|
color: #222;
|
||||||
|
}
|
||||||
|
|
||||||
|
#btn-set-freq {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-msg {
|
||||||
|
color: #e74c3c;
|
||||||
|
margin-top: 8px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-msg.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||||
|
// This file is automatically generated. DO NOT EDIT
|
||||||
|
import {main} from '../models';
|
||||||
|
|
||||||
|
export function CheckConnection():Promise<main.DeviceResponse>;
|
||||||
|
|
||||||
|
export function Quit():Promise<void>;
|
||||||
|
|
||||||
|
export function SetFrequency(arg1:string):Promise<string>;
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
// @ts-check
|
||||||
|
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||||
|
// This file is automatically generated. DO NOT EDIT
|
||||||
|
|
||||||
|
export function CheckConnection() {
|
||||||
|
return window['go']['main']['App']['CheckConnection']();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Quit() {
|
||||||
|
return window['go']['main']['App']['Quit']();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SetFrequency(arg1) {
|
||||||
|
return window['go']['main']['App']['SetFrequency'](arg1);
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
export namespace main {
|
||||||
|
|
||||||
|
export class DeviceResponse {
|
||||||
|
status: string;
|
||||||
|
frequency: string;
|
||||||
|
|
||||||
|
static createFrom(source: any = {}) {
|
||||||
|
return new DeviceResponse(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(source: any = {}) {
|
||||||
|
if ('string' === typeof source) source = JSON.parse(source);
|
||||||
|
this.status = source["status"];
|
||||||
|
this.frequency = source["frequency"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"name": "@wailsapp/runtime",
|
||||||
|
"version": "2.0.0",
|
||||||
|
"description": "Wails Javascript runtime library",
|
||||||
|
"main": "runtime.js",
|
||||||
|
"types": "runtime.d.ts",
|
||||||
|
"scripts": {
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/wailsapp/wails.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"Wails",
|
||||||
|
"Javascript",
|
||||||
|
"Go"
|
||||||
|
],
|
||||||
|
"author": "Lea Anthony <lea.anthony@gmail.com>",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/wailsapp/wails/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/wailsapp/wails#readme"
|
||||||
|
}
|
||||||
@@ -0,0 +1,330 @@
|
|||||||
|
/*
|
||||||
|
_ __ _ __
|
||||||
|
| | / /___ _(_) /____
|
||||||
|
| | /| / / __ `/ / / ___/
|
||||||
|
| |/ |/ / /_/ / / (__ )
|
||||||
|
|__/|__/\__,_/_/_/____/
|
||||||
|
The electron alternative for Go
|
||||||
|
(c) Lea Anthony 2019-present
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface Position {
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Size {
|
||||||
|
w: number;
|
||||||
|
h: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Screen {
|
||||||
|
isCurrent: boolean;
|
||||||
|
isPrimary: boolean;
|
||||||
|
width : number
|
||||||
|
height : number
|
||||||
|
}
|
||||||
|
|
||||||
|
// Environment information such as platform, buildtype, ...
|
||||||
|
export interface EnvironmentInfo {
|
||||||
|
buildType: string;
|
||||||
|
platform: string;
|
||||||
|
arch: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// [EventsEmit](https://wails.io/docs/reference/runtime/events#eventsemit)
|
||||||
|
// emits the given event. Optional data may be passed with the event.
|
||||||
|
// This will trigger any event listeners.
|
||||||
|
export function EventsEmit(eventName: string, ...data: any): void;
|
||||||
|
|
||||||
|
// [EventsOn](https://wails.io/docs/reference/runtime/events#eventson) sets up a listener for the given event name.
|
||||||
|
export function EventsOn(eventName: string, callback: (...data: any) => void): () => void;
|
||||||
|
|
||||||
|
// [EventsOnMultiple](https://wails.io/docs/reference/runtime/events#eventsonmultiple)
|
||||||
|
// sets up a listener for the given event name, but will only trigger a given number times.
|
||||||
|
export function EventsOnMultiple(eventName: string, callback: (...data: any) => void, maxCallbacks: number): () => void;
|
||||||
|
|
||||||
|
// [EventsOnce](https://wails.io/docs/reference/runtime/events#eventsonce)
|
||||||
|
// sets up a listener for the given event name, but will only trigger once.
|
||||||
|
export function EventsOnce(eventName: string, callback: (...data: any) => void): () => void;
|
||||||
|
|
||||||
|
// [EventsOff](https://wails.io/docs/reference/runtime/events#eventsoff)
|
||||||
|
// unregisters the listener for the given event name.
|
||||||
|
export function EventsOff(eventName: string, ...additionalEventNames: string[]): void;
|
||||||
|
|
||||||
|
// [EventsOffAll](https://wails.io/docs/reference/runtime/events#eventsoffall)
|
||||||
|
// unregisters all listeners.
|
||||||
|
export function EventsOffAll(): void;
|
||||||
|
|
||||||
|
// [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
|
||||||
|
// logs the given message as a raw message
|
||||||
|
export function LogPrint(message: string): void;
|
||||||
|
|
||||||
|
// [LogTrace](https://wails.io/docs/reference/runtime/log#logtrace)
|
||||||
|
// logs the given message at the `trace` log level.
|
||||||
|
export function LogTrace(message: string): void;
|
||||||
|
|
||||||
|
// [LogDebug](https://wails.io/docs/reference/runtime/log#logdebug)
|
||||||
|
// logs the given message at the `debug` log level.
|
||||||
|
export function LogDebug(message: string): void;
|
||||||
|
|
||||||
|
// [LogError](https://wails.io/docs/reference/runtime/log#logerror)
|
||||||
|
// logs the given message at the `error` log level.
|
||||||
|
export function LogError(message: string): void;
|
||||||
|
|
||||||
|
// [LogFatal](https://wails.io/docs/reference/runtime/log#logfatal)
|
||||||
|
// logs the given message at the `fatal` log level.
|
||||||
|
// The application will quit after calling this method.
|
||||||
|
export function LogFatal(message: string): void;
|
||||||
|
|
||||||
|
// [LogInfo](https://wails.io/docs/reference/runtime/log#loginfo)
|
||||||
|
// logs the given message at the `info` log level.
|
||||||
|
export function LogInfo(message: string): void;
|
||||||
|
|
||||||
|
// [LogWarning](https://wails.io/docs/reference/runtime/log#logwarning)
|
||||||
|
// logs the given message at the `warning` log level.
|
||||||
|
export function LogWarning(message: string): void;
|
||||||
|
|
||||||
|
// [WindowReload](https://wails.io/docs/reference/runtime/window#windowreload)
|
||||||
|
// Forces a reload by the main application as well as connected browsers.
|
||||||
|
export function WindowReload(): void;
|
||||||
|
|
||||||
|
// [WindowReloadApp](https://wails.io/docs/reference/runtime/window#windowreloadapp)
|
||||||
|
// Reloads the application frontend.
|
||||||
|
export function WindowReloadApp(): void;
|
||||||
|
|
||||||
|
// [WindowSetAlwaysOnTop](https://wails.io/docs/reference/runtime/window#windowsetalwaysontop)
|
||||||
|
// Sets the window AlwaysOnTop or not on top.
|
||||||
|
export function WindowSetAlwaysOnTop(b: boolean): void;
|
||||||
|
|
||||||
|
// [WindowSetSystemDefaultTheme](https://wails.io/docs/next/reference/runtime/window#windowsetsystemdefaulttheme)
|
||||||
|
// *Windows only*
|
||||||
|
// Sets window theme to system default (dark/light).
|
||||||
|
export function WindowSetSystemDefaultTheme(): void;
|
||||||
|
|
||||||
|
// [WindowSetLightTheme](https://wails.io/docs/next/reference/runtime/window#windowsetlighttheme)
|
||||||
|
// *Windows only*
|
||||||
|
// Sets window to light theme.
|
||||||
|
export function WindowSetLightTheme(): void;
|
||||||
|
|
||||||
|
// [WindowSetDarkTheme](https://wails.io/docs/next/reference/runtime/window#windowsetdarktheme)
|
||||||
|
// *Windows only*
|
||||||
|
// Sets window to dark theme.
|
||||||
|
export function WindowSetDarkTheme(): void;
|
||||||
|
|
||||||
|
// [WindowCenter](https://wails.io/docs/reference/runtime/window#windowcenter)
|
||||||
|
// Centers the window on the monitor the window is currently on.
|
||||||
|
export function WindowCenter(): void;
|
||||||
|
|
||||||
|
// [WindowSetTitle](https://wails.io/docs/reference/runtime/window#windowsettitle)
|
||||||
|
// Sets the text in the window title bar.
|
||||||
|
export function WindowSetTitle(title: string): void;
|
||||||
|
|
||||||
|
// [WindowFullscreen](https://wails.io/docs/reference/runtime/window#windowfullscreen)
|
||||||
|
// Makes the window full screen.
|
||||||
|
export function WindowFullscreen(): void;
|
||||||
|
|
||||||
|
// [WindowUnfullscreen](https://wails.io/docs/reference/runtime/window#windowunfullscreen)
|
||||||
|
// Restores the previous window dimensions and position prior to full screen.
|
||||||
|
export function WindowUnfullscreen(): void;
|
||||||
|
|
||||||
|
// [WindowIsFullscreen](https://wails.io/docs/reference/runtime/window#windowisfullscreen)
|
||||||
|
// Returns the state of the window, i.e. whether the window is in full screen mode or not.
|
||||||
|
export function WindowIsFullscreen(): Promise<boolean>;
|
||||||
|
|
||||||
|
// [WindowSetSize](https://wails.io/docs/reference/runtime/window#windowsetsize)
|
||||||
|
// Sets the width and height of the window.
|
||||||
|
export function WindowSetSize(width: number, height: number): void;
|
||||||
|
|
||||||
|
// [WindowGetSize](https://wails.io/docs/reference/runtime/window#windowgetsize)
|
||||||
|
// Gets the width and height of the window.
|
||||||
|
export function WindowGetSize(): Promise<Size>;
|
||||||
|
|
||||||
|
// [WindowSetMaxSize](https://wails.io/docs/reference/runtime/window#windowsetmaxsize)
|
||||||
|
// Sets the maximum window size. Will resize the window if the window is currently larger than the given dimensions.
|
||||||
|
// Setting a size of 0,0 will disable this constraint.
|
||||||
|
export function WindowSetMaxSize(width: number, height: number): void;
|
||||||
|
|
||||||
|
// [WindowSetMinSize](https://wails.io/docs/reference/runtime/window#windowsetminsize)
|
||||||
|
// Sets the minimum window size. Will resize the window if the window is currently smaller than the given dimensions.
|
||||||
|
// Setting a size of 0,0 will disable this constraint.
|
||||||
|
export function WindowSetMinSize(width: number, height: number): void;
|
||||||
|
|
||||||
|
// [WindowSetPosition](https://wails.io/docs/reference/runtime/window#windowsetposition)
|
||||||
|
// Sets the window position relative to the monitor the window is currently on.
|
||||||
|
export function WindowSetPosition(x: number, y: number): void;
|
||||||
|
|
||||||
|
// [WindowGetPosition](https://wails.io/docs/reference/runtime/window#windowgetposition)
|
||||||
|
// Gets the window position relative to the monitor the window is currently on.
|
||||||
|
export function WindowGetPosition(): Promise<Position>;
|
||||||
|
|
||||||
|
// [WindowHide](https://wails.io/docs/reference/runtime/window#windowhide)
|
||||||
|
// Hides the window.
|
||||||
|
export function WindowHide(): void;
|
||||||
|
|
||||||
|
// [WindowShow](https://wails.io/docs/reference/runtime/window#windowshow)
|
||||||
|
// Shows the window, if it is currently hidden.
|
||||||
|
export function WindowShow(): void;
|
||||||
|
|
||||||
|
// [WindowMaximise](https://wails.io/docs/reference/runtime/window#windowmaximise)
|
||||||
|
// Maximises the window to fill the screen.
|
||||||
|
export function WindowMaximise(): void;
|
||||||
|
|
||||||
|
// [WindowToggleMaximise](https://wails.io/docs/reference/runtime/window#windowtogglemaximise)
|
||||||
|
// Toggles between Maximised and UnMaximised.
|
||||||
|
export function WindowToggleMaximise(): void;
|
||||||
|
|
||||||
|
// [WindowUnmaximise](https://wails.io/docs/reference/runtime/window#windowunmaximise)
|
||||||
|
// Restores the window to the dimensions and position prior to maximising.
|
||||||
|
export function WindowUnmaximise(): void;
|
||||||
|
|
||||||
|
// [WindowIsMaximised](https://wails.io/docs/reference/runtime/window#windowismaximised)
|
||||||
|
// Returns the state of the window, i.e. whether the window is maximised or not.
|
||||||
|
export function WindowIsMaximised(): Promise<boolean>;
|
||||||
|
|
||||||
|
// [WindowMinimise](https://wails.io/docs/reference/runtime/window#windowminimise)
|
||||||
|
// Minimises the window.
|
||||||
|
export function WindowMinimise(): void;
|
||||||
|
|
||||||
|
// [WindowUnminimise](https://wails.io/docs/reference/runtime/window#windowunminimise)
|
||||||
|
// Restores the window to the dimensions and position prior to minimising.
|
||||||
|
export function WindowUnminimise(): void;
|
||||||
|
|
||||||
|
// [WindowIsMinimised](https://wails.io/docs/reference/runtime/window#windowisminimised)
|
||||||
|
// Returns the state of the window, i.e. whether the window is minimised or not.
|
||||||
|
export function WindowIsMinimised(): Promise<boolean>;
|
||||||
|
|
||||||
|
// [WindowIsNormal](https://wails.io/docs/reference/runtime/window#windowisnormal)
|
||||||
|
// Returns the state of the window, i.e. whether the window is normal or not.
|
||||||
|
export function WindowIsNormal(): Promise<boolean>;
|
||||||
|
|
||||||
|
// [WindowSetBackgroundColour](https://wails.io/docs/reference/runtime/window#windowsetbackgroundcolour)
|
||||||
|
// Sets the background colour of the window to the given RGBA colour definition. This colour will show through for all transparent pixels.
|
||||||
|
export function WindowSetBackgroundColour(R: number, G: number, B: number, A: number): void;
|
||||||
|
|
||||||
|
// [ScreenGetAll](https://wails.io/docs/reference/runtime/window#screengetall)
|
||||||
|
// Gets the all screens. Call this anew each time you want to refresh data from the underlying windowing system.
|
||||||
|
export function ScreenGetAll(): Promise<Screen[]>;
|
||||||
|
|
||||||
|
// [BrowserOpenURL](https://wails.io/docs/reference/runtime/browser#browseropenurl)
|
||||||
|
// Opens the given URL in the system browser.
|
||||||
|
export function BrowserOpenURL(url: string): void;
|
||||||
|
|
||||||
|
// [Environment](https://wails.io/docs/reference/runtime/intro#environment)
|
||||||
|
// Returns information about the environment
|
||||||
|
export function Environment(): Promise<EnvironmentInfo>;
|
||||||
|
|
||||||
|
// [Quit](https://wails.io/docs/reference/runtime/intro#quit)
|
||||||
|
// Quits the application.
|
||||||
|
export function Quit(): void;
|
||||||
|
|
||||||
|
// [Hide](https://wails.io/docs/reference/runtime/intro#hide)
|
||||||
|
// Hides the application.
|
||||||
|
export function Hide(): void;
|
||||||
|
|
||||||
|
// [Show](https://wails.io/docs/reference/runtime/intro#show)
|
||||||
|
// Shows the application.
|
||||||
|
export function Show(): void;
|
||||||
|
|
||||||
|
// [ClipboardGetText](https://wails.io/docs/reference/runtime/clipboard#clipboardgettext)
|
||||||
|
// Returns the current text stored on clipboard
|
||||||
|
export function ClipboardGetText(): Promise<string>;
|
||||||
|
|
||||||
|
// [ClipboardSetText](https://wails.io/docs/reference/runtime/clipboard#clipboardsettext)
|
||||||
|
// Sets a text on the clipboard
|
||||||
|
export function ClipboardSetText(text: string): Promise<boolean>;
|
||||||
|
|
||||||
|
// [OnFileDrop](https://wails.io/docs/reference/runtime/draganddrop#onfiledrop)
|
||||||
|
// OnFileDrop listens to drag and drop events and calls the callback with the coordinates of the drop and an array of path strings.
|
||||||
|
export function OnFileDrop(callback: (x: number, y: number ,paths: string[]) => void, useDropTarget: boolean) :void
|
||||||
|
|
||||||
|
// [OnFileDropOff](https://wails.io/docs/reference/runtime/draganddrop#dragandddropoff)
|
||||||
|
// OnFileDropOff removes the drag and drop listeners and handlers.
|
||||||
|
export function OnFileDropOff() :void
|
||||||
|
|
||||||
|
// Check if the file path resolver is available
|
||||||
|
export function CanResolveFilePaths(): boolean;
|
||||||
|
|
||||||
|
// Resolves file paths for an array of files
|
||||||
|
export function ResolveFilePaths(files: File[]): void
|
||||||
|
|
||||||
|
// Notification types
|
||||||
|
export interface NotificationOptions {
|
||||||
|
id: string;
|
||||||
|
title: string;
|
||||||
|
subtitle?: string; // macOS and Linux only
|
||||||
|
body?: string;
|
||||||
|
categoryId?: string;
|
||||||
|
data?: { [key: string]: any };
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface NotificationAction {
|
||||||
|
id?: string;
|
||||||
|
title?: string;
|
||||||
|
destructive?: boolean; // macOS-specific
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface NotificationCategory {
|
||||||
|
id?: string;
|
||||||
|
actions?: NotificationAction[];
|
||||||
|
hasReplyField?: boolean;
|
||||||
|
replyPlaceholder?: string;
|
||||||
|
replyButtonTitle?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// [InitializeNotifications](https://wails.io/docs/reference/runtime/notification#initializenotifications)
|
||||||
|
// Initializes the notification service for the application.
|
||||||
|
// This must be called before sending any notifications.
|
||||||
|
export function InitializeNotifications(): Promise<void>;
|
||||||
|
|
||||||
|
// [CleanupNotifications](https://wails.io/docs/reference/runtime/notification#cleanupnotifications)
|
||||||
|
// Cleans up notification resources and releases any held connections.
|
||||||
|
export function CleanupNotifications(): Promise<void>;
|
||||||
|
|
||||||
|
// [IsNotificationAvailable](https://wails.io/docs/reference/runtime/notification#isnotificationavailable)
|
||||||
|
// Checks if notifications are available on the current platform.
|
||||||
|
export function IsNotificationAvailable(): Promise<boolean>;
|
||||||
|
|
||||||
|
// [RequestNotificationAuthorization](https://wails.io/docs/reference/runtime/notification#requestnotificationauthorization)
|
||||||
|
// Requests notification authorization from the user (macOS only).
|
||||||
|
export function RequestNotificationAuthorization(): Promise<boolean>;
|
||||||
|
|
||||||
|
// [CheckNotificationAuthorization](https://wails.io/docs/reference/runtime/notification#checknotificationauthorization)
|
||||||
|
// Checks the current notification authorization status (macOS only).
|
||||||
|
export function CheckNotificationAuthorization(): Promise<boolean>;
|
||||||
|
|
||||||
|
// [SendNotification](https://wails.io/docs/reference/runtime/notification#sendnotification)
|
||||||
|
// Sends a basic notification with the given options.
|
||||||
|
export function SendNotification(options: NotificationOptions): Promise<void>;
|
||||||
|
|
||||||
|
// [SendNotificationWithActions](https://wails.io/docs/reference/runtime/notification#sendnotificationwithactions)
|
||||||
|
// Sends a notification with action buttons. Requires a registered category.
|
||||||
|
export function SendNotificationWithActions(options: NotificationOptions): Promise<void>;
|
||||||
|
|
||||||
|
// [RegisterNotificationCategory](https://wails.io/docs/reference/runtime/notification#registernotificationcategory)
|
||||||
|
// Registers a notification category that can be used with SendNotificationWithActions.
|
||||||
|
export function RegisterNotificationCategory(category: NotificationCategory): Promise<void>;
|
||||||
|
|
||||||
|
// [RemoveNotificationCategory](https://wails.io/docs/reference/runtime/notification#removenotificationcategory)
|
||||||
|
// Removes a previously registered notification category.
|
||||||
|
export function RemoveNotificationCategory(categoryId: string): Promise<void>;
|
||||||
|
|
||||||
|
// [RemoveAllPendingNotifications](https://wails.io/docs/reference/runtime/notification#removeallpendingnotifications)
|
||||||
|
// Removes all pending notifications from the notification center.
|
||||||
|
export function RemoveAllPendingNotifications(): Promise<void>;
|
||||||
|
|
||||||
|
// [RemovePendingNotification](https://wails.io/docs/reference/runtime/notification#removependingnotification)
|
||||||
|
// Removes a specific pending notification by its identifier.
|
||||||
|
export function RemovePendingNotification(identifier: string): Promise<void>;
|
||||||
|
|
||||||
|
// [RemoveAllDeliveredNotifications](https://wails.io/docs/reference/runtime/notification#removealldeliverednotifications)
|
||||||
|
// Removes all delivered notifications from the notification center.
|
||||||
|
export function RemoveAllDeliveredNotifications(): Promise<void>;
|
||||||
|
|
||||||
|
// [RemoveDeliveredNotification](https://wails.io/docs/reference/runtime/notification#removedeliverednotification)
|
||||||
|
// Removes a specific delivered notification by its identifier.
|
||||||
|
export function RemoveDeliveredNotification(identifier: string): Promise<void>;
|
||||||
|
|
||||||
|
// [RemoveNotification](https://wails.io/docs/reference/runtime/notification#removenotification)
|
||||||
|
// Removes a notification by its identifier (cross-platform convenience function).
|
||||||
|
export function RemoveNotification(identifier: string): Promise<void>;
|
||||||
@@ -0,0 +1,298 @@
|
|||||||
|
/*
|
||||||
|
_ __ _ __
|
||||||
|
| | / /___ _(_) /____
|
||||||
|
| | /| / / __ `/ / / ___/
|
||||||
|
| |/ |/ / /_/ / / (__ )
|
||||||
|
|__/|__/\__,_/_/_/____/
|
||||||
|
The electron alternative for Go
|
||||||
|
(c) Lea Anthony 2019-present
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function LogPrint(message) {
|
||||||
|
window.runtime.LogPrint(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function LogTrace(message) {
|
||||||
|
window.runtime.LogTrace(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function LogDebug(message) {
|
||||||
|
window.runtime.LogDebug(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function LogInfo(message) {
|
||||||
|
window.runtime.LogInfo(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function LogWarning(message) {
|
||||||
|
window.runtime.LogWarning(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function LogError(message) {
|
||||||
|
window.runtime.LogError(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function LogFatal(message) {
|
||||||
|
window.runtime.LogFatal(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function EventsOnMultiple(eventName, callback, maxCallbacks) {
|
||||||
|
return window.runtime.EventsOnMultiple(eventName, callback, maxCallbacks);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function EventsOn(eventName, callback) {
|
||||||
|
return EventsOnMultiple(eventName, callback, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function EventsOff(eventName, ...additionalEventNames) {
|
||||||
|
return window.runtime.EventsOff(eventName, ...additionalEventNames);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function EventsOffAll() {
|
||||||
|
return window.runtime.EventsOffAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function EventsOnce(eventName, callback) {
|
||||||
|
return EventsOnMultiple(eventName, callback, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function EventsEmit(eventName) {
|
||||||
|
let args = [eventName].slice.call(arguments);
|
||||||
|
return window.runtime.EventsEmit.apply(null, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowReload() {
|
||||||
|
window.runtime.WindowReload();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowReloadApp() {
|
||||||
|
window.runtime.WindowReloadApp();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowSetAlwaysOnTop(b) {
|
||||||
|
window.runtime.WindowSetAlwaysOnTop(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowSetSystemDefaultTheme() {
|
||||||
|
window.runtime.WindowSetSystemDefaultTheme();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowSetLightTheme() {
|
||||||
|
window.runtime.WindowSetLightTheme();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowSetDarkTheme() {
|
||||||
|
window.runtime.WindowSetDarkTheme();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowCenter() {
|
||||||
|
window.runtime.WindowCenter();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowSetTitle(title) {
|
||||||
|
window.runtime.WindowSetTitle(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowFullscreen() {
|
||||||
|
window.runtime.WindowFullscreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowUnfullscreen() {
|
||||||
|
window.runtime.WindowUnfullscreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowIsFullscreen() {
|
||||||
|
return window.runtime.WindowIsFullscreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowGetSize() {
|
||||||
|
return window.runtime.WindowGetSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowSetSize(width, height) {
|
||||||
|
window.runtime.WindowSetSize(width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowSetMaxSize(width, height) {
|
||||||
|
window.runtime.WindowSetMaxSize(width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowSetMinSize(width, height) {
|
||||||
|
window.runtime.WindowSetMinSize(width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowSetPosition(x, y) {
|
||||||
|
window.runtime.WindowSetPosition(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowGetPosition() {
|
||||||
|
return window.runtime.WindowGetPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowHide() {
|
||||||
|
window.runtime.WindowHide();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowShow() {
|
||||||
|
window.runtime.WindowShow();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowMaximise() {
|
||||||
|
window.runtime.WindowMaximise();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowToggleMaximise() {
|
||||||
|
window.runtime.WindowToggleMaximise();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowUnmaximise() {
|
||||||
|
window.runtime.WindowUnmaximise();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowIsMaximised() {
|
||||||
|
return window.runtime.WindowIsMaximised();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowMinimise() {
|
||||||
|
window.runtime.WindowMinimise();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowUnminimise() {
|
||||||
|
window.runtime.WindowUnminimise();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowSetBackgroundColour(R, G, B, A) {
|
||||||
|
window.runtime.WindowSetBackgroundColour(R, G, B, A);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ScreenGetAll() {
|
||||||
|
return window.runtime.ScreenGetAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowIsMinimised() {
|
||||||
|
return window.runtime.WindowIsMinimised();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WindowIsNormal() {
|
||||||
|
return window.runtime.WindowIsNormal();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function BrowserOpenURL(url) {
|
||||||
|
window.runtime.BrowserOpenURL(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Environment() {
|
||||||
|
return window.runtime.Environment();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Quit() {
|
||||||
|
window.runtime.Quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Hide() {
|
||||||
|
window.runtime.Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Show() {
|
||||||
|
window.runtime.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ClipboardGetText() {
|
||||||
|
return window.runtime.ClipboardGetText();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ClipboardSetText(text) {
|
||||||
|
return window.runtime.ClipboardSetText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for OnFileDrop returns a slice of file path strings when a drop is finished.
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
* @callback OnFileDropCallback
|
||||||
|
* @param {number} x - x coordinate of the drop
|
||||||
|
* @param {number} y - y coordinate of the drop
|
||||||
|
* @param {string[]} paths - A list of file paths.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OnFileDrop listens to drag and drop events and calls the callback with the coordinates of the drop and an array of path strings.
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
* @param {OnFileDropCallback} callback - Callback for OnFileDrop returns a slice of file path strings when a drop is finished.
|
||||||
|
* @param {boolean} [useDropTarget=true] - Only call the callback when the drop finished on an element that has the drop target style. (--wails-drop-target)
|
||||||
|
*/
|
||||||
|
export function OnFileDrop(callback, useDropTarget) {
|
||||||
|
return window.runtime.OnFileDrop(callback, useDropTarget);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OnFileDropOff removes the drag and drop listeners and handlers.
|
||||||
|
*/
|
||||||
|
export function OnFileDropOff() {
|
||||||
|
return window.runtime.OnFileDropOff();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function CanResolveFilePaths() {
|
||||||
|
return window.runtime.CanResolveFilePaths();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ResolveFilePaths(files) {
|
||||||
|
return window.runtime.ResolveFilePaths(files);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function InitializeNotifications() {
|
||||||
|
return window.runtime.InitializeNotifications();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function CleanupNotifications() {
|
||||||
|
return window.runtime.CleanupNotifications();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function IsNotificationAvailable() {
|
||||||
|
return window.runtime.IsNotificationAvailable();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function RequestNotificationAuthorization() {
|
||||||
|
return window.runtime.RequestNotificationAuthorization();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function CheckNotificationAuthorization() {
|
||||||
|
return window.runtime.CheckNotificationAuthorization();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SendNotification(options) {
|
||||||
|
return window.runtime.SendNotification(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SendNotificationWithActions(options) {
|
||||||
|
return window.runtime.SendNotificationWithActions(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function RegisterNotificationCategory(category) {
|
||||||
|
return window.runtime.RegisterNotificationCategory(category);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function RemoveNotificationCategory(categoryId) {
|
||||||
|
return window.runtime.RemoveNotificationCategory(categoryId);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function RemoveAllPendingNotifications() {
|
||||||
|
return window.runtime.RemoveAllPendingNotifications();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function RemovePendingNotification(identifier) {
|
||||||
|
return window.runtime.RemovePendingNotification(identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function RemoveAllDeliveredNotifications() {
|
||||||
|
return window.runtime.RemoveAllDeliveredNotifications();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function RemoveDeliveredNotification(identifier) {
|
||||||
|
return window.runtime.RemoveDeliveredNotification(identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function RemoveNotification(identifier) {
|
||||||
|
return window.runtime.RemoveNotification(identifier);
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# README
|
||||||
|
|
||||||
|
## About
|
||||||
|
|
||||||
|
This is the official Wails Vanilla template.
|
||||||
|
|
||||||
|
You can configure the project by editing `wails.json`. More information about the project settings can be found
|
||||||
|
here: https://wails.io/docs/reference/project-config
|
||||||
|
|
||||||
|
## Live Development
|
||||||
|
|
||||||
|
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
|
||||||
|
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
|
||||||
|
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
|
||||||
|
to this in your browser, and you can call your Go code from devtools.
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
To build a redistributable, production mode package, use `wails build`.
|
||||||
@@ -0,0 +1,287 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"strconv"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"spektr/internal/config"
|
||||||
|
"spektr/internal/discovery"
|
||||||
|
grpcclient "spektr/internal/grpc"
|
||||||
|
pb "spektr/internal/grpc/pb"
|
||||||
|
|
||||||
|
"github.com/wailsapp/wails/v2/pkg/runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
const HardAddr = "192.168.1.10:50051"
|
||||||
|
|
||||||
|
type App struct {
|
||||||
|
ctx context.Context
|
||||||
|
mu sync.Mutex
|
||||||
|
client *grpcclient.Client
|
||||||
|
currentFrequency string
|
||||||
|
connectionStatus string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewApp() *App {
|
||||||
|
return &App{
|
||||||
|
currentFrequency: "145",
|
||||||
|
connectionStatus: "модуль не подключен",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) startup(ctx context.Context) {
|
||||||
|
a.ctx = ctx
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
client, status := connectClient(ctx)
|
||||||
|
a.mu.Lock()
|
||||||
|
defer a.mu.Unlock()
|
||||||
|
a.client = client
|
||||||
|
a.connectionStatus = status
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) Quit() {
|
||||||
|
a.mu.Lock()
|
||||||
|
client := a.client
|
||||||
|
a.client = nil
|
||||||
|
a.mu.Unlock()
|
||||||
|
|
||||||
|
if client != nil {
|
||||||
|
_ = client.Close()
|
||||||
|
}
|
||||||
|
runtime.Quit(a.ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
type DeviceResponse struct {
|
||||||
|
Status string `json:"status"`
|
||||||
|
Frequency string `json:"frequency"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) CheckConnection() (DeviceResponse, error) {
|
||||||
|
log.Println("CheckConnection called")
|
||||||
|
start := time.Now()
|
||||||
|
log.Println("[TIMING] CheckConnection START")
|
||||||
|
resp := DeviceResponse{
|
||||||
|
Status: "модуль не подключен",
|
||||||
|
Frequency: a.getFrequency(),
|
||||||
|
}
|
||||||
|
|
||||||
|
//клиента вызываю в другом месте теперь
|
||||||
|
//client, err := a.getClientOrConnect()
|
||||||
|
//if err != nil {
|
||||||
|
// return resp, err
|
||||||
|
//}
|
||||||
|
|
||||||
|
//avMsg, err := client.Send(&pb.ClientMessage{
|
||||||
|
// RequestId: requestID(),
|
||||||
|
// Payload: &pb.ClientMessage_Av{Av: &pb.AvCommand{}},
|
||||||
|
//})
|
||||||
|
t1 := time.Now()
|
||||||
|
avMsg, err := a.sendWithReconnect(func() *pb.ClientMessage {
|
||||||
|
return &pb.ClientMessage{
|
||||||
|
RequestId: requestID(),
|
||||||
|
Payload: &pb.ClientMessage_Av{Av: &pb.AvCommand{}},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
log.Printf("[TIMING] AV request took: %v", time.Since(t1))
|
||||||
|
if err != nil {
|
||||||
|
return resp, err
|
||||||
|
}
|
||||||
|
if errMsg := avMsg.GetError(); errMsg != nil {
|
||||||
|
return resp, errors.New(errMsg.GetMessage())
|
||||||
|
}
|
||||||
|
if av := avMsg.GetAv(); av != nil {
|
||||||
|
resp.Status = fmt.Sprintf("HW: %s FW: %s", av.GetHw(), av.GetSw())
|
||||||
|
}
|
||||||
|
|
||||||
|
//freqMsg, err := client.Send(&pb.ClientMessage{
|
||||||
|
// RequestId: requestID(),
|
||||||
|
// Payload: &pb.ClientMessage_GetFrequency{GetFrequency: &pb.GetFrequencyCommand{}},
|
||||||
|
//})
|
||||||
|
t2 := time.Now()
|
||||||
|
freqMsg, err := a.sendWithReconnect(func() *pb.ClientMessage {
|
||||||
|
return &pb.ClientMessage{
|
||||||
|
RequestId: requestID(),
|
||||||
|
Payload: &pb.ClientMessage_GetFrequency{GetFrequency: &pb.GetFrequencyCommand{}},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
log.Printf("[TIMING] GetFreq request took: %v", time.Since(t2))
|
||||||
|
if err != nil {
|
||||||
|
return resp, err
|
||||||
|
}
|
||||||
|
if errMsg := freqMsg.GetError(); errMsg != nil {
|
||||||
|
return resp, errors.New(errMsg.GetMessage())
|
||||||
|
}
|
||||||
|
if freq := freqMsg.GetGetFrequency(); freq != nil {
|
||||||
|
resp.Frequency = strconv.FormatUint(uint64(freq.GetFrequency()), 10)
|
||||||
|
a.setFrequency(resp.Frequency)
|
||||||
|
}
|
||||||
|
|
||||||
|
a.mu.Lock()
|
||||||
|
a.connectionStatus = resp.Status
|
||||||
|
a.mu.Unlock()
|
||||||
|
log.Printf("[TIMING] CheckConnection TOTAL: %v", time.Since(start))
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) SetFrequency(freq string) (string, error) {
|
||||||
|
val, err := strconv.Atoi(freq)
|
||||||
|
if err != nil || val < 70 || val > 8545 {
|
||||||
|
//return "", errors.New("вводимое значение должно быть целым положительным числом")
|
||||||
|
return "", errors.New(`
|
||||||
|
- значение может быть только числом
|
||||||
|
- диапазон от 70 до 8545
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
|
||||||
|
//клиента я вызываю теперь в другом месте
|
||||||
|
//client, err := a.getClientOrConnect()
|
||||||
|
//if err != nil {
|
||||||
|
// return "", err
|
||||||
|
//}
|
||||||
|
|
||||||
|
//resp, err := client.Send(&pb.ClientMessage{
|
||||||
|
// RequestId: requestID(),
|
||||||
|
// Payload: &pb.ClientMessage_SetFrequency{
|
||||||
|
// SetFrequency: &pb.SetFrequencyCommand{Frequency: uint32(val)},
|
||||||
|
// },
|
||||||
|
//})
|
||||||
|
resp, err := a.sendWithReconnect(func() *pb.ClientMessage {
|
||||||
|
return &pb.ClientMessage{
|
||||||
|
RequestId: requestID(),
|
||||||
|
Payload: &pb.ClientMessage_SetFrequency{
|
||||||
|
SetFrequency: &pb.SetFrequencyCommand{Frequency: uint32(val)},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
if errMsg := resp.GetError(); errMsg != nil {
|
||||||
|
return "", errors.New(errMsg.GetMessage())
|
||||||
|
}
|
||||||
|
if ack := resp.GetSetFrequency(); ack != nil && !ack.GetOk() {
|
||||||
|
return "", errors.New("не удалось установить частоту")
|
||||||
|
}
|
||||||
|
|
||||||
|
freqStr := strconv.Itoa(val)
|
||||||
|
a.setFrequency(freqStr)
|
||||||
|
return freqStr, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) getClient() *grpcclient.Client {
|
||||||
|
a.mu.Lock()
|
||||||
|
defer a.mu.Unlock()
|
||||||
|
return a.client
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) getClientOrConnect() (*grpcclient.Client, error) {
|
||||||
|
client := a.getClient()
|
||||||
|
if client != nil {
|
||||||
|
return client, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx := a.ctx
|
||||||
|
if ctx == nil {
|
||||||
|
ctx = context.Background()
|
||||||
|
}
|
||||||
|
|
||||||
|
client, status := connectClient(ctx)
|
||||||
|
if client == nil {
|
||||||
|
return nil, errors.New(status)
|
||||||
|
}
|
||||||
|
|
||||||
|
a.mu.Lock()
|
||||||
|
if a.client == nil {
|
||||||
|
a.client = client
|
||||||
|
a.connectionStatus = status
|
||||||
|
a.mu.Unlock()
|
||||||
|
return client, nil
|
||||||
|
}
|
||||||
|
existing := a.client
|
||||||
|
a.mu.Unlock()
|
||||||
|
|
||||||
|
_ = client.Close()
|
||||||
|
return existing, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) dropClient(client *grpcclient.Client) {
|
||||||
|
a.mu.Lock()
|
||||||
|
if a.client == client {
|
||||||
|
a.client = nil
|
||||||
|
a.connectionStatus = "модуль не подключен"
|
||||||
|
}
|
||||||
|
a.mu.Unlock()
|
||||||
|
|
||||||
|
if client != nil {
|
||||||
|
_ = client.Close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) sendWithReconnect(build func() *pb.ClientMessage) (*pb.ServerMessage, error) {
|
||||||
|
client, err := a.getClientOrConnect()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := client.Send(build())
|
||||||
|
if err == nil {
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// stream умер (часто после рестарта демона) — сбрасываем и пробуем 1 раз заново
|
||||||
|
a.dropClient(client)
|
||||||
|
|
||||||
|
client, err = a.getClientOrConnect()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return client.Send(build())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) getFrequency() string {
|
||||||
|
a.mu.Lock()
|
||||||
|
defer a.mu.Unlock()
|
||||||
|
return a.currentFrequency
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *App) setFrequency(freq string) {
|
||||||
|
a.mu.Lock()
|
||||||
|
a.currentFrequency = freq
|
||||||
|
a.mu.Unlock()
|
||||||
|
}
|
||||||
|
|
||||||
|
func connectClient(ctx context.Context) (*grpcclient.Client, string) {
|
||||||
|
cfg := config.Default()
|
||||||
|
addr := cfg.GRPCAdvertiseAddr
|
||||||
|
|
||||||
|
discoveryCtx, cancel := context.WithTimeout(ctx, 2*time.Second)
|
||||||
|
if discovered, err := discovery.Discover(discoveryCtx, cfg.DiscoveryPort); err == nil && discovered != "" {
|
||||||
|
addr = discovered
|
||||||
|
}
|
||||||
|
cancel()
|
||||||
|
|
||||||
|
dialCtx, cancel := context.WithTimeout(ctx, 5*time.Second)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
//client, err := grpcclient.Dial(dialCtx, addr)
|
||||||
|
client, err := grpcclient.Dial(dialCtx, HardAddr)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("gRPC connect failed: %v", err)
|
||||||
|
return nil, "gRPC-клиент недоступен"
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Printf("connected to gRPC at %s", addr)
|
||||||
|
return client, "модуль подключен"
|
||||||
|
}
|
||||||
|
|
||||||
|
func requestID() string {
|
||||||
|
return strconv.FormatInt(time.Now().UnixNano(), 10)
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 21 KiB |
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"fixed": {
|
||||||
|
"file_version": "{{.Info.ProductVersion}}"
|
||||||
|
},
|
||||||
|
"info": {
|
||||||
|
"0000": {
|
||||||
|
"ProductVersion": "{{.Info.ProductVersion}}",
|
||||||
|
"CompanyName": "{{.Info.CompanyName}}",
|
||||||
|
"FileDescription": "{{.Info.ProductName}}",
|
||||||
|
"LegalCopyright": "{{.Info.Copyright}}",
|
||||||
|
"ProductName": "{{.Info.ProductName}}",
|
||||||
|
"Comments": "{{.Info.Comments}}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<assemblyIdentity type="win32" name="com.wails.{{.Name}}" version="{{.Info.ProductVersion}}.0" processorArchitecture="*"/>
|
||||||
|
<dependency>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
|
||||||
|
</dependentAssembly>
|
||||||
|
</dependency>
|
||||||
|
<asmv3:application>
|
||||||
|
<asmv3:windowsSettings>
|
||||||
|
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware> <!-- fallback for Windows 7 and 8 -->
|
||||||
|
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">permonitorv2,permonitor</dpiAwareness> <!-- falls back to per-monitor if per-monitor v2 is not supported -->
|
||||||
|
</asmv3:windowsSettings>
|
||||||
|
</asmv3:application>
|
||||||
|
</assembly>
|
||||||
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 176 KiB |
@@ -0,0 +1,88 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="ru">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
||||||
|
<title>Спектр</title>
|
||||||
|
<script type="module" crossorigin src="/assets/index.02c817da.js"></script>
|
||||||
|
<link rel="stylesheet" href="/assets/index.41fde905.css">
|
||||||
|
</head>
|
||||||
|
<body data-theme="dark">
|
||||||
|
|
||||||
|
<!-- Переключатель темы -->
|
||||||
|
<button id="theme-toggle" title="Сменить тему">☀</button>
|
||||||
|
|
||||||
|
<!-- Интро при запуске: закрывает всё окно приложения, потом "двери" разъезжаются -->
|
||||||
|
<div id="intro-overlay">
|
||||||
|
<div class="door door-left"></div>
|
||||||
|
<div class="door door-right"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="app">
|
||||||
|
|
||||||
|
<!-- Бренд-блок -->
|
||||||
|
<div id="brand">
|
||||||
|
<div class="logo-icon">
|
||||||
|
<img class="logo-dark" src="/assets/logo-dark.ff9a8bc7.jpg" alt="ТЭЧ ДМ" />
|
||||||
|
<img class="logo-light" src="/assets/logo-light.d5e577a8.png" alt="ТЭЧ ДМ" />
|
||||||
|
</div>
|
||||||
|
<h1>СПЕКТР</h1>
|
||||||
|
<div class="tag">видеоприёмник · панель управления</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Заголовки вкладок (пока скрыты — активен только режим приёмника) -->
|
||||||
|
<div class="tabs" hidden>
|
||||||
|
<button class="tab-button active" data-tab="receiver">Режим приемника</button>
|
||||||
|
<button class="tab-button" data-tab="detector">Режим детектора</button>
|
||||||
|
<button class="tab-button" data-tab="info">Информация</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Содержимое вкладок -->
|
||||||
|
<div class="tab-content active" id="tab-receiver">
|
||||||
|
<div class="buttons-vertical">
|
||||||
|
<button class="action-button" id="btn-check">Проверка подключения</button>
|
||||||
|
<button class="action-button" id="btn-freq">Установка частоты</button>
|
||||||
|
<button class="action-button close-button" id="btn-quit">Закрыть приложение</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Панель частоты (новая, выше статуса) -->
|
||||||
|
<div id="frequency-panel">
|
||||||
|
<span id="frequency-label">Текущая частота:</span>
|
||||||
|
<span id="frequency-value">---</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Панель состояния соединения -->
|
||||||
|
<div id="status-panel">
|
||||||
|
<span id="status-indicator" class="indicator indicator-red"></span>
|
||||||
|
<span id="status-text">Нет соединения</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-content" id="tab-detector">
|
||||||
|
<p>Здесь будет проводиться сканирование доступных частот!</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-content" id="tab-info">
|
||||||
|
<p>О программе: Версия 0.01, сделано на Wails в тэч дм!</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Модальное окно для установки частоты -->
|
||||||
|
<div id="freq-modal" class="modal hidden">
|
||||||
|
<div class="modal-content">
|
||||||
|
<span class="close-modal" id="close-modal">×</span>
|
||||||
|
<h3>Укажите желаемую частоту</h3>
|
||||||
|
<div class="freq-input-group">
|
||||||
|
<button id="btn-minus" class="freq-btn">-</button>
|
||||||
|
<input type="text" id="freq-input" value="145" />
|
||||||
|
<button id="btn-plus" class="freq-btn">+</button>
|
||||||
|
</div>
|
||||||
|
<button id="btn-set-freq" class="action-button">Установить</button>
|
||||||
|
<p id="modal-error" class="error-msg hidden"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="ru">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<link rel="stylesheet" href="./src/style.css" />
|
||||||
|
<title>Спектр</title>
|
||||||
|
</head>
|
||||||
|
<body data-theme="dark">
|
||||||
|
|
||||||
|
<!-- Переключатель темы -->
|
||||||
|
<button id="theme-toggle" title="Сменить тему">☀</button>
|
||||||
|
|
||||||
|
<!-- Интро при запуске: закрывает всё окно приложения, потом "двери" разъезжаются -->
|
||||||
|
<div id="intro-overlay">
|
||||||
|
<div class="door door-left"></div>
|
||||||
|
<div class="door door-right"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="app">
|
||||||
|
|
||||||
|
<!-- Бренд-блок -->
|
||||||
|
<div id="brand">
|
||||||
|
<div class="logo-icon">
|
||||||
|
<img class="logo-dark" src="/src/assets/images/logo-dark.jpg" alt="ТЭЧ ДМ" />
|
||||||
|
<img class="logo-light" src="/src/assets/images/logo-light.png" alt="ТЭЧ ДМ" />
|
||||||
|
</div>
|
||||||
|
<h1>СПЕКТР</h1>
|
||||||
|
<div class="tag">видеоприёмник · панель управления</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Заголовки вкладок (пока скрыты — активен только режим приёмника) -->
|
||||||
|
<div class="tabs" hidden>
|
||||||
|
<button class="tab-button active" data-tab="receiver">Режим приемника</button>
|
||||||
|
<button class="tab-button" data-tab="detector">Режим детектора</button>
|
||||||
|
<button class="tab-button" data-tab="info">Информация</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Содержимое вкладок -->
|
||||||
|
<div class="tab-content active" id="tab-receiver">
|
||||||
|
<div class="buttons-vertical">
|
||||||
|
<button class="action-button" id="btn-check">Проверка подключения</button>
|
||||||
|
<button class="action-button" id="btn-freq">Установка частоты</button>
|
||||||
|
<button class="action-button close-button" id="btn-quit">Закрыть приложение</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Панель частоты (новая, выше статуса) -->
|
||||||
|
<div id="frequency-panel">
|
||||||
|
<span id="frequency-label">Текущая частота:</span>
|
||||||
|
<span id="frequency-value">---</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Панель состояния соединения -->
|
||||||
|
<div id="status-panel">
|
||||||
|
<span id="status-indicator" class="indicator indicator-red"></span>
|
||||||
|
<span id="status-text">Нет соединения</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-content" id="tab-detector">
|
||||||
|
<p>Здесь будет проводиться сканирование доступных частот!</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-content" id="tab-info">
|
||||||
|
<p>О программе: Версия 0.01, сделано на Wails в тэч дм!</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Модальное окно для установки частоты -->
|
||||||
|
<div id="freq-modal" class="modal hidden">
|
||||||
|
<div class="modal-content">
|
||||||
|
<span class="close-modal" id="close-modal">×</span>
|
||||||
|
<h3>Укажите желаемую частоту</h3>
|
||||||
|
<div class="freq-input-group">
|
||||||
|
<button id="btn-minus" class="freq-btn">-</button>
|
||||||
|
<input type="text" id="freq-input" value="145" />
|
||||||
|
<button id="btn-plus" class="freq-btn">+</button>
|
||||||
|
</div>
|
||||||
|
<button id="btn-set-freq" class="action-button">Установить</button>
|
||||||
|
<p id="modal-error" class="error-msg hidden"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="module" src="/src/main.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,302 @@
|
|||||||
|
{
|
||||||
|
"name": "frontend",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"node_modules/es-errors": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-x/R72SmW3sSFRm5zrrIjAhCeQSAWoni3CmHEqfQrZIQTM3lVCdehdwuIqaOtfC2slvpdlLa62GYoN8SxT23m6Q==",
|
||||||
|
"dev": true,
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"bin": {
|
||||||
|
"esbuild": "bin/esbuild"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"@esbuild/android-arm": "0.15.18",
|
||||||
|
"@esbuild/linux-loong64": "0.15.18",
|
||||||
|
"esbuild-android-64": "0.15.18",
|
||||||
|
"esbuild-android-arm64": "0.15.18",
|
||||||
|
"esbuild-darwin-64": "0.15.18",
|
||||||
|
"esbuild-darwin-arm64": "0.15.18",
|
||||||
|
"esbuild-freebsd-64": "0.15.18",
|
||||||
|
"esbuild-freebsd-arm64": "0.15.18",
|
||||||
|
"esbuild-linux-32": "0.15.18",
|
||||||
|
"esbuild-linux-64": "0.15.18",
|
||||||
|
"esbuild-linux-arm": "0.15.18",
|
||||||
|
"esbuild-linux-arm64": "0.15.18",
|
||||||
|
"esbuild-linux-mips64le": "0.15.18",
|
||||||
|
"esbuild-linux-ppc64le": "0.15.18",
|
||||||
|
"esbuild-linux-riscv64": "0.15.18",
|
||||||
|
"esbuild-linux-s390x": "0.15.18",
|
||||||
|
"esbuild-netbsd-64": "0.15.18",
|
||||||
|
"esbuild-openbsd-64": "0.15.18",
|
||||||
|
"esbuild-sunos-64": "0.15.18",
|
||||||
|
"esbuild-windows-32": "0.15.18",
|
||||||
|
"esbuild-windows-64": "0.15.18",
|
||||||
|
"esbuild-windows-arm64": "0.15.18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild-linux-64": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-hNSeP97IviD7oxLKFuii5sDPJ+QHeiFTFLoLm7NZQligur8poNOWGIgpQ7Qf8Balb69hptMZzyOBIPtY09GZYw==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild-windows-64": {
|
||||||
|
"version": "0.15.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.18.tgz",
|
||||||
|
"integrity": "sha512-qinug1iTTaIIrCorAUjR0fcBk24fjzEedFYhhispP8Oc7SFvs+XeW3YpAKiKp8dRpizl4YYAhxMjlftAMJiaUw==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/function-bind": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||||
|
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/hasown": {
|
||||||
|
"version": "2.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
|
||||||
|
"integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"function-bind": "^1.1.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/is-core-module": {
|
||||||
|
"version": "2.16.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.2.tgz",
|
||||||
|
"integrity": "sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"hasown": "^2.0.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/nanoid": {
|
||||||
|
"version": "3.3.15",
|
||||||
|
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.15.tgz",
|
||||||
|
"integrity": "sha512-y7Wygv/7mEOvxTuEQDB8StXdMRBWf1kR/tlhAzBRUFkB2jfcLOAxO/SHmOO2zgz1pVgK29/kyupn059/bCHdjA==",
|
||||||
|
"dev": true,
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/ai"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"bin": {
|
||||||
|
"nanoid": "bin/nanoid.cjs"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/path-parse": {
|
||||||
|
"version": "1.0.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
|
||||||
|
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/picocolors": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "ISC"
|
||||||
|
},
|
||||||
|
"node_modules/postcss": {
|
||||||
|
"version": "8.5.15",
|
||||||
|
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz",
|
||||||
|
"integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==",
|
||||||
|
"dev": true,
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/postcss/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "tidelift",
|
||||||
|
"url": "https://tidelift.com/funding/github/npm/postcss"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/ai"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"nanoid": "^3.3.12",
|
||||||
|
"picocolors": "^1.1.1",
|
||||||
|
"source-map-js": "^1.2.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^10 || ^12 || >=14"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/resolve": {
|
||||||
|
"version": "1.22.12",
|
||||||
|
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.12.tgz",
|
||||||
|
"integrity": "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"es-errors": "^1.3.0",
|
||||||
|
"is-core-module": "^2.16.1",
|
||||||
|
"path-parse": "^1.0.7",
|
||||||
|
"supports-preserve-symlinks-flag": "^1.0.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"resolve": "bin/resolve"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/rollup": {
|
||||||
|
"version": "2.80.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.80.0.tgz",
|
||||||
|
"integrity": "sha512-cIFJOD1DESzpjOBl763Kp1AH7UE/0fcdHe6rZXUdQ9c50uvgigvW97u3IcSeBwOkgqL/PXPBktBCh0KEu5L8XQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"bin": {
|
||||||
|
"rollup": "dist/bin/rollup"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.0.0"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"fsevents": "~2.3.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/source-map-js": {
|
||||||
|
"version": "1.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
||||||
|
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "BSD-3-Clause",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/supports-preserve-symlinks-flag": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/vite": {
|
||||||
|
"version": "3.2.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/vite/-/vite-3.2.11.tgz",
|
||||||
|
"integrity": "sha512-K/jGKL/PgbIgKCiJo5QbASQhFiV02X9Jh+Qq0AKCRCRKZtOTVi4t6wh75FDpGf2N9rYOnzH87OEFQNaFy6pdxQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"esbuild": "^0.15.9",
|
||||||
|
"postcss": "^8.4.18",
|
||||||
|
"resolve": "^1.22.1",
|
||||||
|
"rollup": "^2.79.1"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"vite": "bin/vite.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^14.18.0 || >=16.0.0"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"fsevents": "~2.3.2"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@types/node": ">= 14",
|
||||||
|
"less": "*",
|
||||||
|
"sass": "*",
|
||||||
|
"stylus": "*",
|
||||||
|
"sugarss": "*",
|
||||||
|
"terser": "^5.4.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@types/node": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"less": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"sass": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"stylus": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"sugarss": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"terser": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"root": true,
|
||||||
|
|
||||||
|
"extends": "@ljharb",
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: [ljharb]
|
||||||
|
patreon: # Replace with a single Patreon username
|
||||||
|
open_collective: # Replace with a single Open Collective username
|
||||||
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
|
tidelift: npm/es-errors
|
||||||
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||||
|
liberapay: # Replace with a single Liberapay username
|
||||||
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
|
otechie: # Replace with a single Otechie username
|
||||||
|
custom: # Replace with a single custom sponsorship URL
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||||
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [v1.3.0](https://github.com/ljharb/es-errors/compare/v1.2.1...v1.3.0) - 2024-02-05
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- [New] add `EvalError` and `URIError` [`1927627`](https://github.com/ljharb/es-errors/commit/1927627ba68cb6c829d307231376c967db53acdf)
|
||||||
|
|
||||||
|
## [v1.2.1](https://github.com/ljharb/es-errors/compare/v1.2.0...v1.2.1) - 2024-02-04
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- [Fix] add missing `exports` entry [`5bb5f28`](https://github.com/ljharb/es-errors/commit/5bb5f280f98922701109d6ebb82eea2257cecc7e)
|
||||||
|
|
||||||
|
## [v1.2.0](https://github.com/ljharb/es-errors/compare/v1.1.0...v1.2.0) - 2024-02-04
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- [New] add `ReferenceError` [`6d8cf5b`](https://github.com/ljharb/es-errors/commit/6d8cf5bbb6f3f598d02cf6f30e468ba2caa8e143)
|
||||||
|
|
||||||
|
## [v1.1.0](https://github.com/ljharb/es-errors/compare/v1.0.0...v1.1.0) - 2024-02-04
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- [New] add base Error [`2983ab6`](https://github.com/ljharb/es-errors/commit/2983ab65f7bc5441276cb021dc3aa03c78881698)
|
||||||
|
|
||||||
|
## v1.0.0 - 2024-02-03
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- Initial implementation, tests, readme, type [`8f47631`](https://github.com/ljharb/es-errors/commit/8f476317e9ad76f40ad648081829b1a1a3a1288b)
|
||||||
|
- Initial commit [`ea5d099`](https://github.com/ljharb/es-errors/commit/ea5d099ef18e550509ab9e2be000526afd81c385)
|
||||||
|
- npm init [`6f5ebf9`](https://github.com/ljharb/es-errors/commit/6f5ebf9cead474dadd72b9e63dad315820a089ae)
|
||||||
|
- Only apps should have lockfiles [`e1a0aeb`](https://github.com/ljharb/es-errors/commit/e1a0aeb7b80f5cfc56be54d6b2100e915d47def8)
|
||||||
|
- [meta] add `sideEffects` flag [`a9c7d46`](https://github.com/ljharb/es-errors/commit/a9c7d460a492f1d8a241c836bc25a322a19cc043)
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2024 Jordan Harband
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
# es-errors <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
||||||
|
|
||||||
|
[![github actions][actions-image]][actions-url]
|
||||||
|
[![coverage][codecov-image]][codecov-url]
|
||||||
|
[![License][license-image]][license-url]
|
||||||
|
[![Downloads][downloads-image]][downloads-url]
|
||||||
|
|
||||||
|
[![npm badge][npm-badge-png]][package-url]
|
||||||
|
|
||||||
|
A simple cache for a few of the JS Error constructors.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```js
|
||||||
|
const assert = require('assert');
|
||||||
|
|
||||||
|
const Base = require('es-errors');
|
||||||
|
const Eval = require('es-errors/eval');
|
||||||
|
const Range = require('es-errors/range');
|
||||||
|
const Ref = require('es-errors/ref');
|
||||||
|
const Syntax = require('es-errors/syntax');
|
||||||
|
const Type = require('es-errors/type');
|
||||||
|
const URI = require('es-errors/uri');
|
||||||
|
|
||||||
|
assert.equal(Base, Error);
|
||||||
|
assert.equal(Eval, EvalError);
|
||||||
|
assert.equal(Range, RangeError);
|
||||||
|
assert.equal(Ref, ReferenceError);
|
||||||
|
assert.equal(Syntax, SyntaxError);
|
||||||
|
assert.equal(Type, TypeError);
|
||||||
|
assert.equal(URI, URIError);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
Simply clone the repo, `npm install`, and run `npm test`
|
||||||
|
|
||||||
|
## Security
|
||||||
|
|
||||||
|
Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report.
|
||||||
|
|
||||||
|
[package-url]: https://npmjs.org/package/es-errors
|
||||||
|
[npm-version-svg]: https://versionbadg.es/ljharb/es-errors.svg
|
||||||
|
[deps-svg]: https://david-dm.org/ljharb/es-errors.svg
|
||||||
|
[deps-url]: https://david-dm.org/ljharb/es-errors
|
||||||
|
[dev-deps-svg]: https://david-dm.org/ljharb/es-errors/dev-status.svg
|
||||||
|
[dev-deps-url]: https://david-dm.org/ljharb/es-errors#info=devDependencies
|
||||||
|
[npm-badge-png]: https://nodei.co/npm/es-errors.png?downloads=true&stars=true
|
||||||
|
[license-image]: https://img.shields.io/npm/l/es-errors.svg
|
||||||
|
[license-url]: LICENSE
|
||||||
|
[downloads-image]: https://img.shields.io/npm/dm/es-errors.svg
|
||||||
|
[downloads-url]: https://npm-stat.com/charts.html?package=es-errors
|
||||||
|
[codecov-image]: https://codecov.io/gh/ljharb/es-errors/branch/main/graphs/badge.svg
|
||||||
|
[codecov-url]: https://app.codecov.io/gh/ljharb/es-errors/
|
||||||
|
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/es-errors
|
||||||
|
[actions-url]: https://github.com/ljharb/es-errors/actions
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
declare const EvalError: EvalErrorConstructor;
|
||||||
|
|
||||||
|
export = EvalError;
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
/** @type {import('./eval')} */
|
||||||
|
module.exports = EvalError;
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
declare const Error: ErrorConstructor;
|
||||||
|
|
||||||
|
export = Error;
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
/** @type {import('.')} */
|
||||||
|
module.exports = Error;
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
{
|
||||||
|
"name": "es-errors",
|
||||||
|
"version": "1.3.0",
|
||||||
|
"description": "A simple cache for a few of the JS Error constructors.",
|
||||||
|
"main": "index.js",
|
||||||
|
"exports": {
|
||||||
|
".": "./index.js",
|
||||||
|
"./eval": "./eval.js",
|
||||||
|
"./range": "./range.js",
|
||||||
|
"./ref": "./ref.js",
|
||||||
|
"./syntax": "./syntax.js",
|
||||||
|
"./type": "./type.js",
|
||||||
|
"./uri": "./uri.js",
|
||||||
|
"./package.json": "./package.json"
|
||||||
|
},
|
||||||
|
"sideEffects": false,
|
||||||
|
"scripts": {
|
||||||
|
"prepack": "npmignore --auto --commentLines=autogenerated",
|
||||||
|
"prepublishOnly": "safe-publish-latest",
|
||||||
|
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||||
|
"pretest": "npm run lint",
|
||||||
|
"test": "npm run tests-only",
|
||||||
|
"tests-only": "nyc tape 'test/**/*.js'",
|
||||||
|
"posttest": "aud --production",
|
||||||
|
"prelint": "evalmd README.md",
|
||||||
|
"lint": "eslint --ext=js,mjs .",
|
||||||
|
"postlint": "tsc -p . && eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git' | grep -v dist/)",
|
||||||
|
"version": "auto-changelog && git add CHANGELOG.md",
|
||||||
|
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/ljharb/es-errors.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"javascript",
|
||||||
|
"ecmascript",
|
||||||
|
"error",
|
||||||
|
"typeerror",
|
||||||
|
"syntaxerror",
|
||||||
|
"rangeerror"
|
||||||
|
],
|
||||||
|
"author": "Jordan Harband <ljharb@gmail.com>",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/ljharb/es-errors/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/ljharb/es-errors#readme",
|
||||||
|
"devDependencies": {
|
||||||
|
"@ljharb/eslint-config": "^21.1.0",
|
||||||
|
"@types/tape": "^5.6.4",
|
||||||
|
"aud": "^2.0.4",
|
||||||
|
"auto-changelog": "^2.4.0",
|
||||||
|
"eclint": "^2.8.1",
|
||||||
|
"eslint": "^8.8.0",
|
||||||
|
"evalmd": "^0.0.19",
|
||||||
|
"in-publish": "^2.0.1",
|
||||||
|
"npmignore": "^0.3.1",
|
||||||
|
"nyc": "^10.3.2",
|
||||||
|
"safe-publish-latest": "^2.0.0",
|
||||||
|
"tape": "^5.7.4",
|
||||||
|
"typescript": "next"
|
||||||
|
},
|
||||||
|
"auto-changelog": {
|
||||||
|
"output": "CHANGELOG.md",
|
||||||
|
"template": "keepachangelog",
|
||||||
|
"unreleased": false,
|
||||||
|
"commitLimit": false,
|
||||||
|
"backfillLimit": false,
|
||||||
|
"hideCredit": true
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"ignore": [
|
||||||
|
".github/workflows"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
declare const RangeError: RangeErrorConstructor;
|
||||||
|
|
||||||
|
export = RangeError;
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
/** @type {import('./range')} */
|
||||||
|
module.exports = RangeError;
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
declare const ReferenceError: ReferenceErrorConstructor;
|
||||||
|
|
||||||
|
export = ReferenceError;
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
/** @type {import('./ref')} */
|
||||||
|
module.exports = ReferenceError;
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
declare const SyntaxError: SyntaxErrorConstructor;
|
||||||
|
|
||||||
|
export = SyntaxError;
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
/** @type {import('./syntax')} */
|
||||||
|
module.exports = SyntaxError;
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var test = require('tape');
|
||||||
|
|
||||||
|
var E = require('../');
|
||||||
|
var R = require('../range');
|
||||||
|
var Ref = require('../ref');
|
||||||
|
var S = require('../syntax');
|
||||||
|
var T = require('../type');
|
||||||
|
|
||||||
|
test('errors', function (t) {
|
||||||
|
t.equal(E, Error);
|
||||||
|
t.equal(R, RangeError);
|
||||||
|
t.equal(Ref, ReferenceError);
|
||||||
|
t.equal(S, SyntaxError);
|
||||||
|
t.equal(T, TypeError);
|
||||||
|
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
||||||
|
|
||||||
|
/* Projects */
|
||||||
|
|
||||||
|
/* Language and Environment */
|
||||||
|
"target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
||||||
|
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
||||||
|
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
||||||
|
"useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
||||||
|
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
||||||
|
|
||||||
|
/* Modules */
|
||||||
|
"module": "commonjs", /* Specify what module code is generated. */
|
||||||
|
// "rootDir": "./", /* Specify the root folder within your source files. */
|
||||||
|
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
||||||
|
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
||||||
|
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
||||||
|
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
||||||
|
// "typeRoots": ["types"], /* Specify multiple folders that act like `./node_modules/@types`. */
|
||||||
|
"resolveJsonModule": true, /* Enable importing .json files. */
|
||||||
|
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
||||||
|
|
||||||
|
/* JavaScript Support */
|
||||||
|
"allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
|
||||||
|
"checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
||||||
|
"maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
|
||||||
|
|
||||||
|
/* Emit */
|
||||||
|
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
||||||
|
"declarationMap": true, /* Create sourcemaps for d.ts files. */
|
||||||
|
"noEmit": true, /* Disable emitting files from a compilation. */
|
||||||
|
|
||||||
|
/* Interop Constraints */
|
||||||
|
"allowSyntheticDefaultImports": true, /* Allow `import x from y` when a module doesn't have a default export. */
|
||||||
|
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
|
||||||
|
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
||||||
|
|
||||||
|
/* Type Checking */
|
||||||
|
"strict": true, /* Enable all strict type-checking options. */
|
||||||
|
|
||||||
|
/* Completeness */
|
||||||
|
// "skipLibCheck": true /* Skip type checking all .d.ts files. */
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"coverage",
|
||||||
|
],
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
declare const TypeError: TypeErrorConstructor
|
||||||
|
|
||||||
|
export = TypeError;
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
/** @type {import('./type')} */
|
||||||
|
module.exports = TypeError;
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
declare const URIError: URIErrorConstructor;
|
||||||
|
|
||||||
|
export = URIError;
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
/** @type {import('./uri')} */
|
||||||
|
module.exports = URIError;
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# esbuild
|
||||||
|
|
||||||
|
This is the Linux 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details.
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"name": "esbuild-linux-64",
|
||||||
|
"version": "0.15.18",
|
||||||
|
"description": "The Linux 64-bit binary for esbuild, a JavaScript bundler.",
|
||||||
|
"repository": "https://github.com/evanw/esbuild",
|
||||||
|
"license": "MIT",
|
||||||
|
"preferUnplugged": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# esbuild
|
||||||
|
|
||||||
|
This is the Windows 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details.
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"name": "esbuild-windows-64",
|
||||||
|
"version": "0.15.18",
|
||||||
|
"description": "The Windows 64-bit binary for esbuild, a JavaScript bundler.",
|
||||||
|
"repository": "https://github.com/evanw/esbuild",
|
||||||
|
"license": "MIT",
|
||||||
|
"preferUnplugged": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 Evan Wallace
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# esbuild
|
||||||
|
|
||||||
|
This is a JavaScript bundler and minifier. See https://github.com/evanw/esbuild and the [JavaScript API documentation](https://esbuild.github.io/api/) for details.
|
||||||
@@ -0,0 +1,245 @@
|
|||||||
|
"use strict";
|
||||||
|
var __create = Object.create;
|
||||||
|
var __defProp = Object.defineProperty;
|
||||||
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||||
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||||
|
var __getProtoOf = Object.getPrototypeOf;
|
||||||
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||||
|
var __copyProps = (to, from, except, desc) => {
|
||||||
|
if (from && typeof from === "object" || typeof from === "function") {
|
||||||
|
for (let key of __getOwnPropNames(from))
|
||||||
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||||
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||||
|
}
|
||||||
|
return to;
|
||||||
|
};
|
||||||
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||||
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||||
|
mod
|
||||||
|
));
|
||||||
|
|
||||||
|
// lib/npm/node-platform.ts
|
||||||
|
var fs = require("fs");
|
||||||
|
var os = require("os");
|
||||||
|
var path = require("path");
|
||||||
|
var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH;
|
||||||
|
var knownWindowsPackages = {
|
||||||
|
"win32 arm64 LE": "esbuild-windows-arm64",
|
||||||
|
"win32 ia32 LE": "esbuild-windows-32",
|
||||||
|
"win32 x64 LE": "esbuild-windows-64"
|
||||||
|
};
|
||||||
|
var knownUnixlikePackages = {
|
||||||
|
"android arm64 LE": "esbuild-android-arm64",
|
||||||
|
"darwin arm64 LE": "esbuild-darwin-arm64",
|
||||||
|
"darwin x64 LE": "esbuild-darwin-64",
|
||||||
|
"freebsd arm64 LE": "esbuild-freebsd-arm64",
|
||||||
|
"freebsd x64 LE": "esbuild-freebsd-64",
|
||||||
|
"linux arm LE": "esbuild-linux-arm",
|
||||||
|
"linux arm64 LE": "esbuild-linux-arm64",
|
||||||
|
"linux ia32 LE": "esbuild-linux-32",
|
||||||
|
"linux mips64el LE": "esbuild-linux-mips64le",
|
||||||
|
"linux ppc64 LE": "esbuild-linux-ppc64le",
|
||||||
|
"linux riscv64 LE": "esbuild-linux-riscv64",
|
||||||
|
"linux s390x BE": "esbuild-linux-s390x",
|
||||||
|
"linux x64 LE": "esbuild-linux-64",
|
||||||
|
"linux loong64 LE": "@esbuild/linux-loong64",
|
||||||
|
"netbsd x64 LE": "esbuild-netbsd-64",
|
||||||
|
"openbsd x64 LE": "esbuild-openbsd-64",
|
||||||
|
"sunos x64 LE": "esbuild-sunos-64"
|
||||||
|
};
|
||||||
|
var knownWebAssemblyFallbackPackages = {
|
||||||
|
"android arm LE": "@esbuild/android-arm",
|
||||||
|
"android x64 LE": "esbuild-android-64"
|
||||||
|
};
|
||||||
|
function pkgAndSubpathForCurrentPlatform() {
|
||||||
|
let pkg;
|
||||||
|
let subpath;
|
||||||
|
let isWASM = false;
|
||||||
|
let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`;
|
||||||
|
if (platformKey in knownWindowsPackages) {
|
||||||
|
pkg = knownWindowsPackages[platformKey];
|
||||||
|
subpath = "esbuild.exe";
|
||||||
|
} else if (platformKey in knownUnixlikePackages) {
|
||||||
|
pkg = knownUnixlikePackages[platformKey];
|
||||||
|
subpath = "bin/esbuild";
|
||||||
|
} else if (platformKey in knownWebAssemblyFallbackPackages) {
|
||||||
|
pkg = knownWebAssemblyFallbackPackages[platformKey];
|
||||||
|
subpath = "bin/esbuild";
|
||||||
|
isWASM = true;
|
||||||
|
} else {
|
||||||
|
throw new Error(`Unsupported platform: ${platformKey}`);
|
||||||
|
}
|
||||||
|
return { pkg, subpath, isWASM };
|
||||||
|
}
|
||||||
|
function downloadedBinPath(pkg, subpath) {
|
||||||
|
const esbuildLibDir = path.dirname(require.resolve("esbuild"));
|
||||||
|
return path.join(esbuildLibDir, `downloaded-${pkg}-${path.basename(subpath)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// lib/npm/node-install.ts
|
||||||
|
var fs2 = require("fs");
|
||||||
|
var os2 = require("os");
|
||||||
|
var path2 = require("path");
|
||||||
|
var zlib = require("zlib");
|
||||||
|
var https = require("https");
|
||||||
|
var child_process = require("child_process");
|
||||||
|
var toPath = path2.join(__dirname, "bin", "esbuild");
|
||||||
|
var isToPathJS = true;
|
||||||
|
function validateBinaryVersion(...command) {
|
||||||
|
command.push("--version");
|
||||||
|
const stdout = child_process.execFileSync(command.shift(), command, {
|
||||||
|
stdio: "pipe"
|
||||||
|
}).toString().trim();
|
||||||
|
if (stdout !== "0.15.18") {
|
||||||
|
throw new Error(`Expected ${JSON.stringify("0.15.18")} but got ${JSON.stringify(stdout)}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function isYarn() {
|
||||||
|
const { npm_config_user_agent } = process.env;
|
||||||
|
if (npm_config_user_agent) {
|
||||||
|
return /\byarn\//.test(npm_config_user_agent);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function fetch(url) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
https.get(url, (res) => {
|
||||||
|
if ((res.statusCode === 301 || res.statusCode === 302) && res.headers.location)
|
||||||
|
return fetch(res.headers.location).then(resolve, reject);
|
||||||
|
if (res.statusCode !== 200)
|
||||||
|
return reject(new Error(`Server responded with ${res.statusCode}`));
|
||||||
|
let chunks = [];
|
||||||
|
res.on("data", (chunk) => chunks.push(chunk));
|
||||||
|
res.on("end", () => resolve(Buffer.concat(chunks)));
|
||||||
|
}).on("error", reject);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function extractFileFromTarGzip(buffer, subpath) {
|
||||||
|
try {
|
||||||
|
buffer = zlib.unzipSync(buffer);
|
||||||
|
} catch (err) {
|
||||||
|
throw new Error(`Invalid gzip data in archive: ${err && err.message || err}`);
|
||||||
|
}
|
||||||
|
let str = (i, n) => String.fromCharCode(...buffer.subarray(i, i + n)).replace(/\0.*$/, "");
|
||||||
|
let offset = 0;
|
||||||
|
subpath = `package/${subpath}`;
|
||||||
|
while (offset < buffer.length) {
|
||||||
|
let name = str(offset, 100);
|
||||||
|
let size = parseInt(str(offset + 124, 12), 8);
|
||||||
|
offset += 512;
|
||||||
|
if (!isNaN(size)) {
|
||||||
|
if (name === subpath)
|
||||||
|
return buffer.subarray(offset, offset + size);
|
||||||
|
offset += size + 511 & ~511;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new Error(`Could not find ${JSON.stringify(subpath)} in archive`);
|
||||||
|
}
|
||||||
|
function installUsingNPM(pkg, subpath, binPath) {
|
||||||
|
const env = { ...process.env, npm_config_global: void 0 };
|
||||||
|
const esbuildLibDir = path2.dirname(require.resolve("esbuild"));
|
||||||
|
const installDir = path2.join(esbuildLibDir, "npm-install");
|
||||||
|
fs2.mkdirSync(installDir);
|
||||||
|
try {
|
||||||
|
fs2.writeFileSync(path2.join(installDir, "package.json"), "{}");
|
||||||
|
child_process.execSync(
|
||||||
|
`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"0.15.18"}`,
|
||||||
|
{ cwd: installDir, stdio: "pipe", env }
|
||||||
|
);
|
||||||
|
const installedBinPath = path2.join(installDir, "node_modules", pkg, subpath);
|
||||||
|
fs2.renameSync(installedBinPath, binPath);
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
removeRecursive(installDir);
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function removeRecursive(dir) {
|
||||||
|
for (const entry of fs2.readdirSync(dir)) {
|
||||||
|
const entryPath = path2.join(dir, entry);
|
||||||
|
let stats;
|
||||||
|
try {
|
||||||
|
stats = fs2.lstatSync(entryPath);
|
||||||
|
} catch {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (stats.isDirectory())
|
||||||
|
removeRecursive(entryPath);
|
||||||
|
else
|
||||||
|
fs2.unlinkSync(entryPath);
|
||||||
|
}
|
||||||
|
fs2.rmdirSync(dir);
|
||||||
|
}
|
||||||
|
function applyManualBinaryPathOverride(overridePath) {
|
||||||
|
const pathString = JSON.stringify(overridePath);
|
||||||
|
fs2.writeFileSync(toPath, `#!/usr/bin/env node
|
||||||
|
require('child_process').execFileSync(${pathString}, process.argv.slice(2), { stdio: 'inherit' });
|
||||||
|
`);
|
||||||
|
const libMain = path2.join(__dirname, "lib", "main.js");
|
||||||
|
const code = fs2.readFileSync(libMain, "utf8");
|
||||||
|
fs2.writeFileSync(libMain, `var ESBUILD_BINARY_PATH = ${pathString};
|
||||||
|
${code}`);
|
||||||
|
}
|
||||||
|
function maybeOptimizePackage(binPath) {
|
||||||
|
if (os2.platform() !== "win32" && !isYarn()) {
|
||||||
|
const tempPath = path2.join(__dirname, "bin-esbuild");
|
||||||
|
try {
|
||||||
|
fs2.linkSync(binPath, tempPath);
|
||||||
|
fs2.renameSync(tempPath, toPath);
|
||||||
|
isToPathJS = false;
|
||||||
|
fs2.unlinkSync(tempPath);
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function downloadDirectlyFromNPM(pkg, subpath, binPath) {
|
||||||
|
const url = `https://registry.npmjs.org/${pkg}/-/${pkg}-${"0.15.18"}.tgz`;
|
||||||
|
console.error(`[esbuild] Trying to download ${JSON.stringify(url)}`);
|
||||||
|
try {
|
||||||
|
fs2.writeFileSync(binPath, extractFileFromTarGzip(await fetch(url), subpath));
|
||||||
|
fs2.chmodSync(binPath, 493);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`[esbuild] Failed to download ${JSON.stringify(url)}: ${e && e.message || e}`);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function checkAndPreparePackage() {
|
||||||
|
if (ESBUILD_BINARY_PATH) {
|
||||||
|
applyManualBinaryPathOverride(ESBUILD_BINARY_PATH);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const { pkg, subpath } = pkgAndSubpathForCurrentPlatform();
|
||||||
|
let binPath;
|
||||||
|
try {
|
||||||
|
binPath = require.resolve(`${pkg}/${subpath}`);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`[esbuild] Failed to find package "${pkg}" on the file system
|
||||||
|
|
||||||
|
This can happen if you use the "--no-optional" flag. The "optionalDependencies"
|
||||||
|
package.json feature is used by esbuild to install the correct binary executable
|
||||||
|
for your current platform. This install script will now attempt to work around
|
||||||
|
this. If that fails, you need to remove the "--no-optional" flag to use esbuild.
|
||||||
|
`);
|
||||||
|
binPath = downloadedBinPath(pkg, subpath);
|
||||||
|
try {
|
||||||
|
console.error(`[esbuild] Trying to install package "${pkg}" using npm`);
|
||||||
|
installUsingNPM(pkg, subpath, binPath);
|
||||||
|
} catch (e2) {
|
||||||
|
console.error(`[esbuild] Failed to install package "${pkg}" using npm: ${e2 && e2.message || e2}`);
|
||||||
|
try {
|
||||||
|
await downloadDirectlyFromNPM(pkg, subpath, binPath);
|
||||||
|
} catch (e3) {
|
||||||
|
throw new Error(`Failed to install package "${pkg}"`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
maybeOptimizePackage(binPath);
|
||||||
|
}
|
||||||
|
checkAndPreparePackage().then(() => {
|
||||||
|
if (isToPathJS) {
|
||||||
|
validateBinaryVersion(process.execPath, toPath);
|
||||||
|
} else {
|
||||||
|
validateBinaryVersion(toPath);
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -0,0 +1,611 @@
|
|||||||
|
export type Platform = 'browser' | 'node' | 'neutral';
|
||||||
|
export type Format = 'iife' | 'cjs' | 'esm';
|
||||||
|
export type Loader = 'js' | 'jsx' | 'ts' | 'tsx' | 'css' | 'json' | 'text' | 'base64' | 'file' | 'dataurl' | 'binary' | 'copy' | 'default';
|
||||||
|
export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent';
|
||||||
|
export type Charset = 'ascii' | 'utf8';
|
||||||
|
export type Drop = 'console' | 'debugger';
|
||||||
|
|
||||||
|
interface CommonOptions {
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#sourcemap */
|
||||||
|
sourcemap?: boolean | 'linked' | 'inline' | 'external' | 'both';
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#legal-comments */
|
||||||
|
legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external';
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#source-root */
|
||||||
|
sourceRoot?: string;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#sources-content */
|
||||||
|
sourcesContent?: boolean;
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#format */
|
||||||
|
format?: Format;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#global-name */
|
||||||
|
globalName?: string;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#target */
|
||||||
|
target?: string | string[];
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#supported */
|
||||||
|
supported?: Record<string, boolean>;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#platform */
|
||||||
|
platform?: Platform;
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||||
|
mangleProps?: RegExp;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||||
|
reserveProps?: RegExp;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||||
|
mangleQuoted?: boolean;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||||
|
mangleCache?: Record<string, string | false>;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#drop */
|
||||||
|
drop?: Drop[];
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||||
|
minify?: boolean;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||||
|
minifyWhitespace?: boolean;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||||
|
minifyIdentifiers?: boolean;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||||
|
minifySyntax?: boolean;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#charset */
|
||||||
|
charset?: Charset;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#tree-shaking */
|
||||||
|
treeShaking?: boolean;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#ignore-annotations */
|
||||||
|
ignoreAnnotations?: boolean;
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#jsx */
|
||||||
|
jsx?: 'transform' | 'preserve' | 'automatic';
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#jsx-factory */
|
||||||
|
jsxFactory?: string;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#jsx-fragment */
|
||||||
|
jsxFragment?: string;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#jsx-import-source */
|
||||||
|
jsxImportSource?: string;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#jsx-development */
|
||||||
|
jsxDev?: boolean;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#jsx-side-effects */
|
||||||
|
jsxSideEffects?: boolean;
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#define */
|
||||||
|
define?: { [key: string]: string };
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#pure */
|
||||||
|
pure?: string[];
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#keep-names */
|
||||||
|
keepNames?: boolean;
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#color */
|
||||||
|
color?: boolean;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#log-level */
|
||||||
|
logLevel?: LogLevel;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#log-limit */
|
||||||
|
logLimit?: number;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#log-override */
|
||||||
|
logOverride?: Record<string, LogLevel>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BuildOptions extends CommonOptions {
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#bundle */
|
||||||
|
bundle?: boolean;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#splitting */
|
||||||
|
splitting?: boolean;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#preserve-symlinks */
|
||||||
|
preserveSymlinks?: boolean;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#outfile */
|
||||||
|
outfile?: string;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#metafile */
|
||||||
|
metafile?: boolean;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#outdir */
|
||||||
|
outdir?: string;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#outbase */
|
||||||
|
outbase?: string;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#external */
|
||||||
|
external?: string[];
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#alias */
|
||||||
|
alias?: Record<string, string>;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#loader */
|
||||||
|
loader?: { [ext: string]: Loader };
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#resolve-extensions */
|
||||||
|
resolveExtensions?: string[];
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#main-fields */
|
||||||
|
mainFields?: string[];
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#conditions */
|
||||||
|
conditions?: string[];
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#write */
|
||||||
|
write?: boolean;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#allow-overwrite */
|
||||||
|
allowOverwrite?: boolean;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#tsconfig */
|
||||||
|
tsconfig?: string;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#out-extension */
|
||||||
|
outExtension?: { [ext: string]: string };
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#public-path */
|
||||||
|
publicPath?: string;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#entry-names */
|
||||||
|
entryNames?: string;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#chunk-names */
|
||||||
|
chunkNames?: string;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#asset-names */
|
||||||
|
assetNames?: string;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#inject */
|
||||||
|
inject?: string[];
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#banner */
|
||||||
|
banner?: { [type: string]: string };
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#footer */
|
||||||
|
footer?: { [type: string]: string };
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#incremental */
|
||||||
|
incremental?: boolean;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#entry-points */
|
||||||
|
entryPoints?: string[] | Record<string, string>;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#stdin */
|
||||||
|
stdin?: StdinOptions;
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/ */
|
||||||
|
plugins?: Plugin[];
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#working-directory */
|
||||||
|
absWorkingDir?: string;
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#node-paths */
|
||||||
|
nodePaths?: string[]; // The "NODE_PATH" variable from Node.js
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#watch */
|
||||||
|
watch?: boolean | WatchMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WatchMode {
|
||||||
|
onRebuild?: (error: BuildFailure | null, result: BuildResult | null) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StdinOptions {
|
||||||
|
contents: string | Uint8Array;
|
||||||
|
resolveDir?: string;
|
||||||
|
sourcefile?: string;
|
||||||
|
loader?: Loader;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Message {
|
||||||
|
id: string;
|
||||||
|
pluginName: string;
|
||||||
|
text: string;
|
||||||
|
location: Location | null;
|
||||||
|
notes: Note[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optional user-specified data that is passed through unmodified. You can
|
||||||
|
* use this to stash the original error, for example.
|
||||||
|
*/
|
||||||
|
detail: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Note {
|
||||||
|
text: string;
|
||||||
|
location: Location | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Location {
|
||||||
|
file: string;
|
||||||
|
namespace: string;
|
||||||
|
/** 1-based */
|
||||||
|
line: number;
|
||||||
|
/** 0-based, in bytes */
|
||||||
|
column: number;
|
||||||
|
/** in bytes */
|
||||||
|
length: number;
|
||||||
|
lineText: string;
|
||||||
|
suggestion: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OutputFile {
|
||||||
|
path: string;
|
||||||
|
/** "text" as bytes */
|
||||||
|
contents: Uint8Array;
|
||||||
|
/** "contents" as text */
|
||||||
|
text: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BuildInvalidate {
|
||||||
|
(): Promise<BuildIncremental>;
|
||||||
|
dispose(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BuildIncremental extends BuildResult {
|
||||||
|
rebuild: BuildInvalidate;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BuildResult {
|
||||||
|
errors: Message[];
|
||||||
|
warnings: Message[];
|
||||||
|
/** Only when "write: false" */
|
||||||
|
outputFiles?: OutputFile[];
|
||||||
|
/** Only when "incremental: true" */
|
||||||
|
rebuild?: BuildInvalidate;
|
||||||
|
/** Only when "watch: true" */
|
||||||
|
stop?: () => void;
|
||||||
|
/** Only when "metafile: true" */
|
||||||
|
metafile?: Metafile;
|
||||||
|
/** Only when "mangleCache" is present */
|
||||||
|
mangleCache?: Record<string, string | false>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BuildFailure extends Error {
|
||||||
|
errors: Message[];
|
||||||
|
warnings: Message[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#serve-arguments */
|
||||||
|
export interface ServeOptions {
|
||||||
|
port?: number;
|
||||||
|
host?: string;
|
||||||
|
servedir?: string;
|
||||||
|
onRequest?: (args: ServeOnRequestArgs) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ServeOnRequestArgs {
|
||||||
|
remoteAddress: string;
|
||||||
|
method: string;
|
||||||
|
path: string;
|
||||||
|
status: number;
|
||||||
|
/** The time to generate the response, not to send it */
|
||||||
|
timeInMS: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#serve-return-values */
|
||||||
|
export interface ServeResult {
|
||||||
|
port: number;
|
||||||
|
host: string;
|
||||||
|
wait: Promise<void>;
|
||||||
|
stop: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TransformOptions extends CommonOptions {
|
||||||
|
tsconfigRaw?: string | {
|
||||||
|
compilerOptions?: {
|
||||||
|
alwaysStrict?: boolean,
|
||||||
|
importsNotUsedAsValues?: 'remove' | 'preserve' | 'error',
|
||||||
|
jsx?: 'react' | 'react-jsx' | 'react-jsxdev' | 'preserve',
|
||||||
|
jsxFactory?: string,
|
||||||
|
jsxFragmentFactory?: string,
|
||||||
|
jsxImportSource?: string,
|
||||||
|
preserveValueImports?: boolean,
|
||||||
|
target?: string,
|
||||||
|
useDefineForClassFields?: boolean,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
sourcefile?: string;
|
||||||
|
loader?: Loader;
|
||||||
|
banner?: string;
|
||||||
|
footer?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TransformResult {
|
||||||
|
code: string;
|
||||||
|
map: string;
|
||||||
|
warnings: Message[];
|
||||||
|
/** Only when "mangleCache" is present */
|
||||||
|
mangleCache?: Record<string, string | false>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TransformFailure extends Error {
|
||||||
|
errors: Message[];
|
||||||
|
warnings: Message[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Plugin {
|
||||||
|
name: string;
|
||||||
|
setup: (build: PluginBuild) => (void | Promise<void>);
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginBuild {
|
||||||
|
initialOptions: BuildOptions;
|
||||||
|
resolve(path: string, options?: ResolveOptions): Promise<ResolveResult>;
|
||||||
|
|
||||||
|
onStart(callback: () =>
|
||||||
|
(OnStartResult | null | void | Promise<OnStartResult | null | void>)): void;
|
||||||
|
onEnd(callback: (result: BuildResult) =>
|
||||||
|
(void | Promise<void>)): void;
|
||||||
|
onResolve(options: OnResolveOptions, callback: (args: OnResolveArgs) =>
|
||||||
|
(OnResolveResult | null | undefined | Promise<OnResolveResult | null | undefined>)): void;
|
||||||
|
onLoad(options: OnLoadOptions, callback: (args: OnLoadArgs) =>
|
||||||
|
(OnLoadResult | null | undefined | Promise<OnLoadResult | null | undefined>)): void;
|
||||||
|
|
||||||
|
// This is a full copy of the esbuild library in case you need it
|
||||||
|
esbuild: {
|
||||||
|
serve: typeof serve,
|
||||||
|
build: typeof build,
|
||||||
|
buildSync: typeof buildSync,
|
||||||
|
transform: typeof transform,
|
||||||
|
transformSync: typeof transformSync,
|
||||||
|
formatMessages: typeof formatMessages,
|
||||||
|
formatMessagesSync: typeof formatMessagesSync,
|
||||||
|
analyzeMetafile: typeof analyzeMetafile,
|
||||||
|
analyzeMetafileSync: typeof analyzeMetafileSync,
|
||||||
|
initialize: typeof initialize,
|
||||||
|
version: typeof version,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ResolveOptions {
|
||||||
|
pluginName?: string;
|
||||||
|
importer?: string;
|
||||||
|
namespace?: string;
|
||||||
|
resolveDir?: string;
|
||||||
|
kind?: ImportKind;
|
||||||
|
pluginData?: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ResolveResult {
|
||||||
|
errors: Message[];
|
||||||
|
warnings: Message[];
|
||||||
|
|
||||||
|
path: string;
|
||||||
|
external: boolean;
|
||||||
|
sideEffects: boolean;
|
||||||
|
namespace: string;
|
||||||
|
suffix: string;
|
||||||
|
pluginData: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OnStartResult {
|
||||||
|
errors?: PartialMessage[];
|
||||||
|
warnings?: PartialMessage[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OnResolveOptions {
|
||||||
|
filter: RegExp;
|
||||||
|
namespace?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OnResolveArgs {
|
||||||
|
path: string;
|
||||||
|
importer: string;
|
||||||
|
namespace: string;
|
||||||
|
resolveDir: string;
|
||||||
|
kind: ImportKind;
|
||||||
|
pluginData: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ImportKind =
|
||||||
|
| 'entry-point'
|
||||||
|
|
||||||
|
// JS
|
||||||
|
| 'import-statement'
|
||||||
|
| 'require-call'
|
||||||
|
| 'dynamic-import'
|
||||||
|
| 'require-resolve'
|
||||||
|
|
||||||
|
// CSS
|
||||||
|
| 'import-rule'
|
||||||
|
| 'url-token'
|
||||||
|
|
||||||
|
export interface OnResolveResult {
|
||||||
|
pluginName?: string;
|
||||||
|
|
||||||
|
errors?: PartialMessage[];
|
||||||
|
warnings?: PartialMessage[];
|
||||||
|
|
||||||
|
path?: string;
|
||||||
|
external?: boolean;
|
||||||
|
sideEffects?: boolean;
|
||||||
|
namespace?: string;
|
||||||
|
suffix?: string;
|
||||||
|
pluginData?: any;
|
||||||
|
|
||||||
|
watchFiles?: string[];
|
||||||
|
watchDirs?: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OnLoadOptions {
|
||||||
|
filter: RegExp;
|
||||||
|
namespace?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OnLoadArgs {
|
||||||
|
path: string;
|
||||||
|
namespace: string;
|
||||||
|
suffix: string;
|
||||||
|
pluginData: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OnLoadResult {
|
||||||
|
pluginName?: string;
|
||||||
|
|
||||||
|
errors?: PartialMessage[];
|
||||||
|
warnings?: PartialMessage[];
|
||||||
|
|
||||||
|
contents?: string | Uint8Array;
|
||||||
|
resolveDir?: string;
|
||||||
|
loader?: Loader;
|
||||||
|
pluginData?: any;
|
||||||
|
|
||||||
|
watchFiles?: string[];
|
||||||
|
watchDirs?: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PartialMessage {
|
||||||
|
id?: string;
|
||||||
|
pluginName?: string;
|
||||||
|
text?: string;
|
||||||
|
location?: Partial<Location> | null;
|
||||||
|
notes?: PartialNote[];
|
||||||
|
detail?: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PartialNote {
|
||||||
|
text?: string;
|
||||||
|
location?: Partial<Location> | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Metafile {
|
||||||
|
inputs: {
|
||||||
|
[path: string]: {
|
||||||
|
bytes: number
|
||||||
|
imports: {
|
||||||
|
path: string
|
||||||
|
kind: ImportKind
|
||||||
|
}[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
outputs: {
|
||||||
|
[path: string]: {
|
||||||
|
bytes: number
|
||||||
|
inputs: {
|
||||||
|
[path: string]: {
|
||||||
|
bytesInOutput: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
imports: {
|
||||||
|
path: string
|
||||||
|
kind: ImportKind
|
||||||
|
}[]
|
||||||
|
exports: string[]
|
||||||
|
entryPoint?: string
|
||||||
|
cssBundle?: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FormatMessagesOptions {
|
||||||
|
kind: 'error' | 'warning';
|
||||||
|
color?: boolean;
|
||||||
|
terminalWidth?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AnalyzeMetafileOptions {
|
||||||
|
color?: boolean;
|
||||||
|
verbose?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function invokes the "esbuild" command-line tool for you. It returns a
|
||||||
|
* promise that either resolves with a "BuildResult" object or rejects with a
|
||||||
|
* "BuildFailure" object.
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: yes
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#build-api
|
||||||
|
*/
|
||||||
|
export declare function build(options: BuildOptions & { write: false }): Promise<BuildResult & { outputFiles: OutputFile[] }>;
|
||||||
|
export declare function build(options: BuildOptions & { incremental: true, metafile: true }): Promise<BuildIncremental & { metafile: Metafile }>;
|
||||||
|
export declare function build(options: BuildOptions & { incremental: true }): Promise<BuildIncremental>;
|
||||||
|
export declare function build(options: BuildOptions & { metafile: true }): Promise<BuildResult & { metafile: Metafile }>;
|
||||||
|
export declare function build(options: BuildOptions): Promise<BuildResult>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is similar to "build" but it serves the resulting files over
|
||||||
|
* HTTP on a localhost address with the specified port.
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: no
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#serve
|
||||||
|
*/
|
||||||
|
export declare function serve(serveOptions: ServeOptions, buildOptions: BuildOptions): Promise<ServeResult>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function transforms a single JavaScript file. It can be used to minify
|
||||||
|
* JavaScript, convert TypeScript/JSX to JavaScript, or convert newer JavaScript
|
||||||
|
* to older JavaScript. It returns a promise that is either resolved with a
|
||||||
|
* "TransformResult" object or rejected with a "TransformFailure" object.
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: yes
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#transform-api
|
||||||
|
*/
|
||||||
|
export declare function transform(input: string | Uint8Array, options?: TransformOptions): Promise<TransformResult>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts log messages to formatted message strings suitable for printing in
|
||||||
|
* the terminal. This allows you to reuse the built-in behavior of esbuild's
|
||||||
|
* log message formatter. This is a batch-oriented API for efficiency.
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: yes
|
||||||
|
*/
|
||||||
|
export declare function formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise<string[]>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pretty-prints an analysis of the metafile JSON to a string. This is just for
|
||||||
|
* convenience to be able to match esbuild's pretty-printing exactly. If you want
|
||||||
|
* to customize it, you can just inspect the data in the metafile yourself.
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: yes
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#analyze
|
||||||
|
*/
|
||||||
|
export declare function analyzeMetafile(metafile: Metafile | string, options?: AnalyzeMetafileOptions): Promise<string>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A synchronous version of "build".
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: no
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#build-api
|
||||||
|
*/
|
||||||
|
export declare function buildSync(options: BuildOptions & { write: false }): BuildResult & { outputFiles: OutputFile[] };
|
||||||
|
export declare function buildSync(options: BuildOptions): BuildResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A synchronous version of "transform".
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: no
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#transform-api
|
||||||
|
*/
|
||||||
|
export declare function transformSync(input: string, options?: TransformOptions): TransformResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A synchronous version of "formatMessages".
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: no
|
||||||
|
*/
|
||||||
|
export declare function formatMessagesSync(messages: PartialMessage[], options: FormatMessagesOptions): string[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A synchronous version of "analyzeMetafile".
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: no
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#analyze
|
||||||
|
*/
|
||||||
|
export declare function analyzeMetafileSync(metafile: Metafile | string, options?: AnalyzeMetafileOptions): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This configures the browser-based version of esbuild. It is necessary to
|
||||||
|
* call this first and wait for the returned promise to be resolved before
|
||||||
|
* making other API calls when using esbuild in the browser.
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: yes ("options" is required)
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#running-in-the-browser
|
||||||
|
*/
|
||||||
|
export declare function initialize(options: InitializeOptions): Promise<void>;
|
||||||
|
|
||||||
|
export interface InitializeOptions {
|
||||||
|
/**
|
||||||
|
* The URL of the "esbuild.wasm" file. This must be provided when running
|
||||||
|
* esbuild in the browser.
|
||||||
|
*/
|
||||||
|
wasmURL?: string | URL
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The result of calling "new WebAssembly.Module(buffer)" where "buffer"
|
||||||
|
* is a typed array or ArrayBuffer containing the binary code of the
|
||||||
|
* "esbuild.wasm" file.
|
||||||
|
*
|
||||||
|
* You can use this as an alternative to "wasmURL" for environments where it's
|
||||||
|
* not possible to download the WebAssembly module.
|
||||||
|
*/
|
||||||
|
wasmModule?: WebAssembly.Module
|
||||||
|
|
||||||
|
/**
|
||||||
|
* By default esbuild runs the WebAssembly-based browser API in a web worker
|
||||||
|
* to avoid blocking the UI thread. This can be disabled by setting "worker"
|
||||||
|
* to false.
|
||||||
|
*/
|
||||||
|
worker?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export let version: string;
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"name": "esbuild",
|
||||||
|
"version": "0.15.18",
|
||||||
|
"description": "An extremely fast JavaScript and CSS bundler and minifier.",
|
||||||
|
"repository": "https://github.com/evanw/esbuild",
|
||||||
|
"scripts": {
|
||||||
|
"postinstall": "node install.js"
|
||||||
|
},
|
||||||
|
"main": "lib/main.js",
|
||||||
|
"types": "lib/main.d.ts",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"esbuild": "bin/esbuild"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"@esbuild/android-arm": "0.15.18",
|
||||||
|
"@esbuild/linux-loong64": "0.15.18",
|
||||||
|
"esbuild-android-64": "0.15.18",
|
||||||
|
"esbuild-android-arm64": "0.15.18",
|
||||||
|
"esbuild-darwin-64": "0.15.18",
|
||||||
|
"esbuild-darwin-arm64": "0.15.18",
|
||||||
|
"esbuild-freebsd-64": "0.15.18",
|
||||||
|
"esbuild-freebsd-arm64": "0.15.18",
|
||||||
|
"esbuild-linux-32": "0.15.18",
|
||||||
|
"esbuild-linux-64": "0.15.18",
|
||||||
|
"esbuild-linux-arm": "0.15.18",
|
||||||
|
"esbuild-linux-arm64": "0.15.18",
|
||||||
|
"esbuild-linux-mips64le": "0.15.18",
|
||||||
|
"esbuild-linux-ppc64le": "0.15.18",
|
||||||
|
"esbuild-linux-riscv64": "0.15.18",
|
||||||
|
"esbuild-linux-s390x": "0.15.18",
|
||||||
|
"esbuild-netbsd-64": "0.15.18",
|
||||||
|
"esbuild-openbsd-64": "0.15.18",
|
||||||
|
"esbuild-sunos-64": "0.15.18",
|
||||||
|
"esbuild-windows-32": "0.15.18",
|
||||||
|
"esbuild-windows-64": "0.15.18",
|
||||||
|
"esbuild-windows-arm64": "0.15.18"
|
||||||
|
},
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"root": true,
|
||||||
|
|
||||||
|
"extends": "@ljharb",
|
||||||
|
|
||||||
|
"rules": {
|
||||||
|
"func-name-matching": 0,
|
||||||
|
"indent": [2, 4],
|
||||||
|
"no-new-func": [1],
|
||||||
|
},
|
||||||
|
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": "test/**",
|
||||||
|
"rules": {
|
||||||
|
"max-lines-per-function": 0,
|
||||||
|
"strict": [0]
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: [ljharb]
|
||||||
|
patreon: # Replace with a single Patreon username
|
||||||
|
open_collective: # Replace with a single Open Collective username
|
||||||
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
|
tidelift: npm/function-bind
|
||||||
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||||
|
liberapay: # Replace with a single Liberapay username
|
||||||
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
|
otechie: # Replace with a single Otechie username
|
||||||
|
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Security
|
||||||
|
|
||||||
|
Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report.
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"all": true,
|
||||||
|
"check-coverage": false,
|
||||||
|
"reporter": ["text-summary", "text", "html", "json"],
|
||||||
|
"lines": 86,
|
||||||
|
"statements": 85.93,
|
||||||
|
"functions": 82.43,
|
||||||
|
"branches": 76.06,
|
||||||
|
"exclude": [
|
||||||
|
"coverage",
|
||||||
|
"test"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||||
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [v1.1.2](https://github.com/ljharb/function-bind/compare/v1.1.1...v1.1.2) - 2023-10-12
|
||||||
|
|
||||||
|
### Merged
|
||||||
|
|
||||||
|
- Point to the correct file [`#16`](https://github.com/ljharb/function-bind/pull/16)
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- [Tests] migrate tests to Github Actions [`4f8b57c`](https://github.com/ljharb/function-bind/commit/4f8b57c02f2011fe9ae353d5e74e8745f0988af8)
|
||||||
|
- [Tests] remove `jscs` [`90eb2ed`](https://github.com/ljharb/function-bind/commit/90eb2edbeefd5b76cd6c3a482ea3454db169b31f)
|
||||||
|
- [meta] update `.gitignore` [`53fcdc3`](https://github.com/ljharb/function-bind/commit/53fcdc371cd66634d6e9b71c836a50f437e89fed)
|
||||||
|
- [Tests] up to `node` `v11.10`, `v10.15`, `v9.11`, `v8.15`, `v6.16`, `v4.9`; use `nvm install-latest-npm`; run audit script in tests [`1fe8f6e`](https://github.com/ljharb/function-bind/commit/1fe8f6e9aed0dfa8d8b3cdbd00c7f5ea0cd2b36e)
|
||||||
|
- [meta] add `auto-changelog` [`1921fcb`](https://github.com/ljharb/function-bind/commit/1921fcb5b416b63ffc4acad051b6aad5722f777d)
|
||||||
|
- [Robustness] remove runtime dependency on all builtins except `.apply` [`f743e61`](https://github.com/ljharb/function-bind/commit/f743e61aa6bb2360358c04d4884c9db853d118b7)
|
||||||
|
- Docs: enable badges; update wording [`503cb12`](https://github.com/ljharb/function-bind/commit/503cb12d998b5f91822776c73332c7adcd6355dd)
|
||||||
|
- [readme] update badges [`290c5db`](https://github.com/ljharb/function-bind/commit/290c5dbbbda7264efaeb886552a374b869a4bb48)
|
||||||
|
- [Tests] switch to nyc for coverage [`ea360ba`](https://github.com/ljharb/function-bind/commit/ea360ba907fc2601ed18d01a3827fa2d3533cdf8)
|
||||||
|
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`cae5e9e`](https://github.com/ljharb/function-bind/commit/cae5e9e07a5578dc6df26c03ee22851ce05b943c)
|
||||||
|
- [meta] add `funding` field; create FUNDING.yml [`c9f4274`](https://github.com/ljharb/function-bind/commit/c9f4274aa80ea3aae9657a3938fdba41a3b04ca6)
|
||||||
|
- [Tests] fix eslint errors from #15 [`f69aaa2`](https://github.com/ljharb/function-bind/commit/f69aaa2beb2fdab4415bfb885760a699d0b9c964)
|
||||||
|
- [actions] fix permissions [`99a0cd9`](https://github.com/ljharb/function-bind/commit/99a0cd9f3b5bac223a0d572f081834cd73314be7)
|
||||||
|
- [meta] use `npmignore` to autogenerate an npmignore file [`f03b524`](https://github.com/ljharb/function-bind/commit/f03b524ca91f75a109a5d062f029122c86ecd1ae)
|
||||||
|
- [Dev Deps] update `@ljharb/eslint‑config`, `eslint`, `tape` [`7af9300`](https://github.com/ljharb/function-bind/commit/7af930023ae2ce7645489532821e4fbbcd7a2280)
|
||||||
|
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `tape` [`64a9127`](https://github.com/ljharb/function-bind/commit/64a9127ab0bd331b93d6572eaf6e9971967fc08c)
|
||||||
|
- [Tests] use `aud` instead of `npm audit` [`e75069c`](https://github.com/ljharb/function-bind/commit/e75069c50010a8fcce2a9ce2324934c35fdb4386)
|
||||||
|
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`d03555c`](https://github.com/ljharb/function-bind/commit/d03555ca59dea3b71ce710045e4303b9e2619e28)
|
||||||
|
- [meta] add `safe-publish-latest` [`9c8f809`](https://github.com/ljharb/function-bind/commit/9c8f8092aed027d7e80c94f517aa892385b64f09)
|
||||||
|
- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`baf6893`](https://github.com/ljharb/function-bind/commit/baf6893e27f5b59abe88bc1995e6f6ed1e527397)
|
||||||
|
- [meta] create SECURITY.md [`4db1779`](https://github.com/ljharb/function-bind/commit/4db17799f1f28ae294cb95e0081ca2b591c3911b)
|
||||||
|
- [Tests] add `npm run audit` [`c8b38ec`](https://github.com/ljharb/function-bind/commit/c8b38ec40ed3f85dabdee40ed4148f1748375bc2)
|
||||||
|
- Revert "Point to the correct file" [`05cdf0f`](https://github.com/ljharb/function-bind/commit/05cdf0fa205c6a3c5ba40bbedd1dfa9874f915c9)
|
||||||
|
|
||||||
|
## [v1.1.1](https://github.com/ljharb/function-bind/compare/v1.1.0...v1.1.1) - 2017-08-28
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- [Tests] up to `node` `v8`; newer npm breaks on older node; fix scripts [`817f7d2`](https://github.com/ljharb/function-bind/commit/817f7d28470fdbff8ef608d4d565dd4d1430bc5e)
|
||||||
|
- [Dev Deps] update `eslint`, `jscs`, `tape`, `@ljharb/eslint-config` [`854288b`](https://github.com/ljharb/function-bind/commit/854288b1b6f5c555f89aceb9eff1152510262084)
|
||||||
|
- [Dev Deps] update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`83e639f`](https://github.com/ljharb/function-bind/commit/83e639ff74e6cd6921285bccec22c1bcf72311bd)
|
||||||
|
- Only apps should have lockfiles [`5ed97f5`](https://github.com/ljharb/function-bind/commit/5ed97f51235c17774e0832e122abda0f3229c908)
|
||||||
|
- Use a SPDX-compliant “license” field. [`5feefea`](https://github.com/ljharb/function-bind/commit/5feefea0dc0193993e83e5df01ded424403a5381)
|
||||||
|
|
||||||
|
## [v1.1.0](https://github.com/ljharb/function-bind/compare/v1.0.2...v1.1.0) - 2016-02-14
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- Update `eslint`, `tape`; use my personal shared `eslint` config [`9c9062a`](https://github.com/ljharb/function-bind/commit/9c9062abbe9dd70b59ea2c3a3c3a81f29b457097)
|
||||||
|
- Add `npm run eslint` [`dd96c56`](https://github.com/ljharb/function-bind/commit/dd96c56720034a3c1ffee10b8a59a6f7c53e24ad)
|
||||||
|
- [New] return the native `bind` when available. [`82186e0`](https://github.com/ljharb/function-bind/commit/82186e03d73e580f95ff167e03f3582bed90ed72)
|
||||||
|
- [Dev Deps] update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`a3dd767`](https://github.com/ljharb/function-bind/commit/a3dd76720c795cb7f4586b0544efabf8aa107b8b)
|
||||||
|
- Update `eslint` [`3dae2f7`](https://github.com/ljharb/function-bind/commit/3dae2f7423de30a2d20313ddb1edc19660142fe9)
|
||||||
|
- Update `tape`, `covert`, `jscs` [`a181eee`](https://github.com/ljharb/function-bind/commit/a181eee0cfa24eb229c6e843a971f36e060a2f6a)
|
||||||
|
- [Tests] up to `node` `v5.6`, `v4.3` [`964929a`](https://github.com/ljharb/function-bind/commit/964929a6a4ddb36fb128de2bcc20af5e4f22e1ed)
|
||||||
|
- Test up to `io.js` `v2.1` [`2be7310`](https://github.com/ljharb/function-bind/commit/2be7310f2f74886a7124ca925be411117d41d5ea)
|
||||||
|
- Update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`45f3d68`](https://github.com/ljharb/function-bind/commit/45f3d6865c6ca93726abcef54febe009087af101)
|
||||||
|
- [Dev Deps] update `tape`, `jscs` [`6e1340d`](https://github.com/ljharb/function-bind/commit/6e1340d94642deaecad3e717825db641af4f8b1f)
|
||||||
|
- [Tests] up to `io.js` `v3.3`, `node` `v4.1` [`d9bad2b`](https://github.com/ljharb/function-bind/commit/d9bad2b778b1b3a6dd2876087b88b3acf319f8cc)
|
||||||
|
- Update `eslint` [`935590c`](https://github.com/ljharb/function-bind/commit/935590caa024ab356102e4858e8fc315b2ccc446)
|
||||||
|
- [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config` [`8c9a1ef`](https://github.com/ljharb/function-bind/commit/8c9a1efd848e5167887aa8501857a0940a480c57)
|
||||||
|
- Test on `io.js` `v2.2` [`9a3a38c`](https://github.com/ljharb/function-bind/commit/9a3a38c92013aed6e108666e7bd40969b84ac86e)
|
||||||
|
- Run `travis-ci` tests on `iojs` and `node` v0.12; speed up builds; allow 0.8 failures. [`69afc26`](https://github.com/ljharb/function-bind/commit/69afc2617405b147dd2a8d8ae73ca9e9283f18b4)
|
||||||
|
- [Dev Deps] Update `tape`, `eslint` [`36c1be0`](https://github.com/ljharb/function-bind/commit/36c1be0ab12b45fe5df6b0fdb01a5d5137fd0115)
|
||||||
|
- Update `tape`, `jscs` [`98d8303`](https://github.com/ljharb/function-bind/commit/98d8303cd5ca1c6b8f985469f86b0d44d7d45f6e)
|
||||||
|
- Update `jscs` [`9633a4e`](https://github.com/ljharb/function-bind/commit/9633a4e9fbf82051c240855166e468ba8ba0846f)
|
||||||
|
- Update `tape`, `jscs` [`c80ef0f`](https://github.com/ljharb/function-bind/commit/c80ef0f46efc9791e76fa50de4414092ac147831)
|
||||||
|
- Test up to `io.js` `v3.0` [`7e2c853`](https://github.com/ljharb/function-bind/commit/7e2c8537d52ab9cf5a655755561d8917684c0df4)
|
||||||
|
- Test on `io.js` `v2.4` [`5a199a2`](https://github.com/ljharb/function-bind/commit/5a199a27ba46795ba5eaf0845d07d4b8232895c9)
|
||||||
|
- Test on `io.js` `v2.3` [`a511b88`](https://github.com/ljharb/function-bind/commit/a511b8896de0bddf3b56862daa416c701f4d0453)
|
||||||
|
- Fixing a typo from 822b4e1938db02dc9584aa434fd3a45cb20caf43 [`732d6b6`](https://github.com/ljharb/function-bind/commit/732d6b63a9b33b45230e630dbcac7a10855d3266)
|
||||||
|
- Update `jscs` [`da52a48`](https://github.com/ljharb/function-bind/commit/da52a4886c06d6490f46ae30b15e4163ba08905d)
|
||||||
|
- Lock covert to v1.0.0. [`d6150fd`](https://github.com/ljharb/function-bind/commit/d6150fda1e6f486718ebdeff823333d9e48e7430)
|
||||||
|
|
||||||
|
## [v1.0.2](https://github.com/ljharb/function-bind/compare/v1.0.1...v1.0.2) - 2014-10-04
|
||||||
|
|
||||||
|
## [v1.0.1](https://github.com/ljharb/function-bind/compare/v1.0.0...v1.0.1) - 2014-10-03
|
||||||
|
|
||||||
|
### Merged
|
||||||
|
|
||||||
|
- make CI build faster [`#3`](https://github.com/ljharb/function-bind/pull/3)
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- Using my standard jscs.json [`d8ee94c`](https://github.com/ljharb/function-bind/commit/d8ee94c993eff0a84cf5744fe6a29627f5cffa1a)
|
||||||
|
- Adding `npm run lint` [`7571ab7`](https://github.com/ljharb/function-bind/commit/7571ab7dfdbd99b25a1dbb2d232622bd6f4f9c10)
|
||||||
|
- Using consistent indentation [`e91a1b1`](https://github.com/ljharb/function-bind/commit/e91a1b13a61e99ec1e530e299b55508f74218a95)
|
||||||
|
- Updating jscs [`7e17892`](https://github.com/ljharb/function-bind/commit/7e1789284bc629bc9c1547a61c9b227bbd8c7a65)
|
||||||
|
- Using consistent quotes [`c50b57f`](https://github.com/ljharb/function-bind/commit/c50b57fcd1c5ec38320979c837006069ebe02b77)
|
||||||
|
- Adding keywords [`cb94631`](https://github.com/ljharb/function-bind/commit/cb946314eed35f21186a25fb42fc118772f9ee00)
|
||||||
|
- Directly export a function expression instead of using a declaration, and relying on hoisting. [`5a33c5f`](https://github.com/ljharb/function-bind/commit/5a33c5f45642de180e0d207110bf7d1843ceb87c)
|
||||||
|
- Naming npm URL and badge in README; use SVG [`2aef8fc`](https://github.com/ljharb/function-bind/commit/2aef8fcb79d54e63a58ae557c4e60949e05d5e16)
|
||||||
|
- Naming deps URLs in README [`04228d7`](https://github.com/ljharb/function-bind/commit/04228d766670ee45ca24e98345c1f6a7621065b5)
|
||||||
|
- Naming travis-ci URLs in README; using SVG [`62c810c`](https://github.com/ljharb/function-bind/commit/62c810c2f54ced956cd4d4ab7b793055addfe36e)
|
||||||
|
- Make sure functions are invoked correctly (also passing coverage tests) [`2b289b4`](https://github.com/ljharb/function-bind/commit/2b289b4dfbf037ffcfa4dc95eb540f6165e9e43a)
|
||||||
|
- Removing the strict mode pragmas; they make tests fail. [`1aa701d`](https://github.com/ljharb/function-bind/commit/1aa701d199ddc3782476e8f7eef82679be97b845)
|
||||||
|
- Adding myself as a contributor [`85fd57b`](https://github.com/ljharb/function-bind/commit/85fd57b0860e5a7af42de9a287f3f265fc6d72fc)
|
||||||
|
- Adding strict mode pragmas [`915b08e`](https://github.com/ljharb/function-bind/commit/915b08e084c86a722eafe7245e21db74aa21ca4c)
|
||||||
|
- Adding devDeps URLs to README [`4ccc731`](https://github.com/ljharb/function-bind/commit/4ccc73112c1769859e4ca3076caf4086b3cba2cd)
|
||||||
|
- Fixing the description. [`a7a472c`](https://github.com/ljharb/function-bind/commit/a7a472cf649af515c635cf560fc478fbe48999c8)
|
||||||
|
- Using a function expression instead of a function declaration. [`b5d3e4e`](https://github.com/ljharb/function-bind/commit/b5d3e4ea6aaffc63888953eeb1fbc7ff45f1fa14)
|
||||||
|
- Updating tape [`f086be6`](https://github.com/ljharb/function-bind/commit/f086be6029fb56dde61a258c1340600fa174d1e0)
|
||||||
|
- Updating jscs [`5f9bdb3`](https://github.com/ljharb/function-bind/commit/5f9bdb375ab13ba48f30852aab94029520c54d71)
|
||||||
|
- Updating jscs [`9b409ba`](https://github.com/ljharb/function-bind/commit/9b409ba6118e23395a4e5d83ef39152aab9d3bfc)
|
||||||
|
- Run coverage as part of tests. [`8e1b6d4`](https://github.com/ljharb/function-bind/commit/8e1b6d459f047d1bd4fee814e01247c984c80bd0)
|
||||||
|
- Run linter as part of tests [`c1ca83f`](https://github.com/ljharb/function-bind/commit/c1ca83f832df94587d09e621beba682fabfaa987)
|
||||||
|
- Updating covert [`701e837`](https://github.com/ljharb/function-bind/commit/701e83774b57b4d3ef631e1948143f43a72f4bb9)
|
||||||
|
|
||||||
|
## [v1.0.0](https://github.com/ljharb/function-bind/compare/v0.2.0...v1.0.0) - 2014-08-09
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- Make sure old and unstable nodes don't fail Travis [`27adca3`](https://github.com/ljharb/function-bind/commit/27adca34a4ab6ad67b6dfde43942a1b103ce4d75)
|
||||||
|
- Fixing an issue when the bound function is called as a constructor in ES3. [`e20122d`](https://github.com/ljharb/function-bind/commit/e20122d267d92ce553859b280cbbea5d27c07731)
|
||||||
|
- Adding `npm run coverage` [`a2e29c4`](https://github.com/ljharb/function-bind/commit/a2e29c4ecaef9e2f6cd1603e868c139073375502)
|
||||||
|
- Updating tape [`b741168`](https://github.com/ljharb/function-bind/commit/b741168b12b235b1717ff696087645526b69213c)
|
||||||
|
- Upgrading tape [`63631a0`](https://github.com/ljharb/function-bind/commit/63631a04c7fbe97cc2fa61829cc27246d6986f74)
|
||||||
|
- Updating tape [`363cb46`](https://github.com/ljharb/function-bind/commit/363cb46dafb23cb3e347729a22f9448051d78464)
|
||||||
|
|
||||||
|
## v0.2.0 - 2014-03-23
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- Updating test coverage to match es5-shim. [`aa94d44`](https://github.com/ljharb/function-bind/commit/aa94d44b8f9d7f69f10e060db7709aa7a694e5d4)
|
||||||
|
- initial [`942ee07`](https://github.com/ljharb/function-bind/commit/942ee07e94e542d91798137bc4b80b926137e066)
|
||||||
|
- Setting the bound function's length properly. [`079f46a`](https://github.com/ljharb/function-bind/commit/079f46a2d3515b7c0b308c2c13fceb641f97ca25)
|
||||||
|
- Ensuring that some older browsers will throw when given a regex. [`36ac55b`](https://github.com/ljharb/function-bind/commit/36ac55b87f460d4330253c92870aa26fbfe8227f)
|
||||||
|
- Removing npm scripts that don't have dependencies [`9d2be60`](https://github.com/ljharb/function-bind/commit/9d2be600002cb8bc8606f8f3585ad3e05868c750)
|
||||||
|
- Updating tape [`297a4ac`](https://github.com/ljharb/function-bind/commit/297a4acc5464db381940aafb194d1c88f4e678f3)
|
||||||
|
- Skipping length tests for now. [`d9891ea`](https://github.com/ljharb/function-bind/commit/d9891ea4d2aaffa69f408339cdd61ff740f70565)
|
||||||
|
- don't take my tea [`dccd930`](https://github.com/ljharb/function-bind/commit/dccd930bfd60ea10cb178d28c97550c3bc8c1e07)
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
Copyright (c) 2013 Raynos.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
# function-bind <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
||||||
|
|
||||||
|
[![github actions][actions-image]][actions-url]
|
||||||
|
<!--[![coverage][codecov-image]][codecov-url]-->
|
||||||
|
[![dependency status][deps-svg]][deps-url]
|
||||||
|
[![dev dependency status][dev-deps-svg]][dev-deps-url]
|
||||||
|
[![License][license-image]][license-url]
|
||||||
|
[![Downloads][downloads-image]][downloads-url]
|
||||||
|
|
||||||
|
[![npm badge][npm-badge-png]][package-url]
|
||||||
|
|
||||||
|
Implementation of function.prototype.bind
|
||||||
|
|
||||||
|
Old versions of phantomjs, Internet Explorer < 9, and node < 0.6 don't support `Function.prototype.bind`.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```js
|
||||||
|
Function.prototype.bind = require("function-bind")
|
||||||
|
```
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
`npm install function-bind`
|
||||||
|
|
||||||
|
## Contributors
|
||||||
|
|
||||||
|
- Raynos
|
||||||
|
|
||||||
|
## MIT Licenced
|
||||||
|
|
||||||
|
[package-url]: https://npmjs.org/package/function-bind
|
||||||
|
[npm-version-svg]: https://versionbadg.es/Raynos/function-bind.svg
|
||||||
|
[deps-svg]: https://david-dm.org/Raynos/function-bind.svg
|
||||||
|
[deps-url]: https://david-dm.org/Raynos/function-bind
|
||||||
|
[dev-deps-svg]: https://david-dm.org/Raynos/function-bind/dev-status.svg
|
||||||
|
[dev-deps-url]: https://david-dm.org/Raynos/function-bind#info=devDependencies
|
||||||
|
[npm-badge-png]: https://nodei.co/npm/function-bind.png?downloads=true&stars=true
|
||||||
|
[license-image]: https://img.shields.io/npm/l/function-bind.svg
|
||||||
|
[license-url]: LICENSE
|
||||||
|
[downloads-image]: https://img.shields.io/npm/dm/function-bind.svg
|
||||||
|
[downloads-url]: https://npm-stat.com/charts.html?package=function-bind
|
||||||
|
[codecov-image]: https://codecov.io/gh/Raynos/function-bind/branch/main/graphs/badge.svg
|
||||||
|
[codecov-url]: https://app.codecov.io/gh/Raynos/function-bind/
|
||||||
|
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/Raynos/function-bind
|
||||||
|
[actions-url]: https://github.com/Raynos/function-bind/actions
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
/* eslint no-invalid-this: 1 */
|
||||||
|
|
||||||
|
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
|
||||||
|
var toStr = Object.prototype.toString;
|
||||||
|
var max = Math.max;
|
||||||
|
var funcType = '[object Function]';
|
||||||
|
|
||||||
|
var concatty = function concatty(a, b) {
|
||||||
|
var arr = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < a.length; i += 1) {
|
||||||
|
arr[i] = a[i];
|
||||||
|
}
|
||||||
|
for (var j = 0; j < b.length; j += 1) {
|
||||||
|
arr[j + a.length] = b[j];
|
||||||
|
}
|
||||||
|
|
||||||
|
return arr;
|
||||||
|
};
|
||||||
|
|
||||||
|
var slicy = function slicy(arrLike, offset) {
|
||||||
|
var arr = [];
|
||||||
|
for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
|
||||||
|
arr[j] = arrLike[i];
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
};
|
||||||
|
|
||||||
|
var joiny = function (arr, joiner) {
|
||||||
|
var str = '';
|
||||||
|
for (var i = 0; i < arr.length; i += 1) {
|
||||||
|
str += arr[i];
|
||||||
|
if (i + 1 < arr.length) {
|
||||||
|
str += joiner;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = function bind(that) {
|
||||||
|
var target = this;
|
||||||
|
if (typeof target !== 'function' || toStr.apply(target) !== funcType) {
|
||||||
|
throw new TypeError(ERROR_MESSAGE + target);
|
||||||
|
}
|
||||||
|
var args = slicy(arguments, 1);
|
||||||
|
|
||||||
|
var bound;
|
||||||
|
var binder = function () {
|
||||||
|
if (this instanceof bound) {
|
||||||
|
var result = target.apply(
|
||||||
|
this,
|
||||||
|
concatty(args, arguments)
|
||||||
|
);
|
||||||
|
if (Object(result) === result) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return target.apply(
|
||||||
|
that,
|
||||||
|
concatty(args, arguments)
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var boundLength = max(0, target.length - args.length);
|
||||||
|
var boundArgs = [];
|
||||||
|
for (var i = 0; i < boundLength; i++) {
|
||||||
|
boundArgs[i] = '$' + i;
|
||||||
|
}
|
||||||
|
|
||||||
|
bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder);
|
||||||
|
|
||||||
|
if (target.prototype) {
|
||||||
|
var Empty = function Empty() {};
|
||||||
|
Empty.prototype = target.prototype;
|
||||||
|
bound.prototype = new Empty();
|
||||||
|
Empty.prototype = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bound;
|
||||||
|
};
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var implementation = require('./implementation');
|
||||||
|
|
||||||
|
module.exports = Function.prototype.bind || implementation;
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
{
|
||||||
|
"name": "function-bind",
|
||||||
|
"version": "1.1.2",
|
||||||
|
"description": "Implementation of Function.prototype.bind",
|
||||||
|
"keywords": [
|
||||||
|
"function",
|
||||||
|
"bind",
|
||||||
|
"shim",
|
||||||
|
"es5"
|
||||||
|
],
|
||||||
|
"author": "Raynos <raynos2@gmail.com>",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/Raynos/function-bind.git"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
},
|
||||||
|
"main": "index",
|
||||||
|
"homepage": "https://github.com/Raynos/function-bind",
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Raynos"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Jordan Harband",
|
||||||
|
"url": "https://github.com/ljharb"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/Raynos/function-bind/issues",
|
||||||
|
"email": "raynos2@gmail.com"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@ljharb/eslint-config": "^21.1.0",
|
||||||
|
"aud": "^2.0.3",
|
||||||
|
"auto-changelog": "^2.4.0",
|
||||||
|
"eslint": "=8.8.0",
|
||||||
|
"in-publish": "^2.0.1",
|
||||||
|
"npmignore": "^0.3.0",
|
||||||
|
"nyc": "^10.3.2",
|
||||||
|
"safe-publish-latest": "^2.0.0",
|
||||||
|
"tape": "^5.7.1"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"scripts": {
|
||||||
|
"prepublishOnly": "safe-publish-latest",
|
||||||
|
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||||
|
"prepack": "npmignore --auto --commentLines=autogenerated",
|
||||||
|
"pretest": "npm run lint",
|
||||||
|
"test": "npm run tests-only",
|
||||||
|
"posttest": "aud --production",
|
||||||
|
"tests-only": "nyc tape 'test/**/*.js'",
|
||||||
|
"lint": "eslint --ext=js,mjs .",
|
||||||
|
"version": "auto-changelog && git add CHANGELOG.md",
|
||||||
|
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
||||||
|
},
|
||||||
|
"testling": {
|
||||||
|
"files": "test/index.js",
|
||||||
|
"browsers": [
|
||||||
|
"ie/8..latest",
|
||||||
|
"firefox/16..latest",
|
||||||
|
"firefox/nightly",
|
||||||
|
"chrome/22..latest",
|
||||||
|
"chrome/canary",
|
||||||
|
"opera/12..latest",
|
||||||
|
"opera/next",
|
||||||
|
"safari/5.1..latest",
|
||||||
|
"ipad/6.0..latest",
|
||||||
|
"iphone/6.0..latest",
|
||||||
|
"android-browser/4.2..latest"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"auto-changelog": {
|
||||||
|
"output": "CHANGELOG.md",
|
||||||
|
"template": "keepachangelog",
|
||||||
|
"unreleased": false,
|
||||||
|
"commitLimit": false,
|
||||||
|
"backfillLimit": false,
|
||||||
|
"hideCredit": true
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"ignore": [
|
||||||
|
".github/workflows"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"rules": {
|
||||||
|
"array-bracket-newline": 0,
|
||||||
|
"array-element-newline": 0,
|
||||||
|
"max-statements-per-line": [2, { "max": 2 }],
|
||||||
|
"no-invalid-this": 0,
|
||||||
|
"no-magic-numbers": 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,252 @@
|
|||||||
|
// jscs:disable requireUseStrict
|
||||||
|
|
||||||
|
var test = require('tape');
|
||||||
|
|
||||||
|
var functionBind = require('../implementation');
|
||||||
|
var getCurrentContext = function () { return this; };
|
||||||
|
|
||||||
|
test('functionBind is a function', function (t) {
|
||||||
|
t.equal(typeof functionBind, 'function');
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('non-functions', function (t) {
|
||||||
|
var nonFunctions = [true, false, [], {}, 42, 'foo', NaN, /a/g];
|
||||||
|
t.plan(nonFunctions.length);
|
||||||
|
for (var i = 0; i < nonFunctions.length; ++i) {
|
||||||
|
try { functionBind.call(nonFunctions[i]); } catch (ex) {
|
||||||
|
t.ok(ex instanceof TypeError, 'throws when given ' + String(nonFunctions[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('without a context', function (t) {
|
||||||
|
t.test('binds properly', function (st) {
|
||||||
|
var args, context;
|
||||||
|
var namespace = {
|
||||||
|
func: functionBind.call(function () {
|
||||||
|
args = Array.prototype.slice.call(arguments);
|
||||||
|
context = this;
|
||||||
|
})
|
||||||
|
};
|
||||||
|
namespace.func(1, 2, 3);
|
||||||
|
st.deepEqual(args, [1, 2, 3]);
|
||||||
|
st.equal(context, getCurrentContext.call());
|
||||||
|
st.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
t.test('binds properly, and still supplies bound arguments', function (st) {
|
||||||
|
var args, context;
|
||||||
|
var namespace = {
|
||||||
|
func: functionBind.call(function () {
|
||||||
|
args = Array.prototype.slice.call(arguments);
|
||||||
|
context = this;
|
||||||
|
}, undefined, 1, 2, 3)
|
||||||
|
};
|
||||||
|
namespace.func(4, 5, 6);
|
||||||
|
st.deepEqual(args, [1, 2, 3, 4, 5, 6]);
|
||||||
|
st.equal(context, getCurrentContext.call());
|
||||||
|
st.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
t.test('returns properly', function (st) {
|
||||||
|
var args;
|
||||||
|
var namespace = {
|
||||||
|
func: functionBind.call(function () {
|
||||||
|
args = Array.prototype.slice.call(arguments);
|
||||||
|
return this;
|
||||||
|
}, null)
|
||||||
|
};
|
||||||
|
var context = namespace.func(1, 2, 3);
|
||||||
|
st.equal(context, getCurrentContext.call(), 'returned context is namespaced context');
|
||||||
|
st.deepEqual(args, [1, 2, 3], 'passed arguments are correct');
|
||||||
|
st.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
t.test('returns properly with bound arguments', function (st) {
|
||||||
|
var args;
|
||||||
|
var namespace = {
|
||||||
|
func: functionBind.call(function () {
|
||||||
|
args = Array.prototype.slice.call(arguments);
|
||||||
|
return this;
|
||||||
|
}, null, 1, 2, 3)
|
||||||
|
};
|
||||||
|
var context = namespace.func(4, 5, 6);
|
||||||
|
st.equal(context, getCurrentContext.call(), 'returned context is namespaced context');
|
||||||
|
st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'passed arguments are correct');
|
||||||
|
st.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
t.test('called as a constructor', function (st) {
|
||||||
|
var thunkify = function (value) {
|
||||||
|
return function () { return value; };
|
||||||
|
};
|
||||||
|
st.test('returns object value', function (sst) {
|
||||||
|
var expectedReturnValue = [1, 2, 3];
|
||||||
|
var Constructor = functionBind.call(thunkify(expectedReturnValue), null);
|
||||||
|
var result = new Constructor();
|
||||||
|
sst.equal(result, expectedReturnValue);
|
||||||
|
sst.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
st.test('does not return primitive value', function (sst) {
|
||||||
|
var Constructor = functionBind.call(thunkify(42), null);
|
||||||
|
var result = new Constructor();
|
||||||
|
sst.notEqual(result, 42);
|
||||||
|
sst.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
st.test('object from bound constructor is instance of original and bound constructor', function (sst) {
|
||||||
|
var A = function (x) {
|
||||||
|
this.name = x || 'A';
|
||||||
|
};
|
||||||
|
var B = functionBind.call(A, null, 'B');
|
||||||
|
|
||||||
|
var result = new B();
|
||||||
|
sst.ok(result instanceof B, 'result is instance of bound constructor');
|
||||||
|
sst.ok(result instanceof A, 'result is instance of original constructor');
|
||||||
|
sst.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
st.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('with a context', function (t) {
|
||||||
|
t.test('with no bound arguments', function (st) {
|
||||||
|
var args, context;
|
||||||
|
var boundContext = {};
|
||||||
|
var namespace = {
|
||||||
|
func: functionBind.call(function () {
|
||||||
|
args = Array.prototype.slice.call(arguments);
|
||||||
|
context = this;
|
||||||
|
}, boundContext)
|
||||||
|
};
|
||||||
|
namespace.func(1, 2, 3);
|
||||||
|
st.equal(context, boundContext, 'binds a context properly');
|
||||||
|
st.deepEqual(args, [1, 2, 3], 'supplies passed arguments');
|
||||||
|
st.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
t.test('with bound arguments', function (st) {
|
||||||
|
var args, context;
|
||||||
|
var boundContext = {};
|
||||||
|
var namespace = {
|
||||||
|
func: functionBind.call(function () {
|
||||||
|
args = Array.prototype.slice.call(arguments);
|
||||||
|
context = this;
|
||||||
|
}, boundContext, 1, 2, 3)
|
||||||
|
};
|
||||||
|
namespace.func(4, 5, 6);
|
||||||
|
st.equal(context, boundContext, 'binds a context properly');
|
||||||
|
st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'supplies bound and passed arguments');
|
||||||
|
st.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
t.test('returns properly', function (st) {
|
||||||
|
var boundContext = {};
|
||||||
|
var args;
|
||||||
|
var namespace = {
|
||||||
|
func: functionBind.call(function () {
|
||||||
|
args = Array.prototype.slice.call(arguments);
|
||||||
|
return this;
|
||||||
|
}, boundContext)
|
||||||
|
};
|
||||||
|
var context = namespace.func(1, 2, 3);
|
||||||
|
st.equal(context, boundContext, 'returned context is bound context');
|
||||||
|
st.notEqual(context, getCurrentContext.call(), 'returned context is not lexical context');
|
||||||
|
st.deepEqual(args, [1, 2, 3], 'passed arguments are correct');
|
||||||
|
st.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
t.test('returns properly with bound arguments', function (st) {
|
||||||
|
var boundContext = {};
|
||||||
|
var args;
|
||||||
|
var namespace = {
|
||||||
|
func: functionBind.call(function () {
|
||||||
|
args = Array.prototype.slice.call(arguments);
|
||||||
|
return this;
|
||||||
|
}, boundContext, 1, 2, 3)
|
||||||
|
};
|
||||||
|
var context = namespace.func(4, 5, 6);
|
||||||
|
st.equal(context, boundContext, 'returned context is bound context');
|
||||||
|
st.notEqual(context, getCurrentContext.call(), 'returned context is not lexical context');
|
||||||
|
st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'passed arguments are correct');
|
||||||
|
st.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
t.test('passes the correct arguments when called as a constructor', function (st) {
|
||||||
|
var expected = { name: 'Correct' };
|
||||||
|
var namespace = {
|
||||||
|
Func: functionBind.call(function (arg) {
|
||||||
|
return arg;
|
||||||
|
}, { name: 'Incorrect' })
|
||||||
|
};
|
||||||
|
var returned = new namespace.Func(expected);
|
||||||
|
st.equal(returned, expected, 'returns the right arg when called as a constructor');
|
||||||
|
st.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
t.test('has the new instance\'s context when called as a constructor', function (st) {
|
||||||
|
var actualContext;
|
||||||
|
var expectedContext = { foo: 'bar' };
|
||||||
|
var namespace = {
|
||||||
|
Func: functionBind.call(function () {
|
||||||
|
actualContext = this;
|
||||||
|
}, expectedContext)
|
||||||
|
};
|
||||||
|
var result = new namespace.Func();
|
||||||
|
st.equal(result instanceof namespace.Func, true);
|
||||||
|
st.notEqual(actualContext, expectedContext);
|
||||||
|
st.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('bound function length', function (t) {
|
||||||
|
t.test('sets a correct length without thisArg', function (st) {
|
||||||
|
var subject = functionBind.call(function (a, b, c) { return a + b + c; });
|
||||||
|
st.equal(subject.length, 3);
|
||||||
|
st.equal(subject(1, 2, 3), 6);
|
||||||
|
st.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
t.test('sets a correct length with thisArg', function (st) {
|
||||||
|
var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {});
|
||||||
|
st.equal(subject.length, 3);
|
||||||
|
st.equal(subject(1, 2, 3), 6);
|
||||||
|
st.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
t.test('sets a correct length without thisArg and first argument', function (st) {
|
||||||
|
var subject = functionBind.call(function (a, b, c) { return a + b + c; }, undefined, 1);
|
||||||
|
st.equal(subject.length, 2);
|
||||||
|
st.equal(subject(2, 3), 6);
|
||||||
|
st.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
t.test('sets a correct length with thisArg and first argument', function (st) {
|
||||||
|
var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}, 1);
|
||||||
|
st.equal(subject.length, 2);
|
||||||
|
st.equal(subject(2, 3), 6);
|
||||||
|
st.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
t.test('sets a correct length without thisArg and too many arguments', function (st) {
|
||||||
|
var subject = functionBind.call(function (a, b, c) { return a + b + c; }, undefined, 1, 2, 3, 4);
|
||||||
|
st.equal(subject.length, 0);
|
||||||
|
st.equal(subject(), 6);
|
||||||
|
st.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
t.test('sets a correct length with thisArg and too many arguments', function (st) {
|
||||||
|
var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}, 1, 2, 3, 4);
|
||||||
|
st.equal(subject.length, 0);
|
||||||
|
st.equal(subject(), 6);
|
||||||
|
st.end();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: [ljharb]
|
||||||
|
patreon: # Replace with a single Patreon username
|
||||||
|
open_collective: # Replace with a single Open Collective username
|
||||||
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
|
tidelift: npm/hasown
|
||||||
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||||
|
liberapay: # Replace with a single Liberapay username
|
||||||
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
|
otechie: # Replace with a single Otechie username
|
||||||
|
custom: # Replace with a single custom sponsorship URL
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"all": true,
|
||||||
|
"check-coverage": false,
|
||||||
|
"reporter": ["text-summary", "text", "html", "json"],
|
||||||
|
"lines": 86,
|
||||||
|
"statements": 85.93,
|
||||||
|
"functions": 82.43,
|
||||||
|
"branches": 76.06,
|
||||||
|
"exclude": [
|
||||||
|
"coverage",
|
||||||
|
"test"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||||
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [v2.0.4](https://github.com/inspect-js/hasOwn/compare/v2.0.3...v2.0.4) - 2026-05-28
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- [types] drop the dead key-narrowing overload [`fdab00e`](https://github.com/inspect-js/hasOwn/commit/fdab00e2703e65411424e19bf86a7e72a8f10da9)
|
||||||
|
- [Dev Deps] update `@ljharb/eslint-config`, `auto-changelog`, `eslint` [`91f6247`](https://github.com/inspect-js/hasOwn/commit/91f624768dd0f7db0d019b89d4d86bd66e20ec30)
|
||||||
|
|
||||||
|
## [v2.0.3](https://github.com/inspect-js/hasOwn/compare/v2.0.2...v2.0.3) - 2026-04-17
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- [actions] update workflows [`fb837b8`](https://github.com/inspect-js/hasOwn/commit/fb837b849bcdb8416fdc8fd344edfacd5574696c)
|
||||||
|
- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/eslint-config`, `@ljharb/tsconfig`, `@types/tape`, `auto-changelog`, `eslint`, `mock-property`, `npmignore`, `tape` [`f4b279b`](https://github.com/inspect-js/hasOwn/commit/f4b279bd682be34b3f0ede2a58d4e8acb58d6d47)
|
||||||
|
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`; migrate to flat config [`7e415ce`](https://github.com/inspect-js/hasOwn/commit/7e415cee55ebf43b3c34d7fd86db73a9928b05f7)
|
||||||
|
- [Dev Deps] update `eslint` [`ef313da`](https://github.com/inspect-js/hasOwn/commit/ef313da342d33b60e23e738b9f5a86f6065f39ef)
|
||||||
|
- [meta] use `npm audit` instead of `aud` [`d5c6d4d`](https://github.com/inspect-js/hasOwn/commit/d5c6d4d7a19c6ca4f14ac173b30d8bf25abcabee)
|
||||||
|
- [types] add overload that narrows the key [`cc03a09`](https://github.com/inspect-js/hasOwn/commit/cc03a097e9402fb8b86d413050e67f790dd6c8c5)
|
||||||
|
|
||||||
|
## [v2.0.2](https://github.com/inspect-js/hasOwn/compare/v2.0.1...v2.0.2) - 2024-03-10
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- [types] use shared config [`68e9d4d`](https://github.com/inspect-js/hasOwn/commit/68e9d4dab6facb4f05f02c6baea94a3f2a4e44b2)
|
||||||
|
- [actions] remove redundant finisher; use reusable workflow [`241a68e`](https://github.com/inspect-js/hasOwn/commit/241a68e13ea1fe52bec5ba7f74144befc31fae7b)
|
||||||
|
- [Tests] increase coverage [`4125c0d`](https://github.com/inspect-js/hasOwn/commit/4125c0d6121db56ae30e38346dfb0c000b04f0a7)
|
||||||
|
- [Tests] skip `npm ls` in old node due to TS [`01b9282`](https://github.com/inspect-js/hasOwn/commit/01b92822f9971dea031eafdd14767df41d61c202)
|
||||||
|
- [types] improve predicate type [`d340f85`](https://github.com/inspect-js/hasOwn/commit/d340f85ce02e286ef61096cbbb6697081d40a12b)
|
||||||
|
- [Dev Deps] update `tape` [`70089fc`](https://github.com/inspect-js/hasOwn/commit/70089fcf544e64acc024cbe60f5a9b00acad86de)
|
||||||
|
- [Tests] use `@arethetypeswrong/cli` [`50b272c`](https://github.com/inspect-js/hasOwn/commit/50b272c829f40d053a3dd91c9796e0ac0b2af084)
|
||||||
|
|
||||||
|
## [v2.0.1](https://github.com/inspect-js/hasOwn/compare/v2.0.0...v2.0.1) - 2024-02-10
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- [types] use a handwritten d.ts file; fix exported type [`012b989`](https://github.com/inspect-js/hasOwn/commit/012b9898ccf91dc441e2ebf594ff70270a5fda58)
|
||||||
|
- [Dev Deps] update `@types/function-bind`, `@types/mock-property`, `@types/tape`, `aud`, `mock-property`, `npmignore`, `tape`, `typescript` [`977a56f`](https://github.com/inspect-js/hasOwn/commit/977a56f51a1f8b20566f3c471612137894644025)
|
||||||
|
- [meta] add `sideEffects` flag [`3a60b7b`](https://github.com/inspect-js/hasOwn/commit/3a60b7bf42fccd8c605e5f145a6fcc83b13cb46f)
|
||||||
|
|
||||||
|
## [v2.0.0](https://github.com/inspect-js/hasOwn/compare/v1.0.1...v2.0.0) - 2023-10-19
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- revamped implementation, tests, readme [`72bf8b3`](https://github.com/inspect-js/hasOwn/commit/72bf8b338e77a638f0a290c63ffaed18339c36b4)
|
||||||
|
- [meta] revamp package.json [`079775f`](https://github.com/inspect-js/hasOwn/commit/079775fb1ec72c1c6334069593617a0be3847458)
|
||||||
|
- Only apps should have lockfiles [`6640e23`](https://github.com/inspect-js/hasOwn/commit/6640e233d1bb8b65260880f90787637db157d215)
|
||||||
|
|
||||||
|
## v1.0.1 - 2023-10-10
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- Initial commit [`8dbfde6`](https://github.com/inspect-js/hasOwn/commit/8dbfde6e8fb0ebb076fab38d138f2984eb340a62)
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Jordan Harband and contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
# hasown <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
||||||
|
|
||||||
|
[![github actions][actions-image]][actions-url]
|
||||||
|
[![coverage][codecov-image]][codecov-url]
|
||||||
|
[![License][license-image]][license-url]
|
||||||
|
[![Downloads][downloads-image]][downloads-url]
|
||||||
|
|
||||||
|
[![npm badge][npm-badge-png]][package-url]
|
||||||
|
|
||||||
|
A robust, ES3 compatible, "has own property" predicate.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```js
|
||||||
|
const assert = require('assert');
|
||||||
|
const hasOwn = require('hasown');
|
||||||
|
|
||||||
|
assert.equal(hasOwn({}, 'toString'), false);
|
||||||
|
assert.equal(hasOwn([], 'length'), true);
|
||||||
|
assert.equal(hasOwn({ a: 42 }, 'a'), true);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
Simply clone the repo, `npm install`, and run `npm test`
|
||||||
|
|
||||||
|
[package-url]: https://npmjs.org/package/hasown
|
||||||
|
[npm-version-svg]: https://versionbadg.es/inspect-js/hasown.svg
|
||||||
|
[deps-svg]: https://david-dm.org/inspect-js/hasOwn.svg
|
||||||
|
[deps-url]: https://david-dm.org/inspect-js/hasOwn
|
||||||
|
[dev-deps-svg]: https://david-dm.org/inspect-js/hasOwn/dev-status.svg
|
||||||
|
[dev-deps-url]: https://david-dm.org/inspect-js/hasOwn#info=devDependencies
|
||||||
|
[npm-badge-png]: https://nodei.co/npm/hasown.png?downloads=true&stars=true
|
||||||
|
[license-image]: https://img.shields.io/npm/l/hasown.svg
|
||||||
|
[license-url]: LICENSE
|
||||||
|
[downloads-image]: https://img.shields.io/npm/dm/hasown.svg
|
||||||
|
[downloads-url]: https://npm-stat.com/charts.html?package=hasown
|
||||||
|
[codecov-image]: https://codecov.io/gh/inspect-js/hasOwn/branch/main/graphs/badge.svg
|
||||||
|
[codecov-url]: https://app.codecov.io/gh/inspect-js/hasOwn/
|
||||||
|
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/hasOwn
|
||||||
|
[actions-url]: https://github.com/inspect-js/hasOwn/actions
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import ljharbConfig from '@ljharb/eslint-config/flat';
|
||||||
|
|
||||||
|
export default [
|
||||||
|
...ljharbConfig,
|
||||||
|
{ rules: { 'no-extra-parens': 'off' } },
|
||||||
|
];
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
declare function hasOwn<O, K extends PropertyKey, V = unknown>(o: O, p: K): o is O & Record<K, V>;
|
||||||
|
|
||||||
|
export = hasOwn;
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var call = Function.prototype.call;
|
||||||
|
var $hasOwn = Object.prototype.hasOwnProperty;
|
||||||
|
var bind = require('function-bind');
|
||||||
|
|
||||||
|
/** @type {import('.')} */
|
||||||
|
module.exports = bind.call(call, $hasOwn);
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
{
|
||||||
|
"name": "hasown",
|
||||||
|
"version": "2.0.4",
|
||||||
|
"description": "A robust, ES3 compatible, \"has own property\" predicate.",
|
||||||
|
"main": "index.js",
|
||||||
|
"exports": {
|
||||||
|
".": "./index.js",
|
||||||
|
"./package.json": "./package.json"
|
||||||
|
},
|
||||||
|
"types": "index.d.ts",
|
||||||
|
"sideEffects": false,
|
||||||
|
"scripts": {
|
||||||
|
"prepack": "npmignore --auto --commentLines=autogenerated",
|
||||||
|
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||||
|
"prepublishOnly": "safe-publish-latest",
|
||||||
|
"prelint": "evalmd README.md",
|
||||||
|
"lint": "eslint .",
|
||||||
|
"postlint": "npm run tsc",
|
||||||
|
"pretest": "npm run lint",
|
||||||
|
"tsc": "tsc -p .",
|
||||||
|
"posttsc": "attw -P",
|
||||||
|
"tests-only": "nyc tape 'test/**/*.js'",
|
||||||
|
"test": "npm run tests-only",
|
||||||
|
"posttest": "npx npm@\">= 10.2\" audit --production",
|
||||||
|
"version": "auto-changelog && git add CHANGELOG.md",
|
||||||
|
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/inspect-js/hasOwn.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"has",
|
||||||
|
"hasOwnProperty",
|
||||||
|
"hasOwn",
|
||||||
|
"has-own",
|
||||||
|
"own",
|
||||||
|
"has",
|
||||||
|
"property",
|
||||||
|
"in",
|
||||||
|
"javascript",
|
||||||
|
"ecmascript"
|
||||||
|
],
|
||||||
|
"author": "Jordan Harband <ljharb@gmail.com>",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/inspect-js/hasOwn/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/inspect-js/hasOwn#readme",
|
||||||
|
"dependencies": {
|
||||||
|
"function-bind": "^1.1.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@arethetypeswrong/cli": "^0.18.2",
|
||||||
|
"@ljharb/eslint-config": "^22.2.3",
|
||||||
|
"@ljharb/tsconfig": "^0.3.2",
|
||||||
|
"@types/function-bind": "^1.1.10",
|
||||||
|
"@types/tape": "^5.8.1",
|
||||||
|
"auto-changelog": "^2.5.1",
|
||||||
|
"eslint": "^10.4.0",
|
||||||
|
"evalmd": "^0.0.19",
|
||||||
|
"in-publish": "^2.0.1",
|
||||||
|
"jiti": "^0.0.0",
|
||||||
|
"mock-property": "^1.1.0",
|
||||||
|
"npmignore": "^0.3.5",
|
||||||
|
"nyc": "^10.3.2",
|
||||||
|
"safe-publish-latest": "^2.0.0",
|
||||||
|
"tape": "^5.9.0",
|
||||||
|
"typescript": "next"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"testling": {
|
||||||
|
"files": "test/index.js"
|
||||||
|
},
|
||||||
|
"auto-changelog": {
|
||||||
|
"output": "CHANGELOG.md",
|
||||||
|
"template": "keepachangelog",
|
||||||
|
"unreleased": false,
|
||||||
|
"commitLimit": false,
|
||||||
|
"backfillLimit": false,
|
||||||
|
"hideCredit": true
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"ignore": [
|
||||||
|
".github/workflows",
|
||||||
|
"test"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"extends": "@ljharb/tsconfig",
|
||||||
|
"exclude": [
|
||||||
|
"coverage",
|
||||||
|
],
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"extends": "@ljharb",
|
||||||
|
"root": true,
|
||||||
|
"rules": {
|
||||||
|
"func-style": 1,
|
||||||
|
},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": "test/**",
|
||||||
|
"rules": {
|
||||||
|
"global-require": 0,
|
||||||
|
"max-depth": 0,
|
||||||
|
"max-lines-per-function": 0,
|
||||||
|
"no-negated-condition": 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||