typenative 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +71 -0
- package/README.md +17 -1
- package/bin/cli.js +25 -11
- package/bin/go/convert.js +11 -1
- package/bin/index.js +221 -44
- package/bin/main.js +35 -14
- package/bin/node/assert.js +2 -2
- package/bin/node/buffer.js +9 -0
- package/bin/node/dns.js +1 -1
- package/bin/node/events.js +1 -1
- package/bin/node/fs.js +1 -1
- package/bin/node/fs_watch.js +407 -0
- package/bin/node/http2.js +33 -6
- package/bin/node/readline.js +1 -1
- package/bin/node/registry.js +2 -1
- package/bin/node/stream.js +6 -3
- package/bin/node/timers.js +1 -1
- package/bin/node/tls.js +3 -1
- package/bin/node/typed_arrays.js +608 -0
- package/bin/node/util.js +3 -0
- package/bin/node/zlib.js +131 -16
- package/bin/transpiler.js +684 -62
- package/bin/version.js +1 -1
- package/conformance.md +16 -4
- package/examples/README.md +54 -0
- package/examples/fibonacci/README.md +89 -0
- package/examples/fibonacci/bench.mjs +87 -0
- package/examples/fibonacci/main.ts +21 -0
- package/examples/hello-world/README.md +62 -0
- package/examples/hello-world/bench.mjs +66 -0
- package/examples/hello-world/main.ts +7 -0
- package/examples/json-server/README.md +125 -0
- package/examples/json-server/bench.mjs +171 -0
- package/examples/json-server/main.ts +67 -0
- package/govendor/github.com/andybalholm/brotli/LICENSE +19 -0
- package/govendor/github.com/andybalholm/brotli/README.md +19 -0
- package/govendor/github.com/andybalholm/brotli/backward_references.go +185 -0
- package/govendor/github.com/andybalholm/brotli/backward_references_hq.go +796 -0
- package/govendor/github.com/andybalholm/brotli/bit_cost.go +436 -0
- package/govendor/github.com/andybalholm/brotli/bit_reader.go +266 -0
- package/govendor/github.com/andybalholm/brotli/bitwriter.go +56 -0
- package/govendor/github.com/andybalholm/brotli/block_splitter.go +144 -0
- package/govendor/github.com/andybalholm/brotli/block_splitter_command.go +434 -0
- package/govendor/github.com/andybalholm/brotli/block_splitter_distance.go +433 -0
- package/govendor/github.com/andybalholm/brotli/block_splitter_literal.go +433 -0
- package/govendor/github.com/andybalholm/brotli/brotli_bit_stream.go +1435 -0
- package/govendor/github.com/andybalholm/brotli/cluster.go +30 -0
- package/govendor/github.com/andybalholm/brotli/cluster_command.go +164 -0
- package/govendor/github.com/andybalholm/brotli/cluster_distance.go +326 -0
- package/govendor/github.com/andybalholm/brotli/cluster_literal.go +326 -0
- package/govendor/github.com/andybalholm/brotli/command.go +254 -0
- package/govendor/github.com/andybalholm/brotli/compress_fragment.go +834 -0
- package/govendor/github.com/andybalholm/brotli/compress_fragment_two_pass.go +775 -0
- package/govendor/github.com/andybalholm/brotli/constants.go +77 -0
- package/govendor/github.com/andybalholm/brotli/context.go +2176 -0
- package/govendor/github.com/andybalholm/brotli/decode.go +2570 -0
- package/govendor/github.com/andybalholm/brotli/dictionary.go +122890 -0
- package/govendor/github.com/andybalholm/brotli/dictionary_hash.go +32779 -0
- package/govendor/github.com/andybalholm/brotli/encode.go +1220 -0
- package/govendor/github.com/andybalholm/brotli/encoder.go +177 -0
- package/govendor/github.com/andybalholm/brotli/encoder_dict.go +22 -0
- package/govendor/github.com/andybalholm/brotli/encoder_fast.go +201 -0
- package/govendor/github.com/andybalholm/brotli/entropy_encode.go +592 -0
- package/govendor/github.com/andybalholm/brotli/entropy_encode_static.go +4399 -0
- package/govendor/github.com/andybalholm/brotli/fast_log.go +290 -0
- package/govendor/github.com/andybalholm/brotli/find_match_length.go +45 -0
- package/govendor/github.com/andybalholm/brotli/go.mod +3 -0
- package/govendor/github.com/andybalholm/brotli/h10.go +287 -0
- package/govendor/github.com/andybalholm/brotli/h5.go +214 -0
- package/govendor/github.com/andybalholm/brotli/h6.go +216 -0
- package/govendor/github.com/andybalholm/brotli/hash.go +342 -0
- package/govendor/github.com/andybalholm/brotli/hash_composite.go +93 -0
- package/govendor/github.com/andybalholm/brotli/hash_forgetful_chain.go +252 -0
- package/govendor/github.com/andybalholm/brotli/hash_longest_match_quickly.go +214 -0
- package/govendor/github.com/andybalholm/brotli/hash_rolling.go +168 -0
- package/govendor/github.com/andybalholm/brotli/histogram.go +226 -0
- package/govendor/github.com/andybalholm/brotli/http.go +201 -0
- package/govendor/github.com/andybalholm/brotli/huffman.go +653 -0
- package/govendor/github.com/andybalholm/brotli/literal_cost.go +182 -0
- package/govendor/github.com/andybalholm/brotli/matchfinder/bargain1.go +212 -0
- package/govendor/github.com/andybalholm/brotli/matchfinder/bargain2.go +248 -0
- package/govendor/github.com/andybalholm/brotli/matchfinder/bargain3.go +278 -0
- package/govendor/github.com/andybalholm/brotli/matchfinder/emitter.go +34 -0
- package/govendor/github.com/andybalholm/brotli/matchfinder/m0.go +175 -0
- package/govendor/github.com/andybalholm/brotli/matchfinder/m4.go +339 -0
- package/govendor/github.com/andybalholm/brotli/matchfinder/matchfinder.go +103 -0
- package/govendor/github.com/andybalholm/brotli/matchfinder/pathfinder.go +328 -0
- package/govendor/github.com/andybalholm/brotli/matchfinder/textencoder.go +53 -0
- package/govendor/github.com/andybalholm/brotli/matchfinder/trio.go +327 -0
- package/govendor/github.com/andybalholm/brotli/matchfinder/zdfast.go +258 -0
- package/govendor/github.com/andybalholm/brotli/matchfinder/zfast.go +206 -0
- package/govendor/github.com/andybalholm/brotli/matchfinder/zm.go +302 -0
- package/govendor/github.com/andybalholm/brotli/memory.go +66 -0
- package/govendor/github.com/andybalholm/brotli/metablock.go +574 -0
- package/govendor/github.com/andybalholm/brotli/metablock_command.go +165 -0
- package/govendor/github.com/andybalholm/brotli/metablock_distance.go +165 -0
- package/govendor/github.com/andybalholm/brotli/metablock_literal.go +165 -0
- package/govendor/github.com/andybalholm/brotli/params.go +37 -0
- package/govendor/github.com/andybalholm/brotli/platform.go +103 -0
- package/govendor/github.com/andybalholm/brotli/prefix.go +30 -0
- package/govendor/github.com/andybalholm/brotli/prefix_dec.go +723 -0
- package/govendor/github.com/andybalholm/brotli/quality.go +196 -0
- package/govendor/github.com/andybalholm/brotli/reader.go +127 -0
- package/govendor/github.com/andybalholm/brotli/ringbuffer.go +134 -0
- package/govendor/github.com/andybalholm/brotli/state.go +313 -0
- package/govendor/github.com/andybalholm/brotli/static_dict.go +662 -0
- package/govendor/github.com/andybalholm/brotli/static_dict_lut.go +75094 -0
- package/govendor/github.com/andybalholm/brotli/symbol_list.go +22 -0
- package/govendor/github.com/andybalholm/brotli/transform.go +641 -0
- package/govendor/github.com/andybalholm/brotli/utf8_util.go +70 -0
- package/govendor/github.com/andybalholm/brotli/util.go +7 -0
- package/govendor/github.com/andybalholm/brotli/write_bits.go +52 -0
- package/govendor/github.com/andybalholm/brotli/writer.go +162 -0
- package/govendor/github.com/fsnotify/fsnotify/.mailmap +2 -0
- package/govendor/github.com/fsnotify/fsnotify/CHANGELOG.md +651 -0
- package/govendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md +147 -0
- package/govendor/github.com/fsnotify/fsnotify/LICENSE +25 -0
- package/govendor/github.com/fsnotify/fsnotify/README.md +214 -0
- package/govendor/github.com/fsnotify/fsnotify/backend_fen.go +469 -0
- package/govendor/github.com/fsnotify/fsnotify/backend_inotify.go +597 -0
- package/govendor/github.com/fsnotify/fsnotify/backend_kqueue.go +735 -0
- package/govendor/github.com/fsnotify/fsnotify/backend_other.go +22 -0
- package/govendor/github.com/fsnotify/fsnotify/backend_windows.go +702 -0
- package/govendor/github.com/fsnotify/fsnotify/fsnotify.go +526 -0
- package/govendor/github.com/fsnotify/fsnotify/go.mod +3 -0
- package/govendor/github.com/fsnotify/fsnotify/internal/darwin.go +20 -0
- package/govendor/github.com/fsnotify/fsnotify/internal/debug_darwin.go +15 -0
- package/govendor/github.com/fsnotify/fsnotify/internal/debug_dragonfly.go +15 -0
- package/govendor/github.com/fsnotify/fsnotify/internal/debug_freebsd.go +20 -0
- package/govendor/github.com/fsnotify/fsnotify/internal/debug_kqueue.go +32 -0
- package/govendor/github.com/fsnotify/fsnotify/internal/debug_linux.go +56 -0
- package/govendor/github.com/fsnotify/fsnotify/internal/debug_netbsd.go +15 -0
- package/govendor/github.com/fsnotify/fsnotify/internal/debug_openbsd.go +16 -0
- package/govendor/github.com/fsnotify/fsnotify/internal/debug_solaris.go +45 -0
- package/govendor/github.com/fsnotify/fsnotify/internal/debug_windows.go +40 -0
- package/govendor/github.com/fsnotify/fsnotify/internal/freebsd.go +20 -0
- package/govendor/github.com/fsnotify/fsnotify/internal/internal.go +2 -0
- package/govendor/github.com/fsnotify/fsnotify/internal/unix.go +20 -0
- package/govendor/github.com/fsnotify/fsnotify/internal/unix2.go +25 -0
- package/govendor/github.com/fsnotify/fsnotify/internal/windows.go +40 -0
- package/govendor/github.com/fsnotify/fsnotify/shared.go +64 -0
- package/govendor/github.com/fsnotify/fsnotify/staticcheck.conf +3 -0
- package/govendor/github.com/fsnotify/fsnotify/system_bsd.go +7 -0
- package/govendor/github.com/fsnotify/fsnotify/system_darwin.go +8 -0
- package/govendor/manifest.txt +3 -1
- package/package.json +1 -1
- package/types/typenative-npm.d.ts +72 -0
- package/types/typenative.d.ts +117 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
package internal
|
|
2
|
+
|
|
3
|
+
import "golang.org/x/sys/unix"
|
|
4
|
+
|
|
5
|
+
var names = []struct {
|
|
6
|
+
n string
|
|
7
|
+
m uint32
|
|
8
|
+
}{
|
|
9
|
+
{"NOTE_ATTRIB", unix.NOTE_ATTRIB},
|
|
10
|
+
{"NOTE_DELETE", unix.NOTE_DELETE},
|
|
11
|
+
{"NOTE_EXTEND", unix.NOTE_EXTEND},
|
|
12
|
+
{"NOTE_LINK", unix.NOTE_LINK},
|
|
13
|
+
{"NOTE_RENAME", unix.NOTE_RENAME},
|
|
14
|
+
{"NOTE_WRITE", unix.NOTE_WRITE},
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
package internal
|
|
2
|
+
|
|
3
|
+
import "golang.org/x/sys/unix"
|
|
4
|
+
|
|
5
|
+
var names = []struct {
|
|
6
|
+
n string
|
|
7
|
+
m uint32
|
|
8
|
+
}{
|
|
9
|
+
{"NOTE_ATTRIB", unix.NOTE_ATTRIB},
|
|
10
|
+
{"NOTE_DELETE", unix.NOTE_DELETE},
|
|
11
|
+
{"NOTE_EXTEND", unix.NOTE_EXTEND},
|
|
12
|
+
{"NOTE_LINK", unix.NOTE_LINK},
|
|
13
|
+
{"NOTE_RENAME", unix.NOTE_RENAME},
|
|
14
|
+
{"NOTE_TRUNCATE", unix.NOTE_TRUNCATE},
|
|
15
|
+
{"NOTE_WRITE", unix.NOTE_WRITE},
|
|
16
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
package internal
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"fmt"
|
|
5
|
+
"os"
|
|
6
|
+
"strings"
|
|
7
|
+
"time"
|
|
8
|
+
|
|
9
|
+
"golang.org/x/sys/unix"
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
func Debug(name string, mask int32) {
|
|
13
|
+
names := []struct {
|
|
14
|
+
n string
|
|
15
|
+
m int32
|
|
16
|
+
}{
|
|
17
|
+
{"FILE_ACCESS", unix.FILE_ACCESS},
|
|
18
|
+
{"FILE_MODIFIED", unix.FILE_MODIFIED},
|
|
19
|
+
{"FILE_ATTRIB", unix.FILE_ATTRIB},
|
|
20
|
+
{"FILE_TRUNC", unix.FILE_TRUNC},
|
|
21
|
+
{"FILE_NOFOLLOW", unix.FILE_NOFOLLOW},
|
|
22
|
+
{"FILE_DELETE", unix.FILE_DELETE},
|
|
23
|
+
{"FILE_RENAME_TO", unix.FILE_RENAME_TO},
|
|
24
|
+
{"FILE_RENAME_FROM", unix.FILE_RENAME_FROM},
|
|
25
|
+
{"UNMOUNTED", unix.UNMOUNTED},
|
|
26
|
+
{"MOUNTEDOVER", unix.MOUNTEDOVER},
|
|
27
|
+
{"FILE_EXCEPTION", unix.FILE_EXCEPTION},
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var (
|
|
31
|
+
l []string
|
|
32
|
+
unknown = mask
|
|
33
|
+
)
|
|
34
|
+
for _, n := range names {
|
|
35
|
+
if mask&n.m == n.m {
|
|
36
|
+
l = append(l, n.n)
|
|
37
|
+
unknown ^= n.m
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if unknown > 0 {
|
|
41
|
+
l = append(l, fmt.Sprintf("0x%x", unknown))
|
|
42
|
+
}
|
|
43
|
+
fmt.Fprintf(os.Stderr, "FSNOTIFY_DEBUG: %s %10d:%-30s → %q\n",
|
|
44
|
+
time.Now().Format("15:04:05.000000000"), mask, strings.Join(l, " | "), name)
|
|
45
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
package internal
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"fmt"
|
|
5
|
+
"os"
|
|
6
|
+
"path/filepath"
|
|
7
|
+
"strings"
|
|
8
|
+
"time"
|
|
9
|
+
|
|
10
|
+
"golang.org/x/sys/windows"
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
func Debug(name string, mask uint32) {
|
|
14
|
+
names := []struct {
|
|
15
|
+
n string
|
|
16
|
+
m uint32
|
|
17
|
+
}{
|
|
18
|
+
{"FILE_ACTION_ADDED", windows.FILE_ACTION_ADDED},
|
|
19
|
+
{"FILE_ACTION_REMOVED", windows.FILE_ACTION_REMOVED},
|
|
20
|
+
{"FILE_ACTION_MODIFIED", windows.FILE_ACTION_MODIFIED},
|
|
21
|
+
{"FILE_ACTION_RENAMED_OLD_NAME", windows.FILE_ACTION_RENAMED_OLD_NAME},
|
|
22
|
+
{"FILE_ACTION_RENAMED_NEW_NAME", windows.FILE_ACTION_RENAMED_NEW_NAME},
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var (
|
|
26
|
+
l []string
|
|
27
|
+
unknown = mask
|
|
28
|
+
)
|
|
29
|
+
for _, n := range names {
|
|
30
|
+
if mask&n.m == n.m {
|
|
31
|
+
l = append(l, n.n)
|
|
32
|
+
unknown ^= n.m
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if unknown > 0 {
|
|
36
|
+
l = append(l, fmt.Sprintf("0x%x", unknown))
|
|
37
|
+
}
|
|
38
|
+
fmt.Fprintf(os.Stderr, "FSNOTIFY_DEBUG: %s %-65s → %q\n",
|
|
39
|
+
time.Now().Format("15:04:05.000000000"), strings.Join(l, " | "), filepath.ToSlash(name))
|
|
40
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//go:build freebsd
|
|
2
|
+
|
|
3
|
+
package internal
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"syscall"
|
|
7
|
+
|
|
8
|
+
"golang.org/x/sys/unix"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
var (
|
|
12
|
+
ErrSyscallEACCES = syscall.EACCES
|
|
13
|
+
ErrUnixEACCES = unix.EACCES
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
var maxfiles uint64
|
|
17
|
+
|
|
18
|
+
func Maxfiles() uint64 { return maxfiles }
|
|
19
|
+
func Mkfifo(path string, mode uint32) error { return unix.Mkfifo(path, mode) }
|
|
20
|
+
func Mknod(path string, mode uint32, dev int) error { return unix.Mknod(path, mode, uint64(dev)) }
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//go:build !windows && !darwin && !freebsd && !plan9
|
|
2
|
+
|
|
3
|
+
package internal
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"syscall"
|
|
7
|
+
|
|
8
|
+
"golang.org/x/sys/unix"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
var (
|
|
12
|
+
ErrSyscallEACCES = syscall.EACCES
|
|
13
|
+
ErrUnixEACCES = unix.EACCES
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
var maxfiles uint64
|
|
17
|
+
|
|
18
|
+
func Maxfiles() uint64 { return maxfiles }
|
|
19
|
+
func Mkfifo(path string, mode uint32) error { return unix.Mkfifo(path, mode) }
|
|
20
|
+
func Mknod(path string, mode uint32, dev int) error { return unix.Mknod(path, mode, dev) }
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//go:build !windows
|
|
2
|
+
|
|
3
|
+
package internal
|
|
4
|
+
|
|
5
|
+
import "syscall"
|
|
6
|
+
|
|
7
|
+
func HasPrivilegesForSymlink() bool {
|
|
8
|
+
return true
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// IgnoringEINTR makes a function call and repeats it if it returns an
|
|
12
|
+
// EINTR error. This appears to be required even though we install all
|
|
13
|
+
// signal handlers with SA_RESTART: see #22838, #38033, #38836, #40846.
|
|
14
|
+
// Also #20400 and #36644 are issues in which a signal handler is
|
|
15
|
+
// installed without setting SA_RESTART. None of these are the common case,
|
|
16
|
+
// but there are enough of them that it seems that we can't avoid
|
|
17
|
+
// an EINTR loop.
|
|
18
|
+
func IgnoringEINTR[T any](fn func() (T, error)) (T, error) {
|
|
19
|
+
for {
|
|
20
|
+
v, err := fn()
|
|
21
|
+
if err != syscall.EINTR {
|
|
22
|
+
return v, err
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//go:build windows
|
|
2
|
+
|
|
3
|
+
package internal
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"errors"
|
|
7
|
+
|
|
8
|
+
"golang.org/x/sys/windows"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
// Just a dummy.
|
|
12
|
+
var (
|
|
13
|
+
ErrSyscallEACCES = errors.New("dummy")
|
|
14
|
+
ErrUnixEACCES = errors.New("dummy")
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
func Maxfiles() uint64 { return 1<<64 - 1 }
|
|
18
|
+
func Mkfifo(path string, mode uint32) error { return errors.New("no FIFOs on Windows") }
|
|
19
|
+
func Mknod(path string, mode uint32, dev int) error { return errors.New("no device nodes on Windows") }
|
|
20
|
+
|
|
21
|
+
func HasPrivilegesForSymlink() bool {
|
|
22
|
+
var sid *windows.SID
|
|
23
|
+
err := windows.AllocateAndInitializeSid(
|
|
24
|
+
&windows.SECURITY_NT_AUTHORITY,
|
|
25
|
+
2,
|
|
26
|
+
windows.SECURITY_BUILTIN_DOMAIN_RID,
|
|
27
|
+
windows.DOMAIN_ALIAS_RID_ADMINS,
|
|
28
|
+
0, 0, 0, 0, 0, 0,
|
|
29
|
+
&sid)
|
|
30
|
+
if err != nil {
|
|
31
|
+
return false
|
|
32
|
+
}
|
|
33
|
+
defer windows.FreeSid(sid)
|
|
34
|
+
token := windows.Token(0)
|
|
35
|
+
member, err := token.IsMember(sid)
|
|
36
|
+
if err != nil {
|
|
37
|
+
return false
|
|
38
|
+
}
|
|
39
|
+
return member || token.IsElevated()
|
|
40
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
package fsnotify
|
|
2
|
+
|
|
3
|
+
import "sync"
|
|
4
|
+
|
|
5
|
+
type shared struct {
|
|
6
|
+
Events chan Event
|
|
7
|
+
Errors chan error
|
|
8
|
+
done chan struct{}
|
|
9
|
+
mu sync.Mutex
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
func newShared(ev chan Event, errs chan error) *shared {
|
|
13
|
+
return &shared{
|
|
14
|
+
Events: ev,
|
|
15
|
+
Errors: errs,
|
|
16
|
+
done: make(chan struct{}),
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Returns true if the event was sent, or false if watcher is closed.
|
|
21
|
+
func (w *shared) sendEvent(e Event) bool {
|
|
22
|
+
if e.Op == 0 {
|
|
23
|
+
return true
|
|
24
|
+
}
|
|
25
|
+
select {
|
|
26
|
+
case <-w.done:
|
|
27
|
+
return false
|
|
28
|
+
case w.Events <- e:
|
|
29
|
+
return true
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Returns true if the error was sent, or false if watcher is closed.
|
|
34
|
+
func (w *shared) sendError(err error) bool {
|
|
35
|
+
if err == nil {
|
|
36
|
+
return true
|
|
37
|
+
}
|
|
38
|
+
select {
|
|
39
|
+
case <-w.done:
|
|
40
|
+
return false
|
|
41
|
+
case w.Errors <- err:
|
|
42
|
+
return true
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
func (w *shared) isClosed() bool {
|
|
47
|
+
select {
|
|
48
|
+
case <-w.done:
|
|
49
|
+
return true
|
|
50
|
+
default:
|
|
51
|
+
return false
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Mark as closed; returns true if it was already closed.
|
|
56
|
+
func (w *shared) close() bool {
|
|
57
|
+
w.mu.Lock()
|
|
58
|
+
defer w.mu.Unlock()
|
|
59
|
+
if w.isClosed() {
|
|
60
|
+
return true
|
|
61
|
+
}
|
|
62
|
+
close(w.done)
|
|
63
|
+
return false
|
|
64
|
+
}
|
package/govendor/manifest.txt
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Generated by scripts/vendor-go.mjs — do not edit
|
|
2
|
-
version github.com/ncruces/go-sqlite3@v0.35.6
|
|
2
|
+
version github.com/ncruces/go-sqlite3@v0.35.6,github.com/andybalholm/brotli@v1.2.6,github.com/fsnotify/fsnotify@v1.10.1
|
|
3
3
|
go 1.26.0
|
|
4
|
+
module github.com/andybalholm/brotli v1.2.6
|
|
5
|
+
module github.com/fsnotify/fsnotify v1.10.1
|
|
4
6
|
module github.com/ncruces/go-sqlite3 v0.35.6
|
|
5
7
|
module github.com/ncruces/go-sqlite3-wasm/v6 v6.3.35304
|
|
6
8
|
module github.com/ncruces/julianday v1.0.0
|
package/package.json
CHANGED
|
@@ -238,6 +238,36 @@ declare module 'node:fs' {
|
|
|
238
238
|
function createReadStream(path: PathLike, options?: BufferEncoding | { encoding?: BufferEncoding; start?: number; end?: number; highWaterMark?: number }): ReadStream;
|
|
239
239
|
function createWriteStream(path: PathLike, options?: BufferEncoding | { flags?: string; encoding?: BufferEncoding }): WriteStream;
|
|
240
240
|
|
|
241
|
+
// --- watching: fs.watch on the OS's notifications (fsnotify), watchFile polls stat() ---
|
|
242
|
+
type WatchEventType = 'rename' | 'change';
|
|
243
|
+
type WatchListener = (event: WatchEventType, filename: string) => void;
|
|
244
|
+
interface WatchOptions {
|
|
245
|
+
persistent?: boolean;
|
|
246
|
+
recursive?: boolean;
|
|
247
|
+
encoding?: BufferEncoding;
|
|
248
|
+
signal?: AbortSignal;
|
|
249
|
+
}
|
|
250
|
+
interface FSWatcher extends import('node:events').EventEmitter {
|
|
251
|
+
close(): void;
|
|
252
|
+
ref(): this;
|
|
253
|
+
unref(): this;
|
|
254
|
+
on(event: 'change', listener: WatchListener): this;
|
|
255
|
+
on(event: 'error', listener: (error: Error) => void): this;
|
|
256
|
+
on(event: 'close', listener: () => void): this;
|
|
257
|
+
once(event: 'change', listener: WatchListener): this;
|
|
258
|
+
once(event: 'error', listener: (error: Error) => void): this;
|
|
259
|
+
once(event: 'close', listener: () => void): this;
|
|
260
|
+
}
|
|
261
|
+
interface StatWatcher extends import('node:events').EventEmitter {
|
|
262
|
+
ref(): this;
|
|
263
|
+
unref(): this;
|
|
264
|
+
}
|
|
265
|
+
function watch(filename: PathLike, listener?: WatchListener): FSWatcher;
|
|
266
|
+
function watch(filename: PathLike, options: WatchOptions | BufferEncoding, listener?: WatchListener): FSWatcher;
|
|
267
|
+
function watchFile(filename: PathLike, listener: (curr: Stats, prev: Stats) => void): StatWatcher;
|
|
268
|
+
function watchFile(filename: PathLike, options: { persistent?: boolean; interval?: number }, listener: (curr: Stats, prev: Stats) => void): StatWatcher;
|
|
269
|
+
function unwatchFile(filename: PathLike, listener?: (curr: Stats, prev: Stats) => void): void;
|
|
270
|
+
|
|
241
271
|
const promises: typeof import('node:fs/promises');
|
|
242
272
|
}
|
|
243
273
|
export = fs;
|
|
@@ -285,6 +315,11 @@ declare module 'node:fs/promises' {
|
|
|
285
315
|
function readlink(path: fs.PathLike): Promise<string>;
|
|
286
316
|
function link(existingPath: fs.PathLike, newPath: fs.PathLike): Promise<void>;
|
|
287
317
|
function open(path: fs.PathLike, flags?: string, mode?: number | string): Promise<FileHandle>;
|
|
318
|
+
interface FileChangeInfo<T extends string> {
|
|
319
|
+
eventType: fs.WatchEventType;
|
|
320
|
+
filename: T;
|
|
321
|
+
}
|
|
322
|
+
function watch(filename: fs.PathLike, options?: { recursive?: boolean; signal?: AbortSignal; persistent?: boolean }): AsyncIterable<FileChangeInfo<string>>;
|
|
288
323
|
}
|
|
289
324
|
export = promises;
|
|
290
325
|
}
|
|
@@ -965,6 +1000,20 @@ declare module 'node:zlib' {
|
|
|
965
1000
|
function createDeflateRaw(options?: ZlibOptions): import('node:stream').Transform;
|
|
966
1001
|
function createInflateRaw(options?: ZlibOptions): import('node:stream').Transform;
|
|
967
1002
|
function createUnzip(options?: ZlibOptions): import('node:stream').Transform;
|
|
1003
|
+
// Brotli: params keyed by constants.BROTLI_PARAM_QUALITY / BROTLI_PARAM_LGWIN
|
|
1004
|
+
interface BrotliOptions {
|
|
1005
|
+
params?: { [key: number]: number };
|
|
1006
|
+
}
|
|
1007
|
+
function brotliCompressSync(buf: InputType, options?: BrotliOptions): Buffer;
|
|
1008
|
+
function brotliDecompressSync(buf: InputType, options?: BrotliOptions): Buffer;
|
|
1009
|
+
function brotliCompress(buf: InputType, callback: CompressCallback): void;
|
|
1010
|
+
function brotliCompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void;
|
|
1011
|
+
function brotliDecompress(buf: InputType, callback: CompressCallback): void;
|
|
1012
|
+
function brotliDecompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void;
|
|
1013
|
+
namespace brotliCompress { function __promisify__(buf: InputType, options?: BrotliOptions): Promise<Buffer>; }
|
|
1014
|
+
namespace brotliDecompress { function __promisify__(buf: InputType, options?: BrotliOptions): Promise<Buffer>; }
|
|
1015
|
+
function createBrotliCompress(options?: BrotliOptions): import('node:stream').Transform;
|
|
1016
|
+
function createBrotliDecompress(options?: BrotliOptions): import('node:stream').Transform;
|
|
968
1017
|
const constants: {
|
|
969
1018
|
readonly Z_NO_FLUSH: number;
|
|
970
1019
|
readonly Z_SYNC_FLUSH: number;
|
|
@@ -978,6 +1027,29 @@ declare module 'node:zlib' {
|
|
|
978
1027
|
readonly Z_BEST_SPEED: number;
|
|
979
1028
|
readonly Z_BEST_COMPRESSION: number;
|
|
980
1029
|
readonly Z_DEFAULT_COMPRESSION: number;
|
|
1030
|
+
readonly BROTLI_DECODE: number;
|
|
1031
|
+
readonly BROTLI_ENCODE: number;
|
|
1032
|
+
readonly BROTLI_OPERATION_PROCESS: number;
|
|
1033
|
+
readonly BROTLI_OPERATION_FLUSH: number;
|
|
1034
|
+
readonly BROTLI_OPERATION_FINISH: number;
|
|
1035
|
+
readonly BROTLI_OPERATION_EMIT_METADATA: number;
|
|
1036
|
+
readonly BROTLI_PARAM_MODE: number;
|
|
1037
|
+
readonly BROTLI_MODE_GENERIC: number;
|
|
1038
|
+
readonly BROTLI_MODE_TEXT: number;
|
|
1039
|
+
readonly BROTLI_MODE_FONT: number;
|
|
1040
|
+
readonly BROTLI_DEFAULT_MODE: number;
|
|
1041
|
+
readonly BROTLI_PARAM_QUALITY: number;
|
|
1042
|
+
readonly BROTLI_MIN_QUALITY: number;
|
|
1043
|
+
readonly BROTLI_MAX_QUALITY: number;
|
|
1044
|
+
readonly BROTLI_DEFAULT_QUALITY: number;
|
|
1045
|
+
readonly BROTLI_PARAM_LGWIN: number;
|
|
1046
|
+
readonly BROTLI_MIN_WINDOW_BITS: number;
|
|
1047
|
+
readonly BROTLI_MAX_WINDOW_BITS: number;
|
|
1048
|
+
readonly BROTLI_DEFAULT_WINDOW: number;
|
|
1049
|
+
readonly BROTLI_PARAM_LGBLOCK: number;
|
|
1050
|
+
readonly BROTLI_PARAM_SIZE_HINT: number;
|
|
1051
|
+
readonly BROTLI_DECODER_RESULT_ERROR: number;
|
|
1052
|
+
readonly BROTLI_DECODER_RESULT_SUCCESS: number;
|
|
981
1053
|
};
|
|
982
1054
|
}
|
|
983
1055
|
export = zlib;
|
package/types/typenative.d.ts
CHANGED
|
@@ -857,6 +857,8 @@ type BufferEncoding =
|
|
|
857
857
|
interface Uint8Array {
|
|
858
858
|
readonly length: number;
|
|
859
859
|
readonly byteLength: number;
|
|
860
|
+
readonly byteOffset: number;
|
|
861
|
+
readonly buffer: ArrayBuffer;
|
|
860
862
|
[index: number]: number;
|
|
861
863
|
subarray(start?: number, end?: number): Uint8Array;
|
|
862
864
|
slice(start?: number, end?: number): Uint8Array;
|
|
@@ -868,16 +870,130 @@ interface Uint8Array {
|
|
|
868
870
|
interface Uint8ArrayConstructor {
|
|
869
871
|
new (length: number): Uint8Array;
|
|
870
872
|
new (array: ArrayLike<number> | Uint8Array): Uint8Array;
|
|
873
|
+
// A view sharing the buffer's memory
|
|
874
|
+
new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array;
|
|
871
875
|
from(arrayLike: ArrayLike<number> | Iterable<number>): Uint8Array;
|
|
872
876
|
}
|
|
873
877
|
|
|
874
878
|
declare var Uint8Array: Uint8ArrayConstructor;
|
|
875
879
|
|
|
876
|
-
//
|
|
880
|
+
// An ArrayBuffer is Go []byte too; .buffer of a view is its own bytes
|
|
881
|
+
// (byteOffset 0), so new Float32Array(u8.buffer, u8.byteOffset, n) works
|
|
877
882
|
interface ArrayBuffer {
|
|
878
883
|
readonly byteLength: number;
|
|
884
|
+
slice(begin?: number, end?: number): ArrayBuffer;
|
|
879
885
|
}
|
|
880
886
|
|
|
887
|
+
interface ArrayBufferConstructor {
|
|
888
|
+
new (byteLength: number): ArrayBuffer;
|
|
889
|
+
isView(arg: any): boolean;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
declare var ArrayBuffer: ArrayBufferConstructor;
|
|
893
|
+
|
|
894
|
+
// Typed arrays other than Uint8Array: Go slices of the element type; views
|
|
895
|
+
// made on an ArrayBuffer share its memory
|
|
896
|
+
interface TypedArray<Self> {
|
|
897
|
+
readonly length: number;
|
|
898
|
+
readonly byteLength: number;
|
|
899
|
+
readonly byteOffset: number;
|
|
900
|
+
readonly BYTES_PER_ELEMENT: number;
|
|
901
|
+
readonly buffer: ArrayBuffer;
|
|
902
|
+
[index: number]: number;
|
|
903
|
+
fill(value: number, start?: number, end?: number): Self;
|
|
904
|
+
set(array: ArrayLike<number> | TypedArray<any>, offset?: number): void;
|
|
905
|
+
subarray(begin?: number, end?: number): Self;
|
|
906
|
+
slice(start?: number, end?: number): Self;
|
|
907
|
+
at(index: number): number | undefined;
|
|
908
|
+
indexOf(searchElement: number, fromIndex?: number): number;
|
|
909
|
+
lastIndexOf(searchElement: number, fromIndex?: number): number;
|
|
910
|
+
includes(searchElement: number, fromIndex?: number): boolean;
|
|
911
|
+
join(separator?: string): string;
|
|
912
|
+
reverse(): Self;
|
|
913
|
+
toReversed(): Self;
|
|
914
|
+
sort(compareFn?: (a: number, b: number) => number): Self;
|
|
915
|
+
toSorted(compareFn?: (a: number, b: number) => number): Self;
|
|
916
|
+
with(index: number, value: number): Self;
|
|
917
|
+
copyWithin(target: number, start: number, end?: number): Self;
|
|
918
|
+
map(callbackfn: (value: number, index: number, array: Self) => number): Self;
|
|
919
|
+
filter(predicate: (value: number, index: number, array: Self) => unknown): Self;
|
|
920
|
+
forEach(callbackfn: (value: number, index: number, array: Self) => void): void;
|
|
921
|
+
some(predicate: (value: number, index: number, array: Self) => unknown): boolean;
|
|
922
|
+
every(predicate: (value: number, index: number, array: Self) => unknown): boolean;
|
|
923
|
+
find(predicate: (value: number, index: number, array: Self) => unknown): number | undefined;
|
|
924
|
+
findIndex(predicate: (value: number, index: number, array: Self) => unknown): number;
|
|
925
|
+
findLast(predicate: (value: number, index: number, array: Self) => unknown): number | undefined;
|
|
926
|
+
findLastIndex(predicate: (value: number, index: number, array: Self) => unknown): number;
|
|
927
|
+
reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Self) => number): number;
|
|
928
|
+
reduce<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Self) => U, initialValue: U): U;
|
|
929
|
+
reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Self) => number): number;
|
|
930
|
+
reduceRight<U>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Self) => U, initialValue: U): U;
|
|
931
|
+
keys(): IterableIterator<number>;
|
|
932
|
+
values(): IterableIterator<number>;
|
|
933
|
+
entries(): IterableIterator<[number, number]>;
|
|
934
|
+
toString(): string;
|
|
935
|
+
toLocaleString(): string;
|
|
936
|
+
[Symbol.iterator](): IterableIterator<number>;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
interface TypedArrayConstructor<T> {
|
|
940
|
+
new (length?: number): T;
|
|
941
|
+
new (array: ArrayLike<number> | Iterable<number> | TypedArray<any>): T;
|
|
942
|
+
new (buffer: ArrayBuffer, byteOffset?: number, length?: number): T;
|
|
943
|
+
from(arrayLike: ArrayLike<number> | Iterable<number> | TypedArray<any>, mapfn?: (v: number, k: number) => number): T;
|
|
944
|
+
of(...items: number[]): T;
|
|
945
|
+
readonly BYTES_PER_ELEMENT: number;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
interface Int8Array extends TypedArray<Int8Array> {}
|
|
949
|
+
declare var Int8Array: TypedArrayConstructor<Int8Array>;
|
|
950
|
+
interface Uint8ClampedArray extends TypedArray<Uint8ClampedArray> {}
|
|
951
|
+
declare var Uint8ClampedArray: TypedArrayConstructor<Uint8ClampedArray>;
|
|
952
|
+
interface Int16Array extends TypedArray<Int16Array> {}
|
|
953
|
+
declare var Int16Array: TypedArrayConstructor<Int16Array>;
|
|
954
|
+
interface Uint16Array extends TypedArray<Uint16Array> {}
|
|
955
|
+
declare var Uint16Array: TypedArrayConstructor<Uint16Array>;
|
|
956
|
+
interface Int32Array extends TypedArray<Int32Array> {}
|
|
957
|
+
declare var Int32Array: TypedArrayConstructor<Int32Array>;
|
|
958
|
+
interface Uint32Array extends TypedArray<Uint32Array> {}
|
|
959
|
+
declare var Uint32Array: TypedArrayConstructor<Uint32Array>;
|
|
960
|
+
interface Float32Array extends TypedArray<Float32Array> {}
|
|
961
|
+
declare var Float32Array: TypedArrayConstructor<Float32Array>;
|
|
962
|
+
interface Float64Array extends TypedArray<Float64Array> {}
|
|
963
|
+
declare var Float64Array: TypedArrayConstructor<Float64Array>;
|
|
964
|
+
|
|
965
|
+
// Typed reads and writes at byte offsets of an ArrayBuffer (big-endian
|
|
966
|
+
// unless littleEndian is true)
|
|
967
|
+
interface DataView {
|
|
968
|
+
readonly buffer: ArrayBuffer;
|
|
969
|
+
readonly byteOffset: number;
|
|
970
|
+
readonly byteLength: number;
|
|
971
|
+
getInt8(byteOffset: number): number;
|
|
972
|
+
getUint8(byteOffset: number): number;
|
|
973
|
+
getInt16(byteOffset: number, littleEndian?: boolean): number;
|
|
974
|
+
getUint16(byteOffset: number, littleEndian?: boolean): number;
|
|
975
|
+
getInt32(byteOffset: number, littleEndian?: boolean): number;
|
|
976
|
+
getUint32(byteOffset: number, littleEndian?: boolean): number;
|
|
977
|
+
getFloat32(byteOffset: number, littleEndian?: boolean): number;
|
|
978
|
+
getFloat64(byteOffset: number, littleEndian?: boolean): number;
|
|
979
|
+
getBigInt64(byteOffset: number, littleEndian?: boolean): bigint;
|
|
980
|
+
getBigUint64(byteOffset: number, littleEndian?: boolean): bigint;
|
|
981
|
+
setInt8(byteOffset: number, value: number): void;
|
|
982
|
+
setUint8(byteOffset: number, value: number): void;
|
|
983
|
+
setInt16(byteOffset: number, value: number, littleEndian?: boolean): void;
|
|
984
|
+
setUint16(byteOffset: number, value: number, littleEndian?: boolean): void;
|
|
985
|
+
setInt32(byteOffset: number, value: number, littleEndian?: boolean): void;
|
|
986
|
+
setUint32(byteOffset: number, value: number, littleEndian?: boolean): void;
|
|
987
|
+
setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void;
|
|
988
|
+
setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void;
|
|
989
|
+
setBigInt64(byteOffset: number, value: bigint, littleEndian?: boolean): void;
|
|
990
|
+
setBigUint64(byteOffset: number, value: bigint, littleEndian?: boolean): void;
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
declare var DataView: {
|
|
994
|
+
new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView;
|
|
995
|
+
};
|
|
996
|
+
|
|
881
997
|
interface Buffer extends Uint8Array {
|
|
882
998
|
toString(encoding?: BufferEncoding, start?: number, end?: number): string;
|
|
883
999
|
toJSON(): { type: 'Buffer'; data: number[] };
|