Skip to content

Commit

Permalink
consolidating mithril/tailwind vendoring
Browse files Browse the repository at this point in the history
  • Loading branch information
progrium committed Mar 9, 2024
1 parent 83e6749 commit 4321873
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 50 deletions.
4 changes: 2 additions & 2 deletions internal/app/explorer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="./vnd/tailwind-2.2.16.min.css" rel="stylesheet" />
<script src="./vnd/mithril-2.0.3.min.js"></script>
<link href="/sys/cmd/kernel/web/vnd/tailwind/tailwind-2.2.16.min.css" rel="stylesheet" />
<script src="/sys/cmd/kernel/web/vnd/mithril/mithril-2.2.3.min.js"></script>
<link rel="stylesheet" href="./styles.css">
<title>File Explorer</title>
</head>
Expand Down
1 change: 0 additions & 1 deletion internal/app/explorer/vnd/mithril-2.0.3.min.js

This file was deleted.

1 change: 0 additions & 1 deletion internal/app/explorer/vnd/tailwind-2.2.16.min.css

This file was deleted.

4 changes: 2 additions & 2 deletions internal/app/jazz-todo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="./vnd/tailwind-2.2.16.min.css" rel="stylesheet" />
<script src="./vnd/mithril-2.2.3.min.js"></script>
<link href="/sys/cmd/kernel/web/vnd/tailwind/tailwind-2.2.16.min.css" rel="stylesheet" />
<script src="/sys/cmd/kernel/web/vnd/mithril/mithril-2.2.3.min.js"></script>
<title>Jazz Todos</title>
</head>
<body class="h-full font-mono font-semibold bg-gray-300">
Expand Down
27 changes: 0 additions & 27 deletions internal/app/jazz-todo/vnd/jazz.min.js

This file was deleted.

1 change: 0 additions & 1 deletion internal/app/jazz-todo/vnd/tailwind-2.2.16.min.css

This file was deleted.

28 changes: 14 additions & 14 deletions kernel/jazz/jazz.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type jazzfs struct {

func NewJazzFs() fs.FS {
return &jazzfs{
cache: cache.New(1 * time.Second),
cache: cache.New(2 * time.Second),
}
}

Expand Down Expand Up @@ -200,10 +200,9 @@ type jazzfile struct {
node js.Value
path string
offset int64
rcache []byte
cache []byte
lastFid string
dirty bool
wcache []byte
wmu sync.Mutex
}

Expand All @@ -220,16 +219,17 @@ func (f *jazzfile) ReadDir(n int) ([]fs.DirEntry, error) {
}

func (f *jazzfile) data() ([]byte, error) {
stat := fsUtil("stat", f.path)
if stat.IsNull() {
return []byte{}, os.ErrNotExist
fi, err := f.fs.Stat(f.path)
if err != nil {
return nil, err
}
fid := stat.Get("fileID")
stat := fi.(*jazzinfo)
fid := stat.val.Get("fileID")
if fid.IsUndefined() {
return []byte{}, os.ErrNotExist
}
if fid.String() == f.lastFid {
return f.rcache, nil
return f.cache, nil
}
jsbuf := fsUtil("fetchFile", fid)
buf := make([]byte, jsbuf.Length())
Expand All @@ -240,7 +240,7 @@ func (f *jazzfile) data() ([]byte, error) {
// log("slow file load, returning cached", f.path)
// return f.rcache, nil
// case b := <-ch:
f.rcache = buf
f.cache = buf
f.lastFid = fid.String()
return buf, nil
// }
Expand Down Expand Up @@ -300,11 +300,11 @@ func (f *jazzfile) Write(p []byte) (n int, err error) {
}
new := make([]byte, f.offset+int64(len(p)))
copy(new, cur[:f.offset])
copy(new[f.offset:], p)
f.wcache = new
f.offset += int64(len(p))
n = copy(new[f.offset:], p)
f.cache = new
f.offset += int64(n)
f.dirty = true
return len(p), nil
return n, nil
}

func (f *jazzfile) Close() error {
Expand All @@ -322,7 +322,7 @@ func (f *jazzfile) Sync() error {
f.dirty = false
ch := make(chan bool, 1)
go func() {
f.setData(f.wcache)
f.setData(f.cache)
ch <- true
}()
select {
Expand Down
2 changes: 1 addition & 1 deletion kernel/jazz/jazz.min.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion kernel/web/vnd/mithril/mithril-2.0.3.min.js

This file was deleted.

File renamed without changes.

0 comments on commit 4321873

Please sign in to comment.